> **Reading as an AI agent?** This is the Markdown version of https://docs.meshy.ai/api/creative-lab-keychain.
>
> - Full docs index: https://docs.meshy.ai/llms.txt
> - Single-fetch full content: https://docs.meshy.ai/llms-full.txt
> - Tool-calling access via MCP server: https://docs.meshy.ai/api/ai

---
# Creative Lab Keychain API

Turn a photo into a 3D-printable keychain with a colored relief in two stages. A prototype task generates a colorized concept image from the photo. A build task turns that image into a relief 3D model, and takes the prototype task's ID as `input_task_id`.

- `POST /openapi/creative-lab/keychain/v1/prototype`
- `POST /openapi/creative-lab/keychain/v1/build`

---

## POST /openapi/creative-lab/keychain/v1/prototype -- Create a Keychain prototype task

Generates one colorized concept image from a photo. To build the 3D model, pass this task's ID to the [build endpoint](#create-a-keychain-build-task) as `input_task_id`. For the task's fields, see [The Keychain prototype task object](#the-keychain-prototype-task-object).

### Parameters

  - `image_url` · *string* · **required**

  The photo to turn into a keychain concept image, as a public URL or a data URI (`data:image/jpeg;base64,<your base64-encoded image data>`).

  The image must be a JPG, JPEG, PNG, or WebP file of at most 20 MB.

  - `name` · *string*

  A name for the task, up to 100 characters. It comes back in the task's `name` field. A longer name returns `400`.

  It labels the task in your dashboard and task lists, and doesn't appear on the keychain. To put a name on the keychain, use `name_text`.

  - `name_text` · *string*

  A name to add to the keychain, such as a pet's or a person's name, up to 10 characters. Meshy counts characters, not bytes, so a 10-character Chinese, Japanese, or Korean name fits. A longer name returns `400`. Leave it out for a keychain with no name.

  The name appears on the keychain's face as a flat colored detail, not as raised or cut text.

  Meshy trims surrounding whitespace and removes invisible formatting characters. The [prototype task object](#the-keychain-prototype-task-object) returns the result as `name_text`, so you can check the text before you pay for the build.

  Meshy adds the name at the prototype stage. The [build](#create-a-keychain-build-task) keeps it, and ignores a `name_text` sent to the build endpoint.

  > **Note:** When the text isn't plain ASCII, send the request body as UTF-8 with `Content-Type: application/json; charset=utf-8`. Some HTTP clients, such as Windows PowerShell's `Invoke-RestMethod`, encode the body as ISO-8859-1 by default. That turns every non-Latin character into `?` before the request reaches Meshy, and Meshy can't tell it apart from a name you meant to send.

  - `remove_background` · *boolean* · default: `false`

  Whether to remove the background from the prototype image. `true` returns a transparent RGBA PNG that keeps the whole medallion, so you can place it on any background. The build also starts from the image without its background. If Meshy can't remove the background, it returns the image with its background, and the task still succeeds.

  The build's `remove_background` option is separate.

### Returns

The `result` field holds the ID of the new prototype task. [Get the task](#retrieve-a-keychain-task) or [stream it](#stream-a-keychain-task) until `status` is `SUCCEEDED`. Then pass the ID to the [build endpoint](#create-a-keychain-build-task) as `input_task_id`.

### Failure modes

  - `400 - Bad Request`

  The request can't run. For example:
  * `image_url` is missing.
  * The image isn't a JPG, JPEG, PNG, or WebP file.
  * The image is too small, over 20 MB, or over the maximum pixel count.
  * Meshy can't download the image, for example because the URL returns `404` or times out.
  * The data URI isn't valid base64.
  * `name_text` is longer than 10 characters. Meshy rejects it instead of shortening it, and doesn't charge for the request.
  * The image or `name_text` was flagged as NSFW.

  The error message says which problem it found. Fix the request, then send it again.

  - `401 - Unauthorized`

  The API key is missing or invalid. Check the `Authorization` header.

  - `402 - Payment Required`

  One of these applies:
  * The account doesn't have enough credits.
  * The API key, workspace, or member reached its credit limit.
  * The account is on the free plan.

  Check your credits and plan, then retry.

  - `403 - Forbidden`

  Your team has **IP Filtering** turned on, and Meshy flagged the image for third-party intellectual property. Send an image you have the rights to use. Meshy checks only the image for intellectual property, not `name_text`.

  - `429 - Too Many Requests`

  One of these limits was reached:
  * You sent more requests than your rate limit allows. Wait a few seconds, then retry. See [Rate limits](/api/rate-limits).
  * Too many of your tasks are queued or running. Wait for some to finish, then retry.
  * On an unlimited plan with no credits left, you reached the number of tasks that can run without credits. Wait for a task to finish, or add credits.

  - `500 - Internal Server Error`

  Meshy hit a server error, for example because it couldn't run the intellectual property check on the image. Meshy doesn't create the task, and refunds any credits it charged. Retry the request.

**cURL**

```bash
# Stage 1: generate a colorized keychain concept image
curl https://api.meshy.ai/openapi/creative-lab/keychain/v1/prototype \
  -X POST \
  -H "Authorization: Bearer ${YOUR_API_KEY}" \
  -H 'Content-Type: application/json; charset=utf-8' \
  -d '{
    "image_url": "<your publicly accessible image url or base64-encoded data URI>",
    "name_text": "Luna"
  }'
```

```javascript
import axios from 'axios'

const headers = { Authorization: `Bearer ${YOUR_API_KEY}` };

// Stage 1: generate a colorized keychain concept image
const payload = {
  image_url: "<your publicly accessible image url or base64-encoded data URI>",
  name_text: "Luna",
};

try {
  const response = await axios.post(
    'https://api.meshy.ai/openapi/creative-lab/keychain/v1/prototype',
    payload,
    { headers }
  );
  console.log(response.data);
} catch (error) {
  console.error(error);
}
```

```python
import requests

headers = {
    "Authorization": f"Bearer {YOUR_API_KEY}"
}

# Stage 1: generate a colorized keychain concept image
payload = {
    "image_url": "<your publicly accessible image url or base64-encoded data URI>",
    "name_text": "Luna",
}

response = requests.post(
    "https://api.meshy.ai/openapi/creative-lab/keychain/v1/prototype",
    headers=headers,
    json=payload,
)
response.raise_for_status()
print(response.json())
```

**Response**

```json
{
  "result": "018a210d-8ba4-705c-b111-1f1776f7f578"
}
```

<ImageExample
  title="Prototype example"
  caption="Start with a source photo, then generate the prototype image used by the keychain build stage."
>
  <ImageExampleCard
src="/images/creative-lab/keychain/source-photo.webp"
alt="Source photo used as the Creative Lab Keychain input"
label="Prototype input"
  />
  <ImageExampleCard
src="/images/creative-lab/keychain/prototype-output.webp"
alt="Creative Lab Keychain prototype output generated from the source photo"
label="Prototype output"
  />
</ImageExample>

---

## POST /openapi/creative-lab/keychain/v1/build -- Create a Keychain build task

Generates the 3D-printable keychain from a succeeded prototype task. Meshy turns the prototype's concept image into a depth-map relief, and returns one model file in the format you choose. For the task's fields, see [The Keychain build task object](#the-keychain-build-task-object).

### Parameters

  - `input_task_id` · *string* · **required**

  The ID of the prototype task to build. It must be a task your account created with `POST /openapi/creative-lab/keychain/v1/prototype`, with the status `SUCCEEDED`.

  An ID that isn't one of your Keychain prototype tasks from the API returns `404`, including a prototype made in the web app.

  - `name` · *string*

  A name for the task, up to 100 characters. It comes back in the task's `name` field. A longer name returns `400`.

#### `options`

Optional settings for the relief's shape. Every field has a default, so send only the ones you want to change. A value outside a field's range returns `400`.

  - `badge_shape` · *string* · default: `circle`

  The keychain's outline when Meshy doesn't trace it from the subject. Meshy uses it when `remove_background` is `false`, or when it can't find the subject's outline.

  Available values:
  * `circle`
  * `rounded-rect`
  * `hexagon`
  * `shield`
  * `star`

  - `size_mm` · *number* · default: `40`

  The edge length of the keychain's bounding square, in millimeters, up to `400`. `0` uses the default.

  - `relief_height_mm` · *number* · default: `2.2`

  The relief's maximum height above the base, in millimeters, from `0` to `20`.

  - `relief_offset_mm` · *number* · default: `0`

  How far to lower the relief, in millimeters, from `0` to `20`. Meshy subtracts it from the relief's height everywhere, down to the base.

  - `base_thickness_mm` · *number* · default: `0.1`

  The thickness of the flat base plate behind the relief, in millimeters, from `0` to `20`.

  - `has_closed_back` · *boolean* · default: `true`

  Whether to close the back of the keychain. `false` leaves the back open, as a shell.

  - `relief_curve` · *string* · default: `linear`

  The curve that maps depth-map values to relief height.

  Available values:
  * `linear`
  * `gamma`
  * `s-curve`

  - `curve_param` · *number* · default: `1.0`

  The strength of the curve, up to `10`. The `gamma` and `s-curve` curves use it, and `linear` ignores it. `0` uses the default.

  - `invert_depth` · *boolean* · default: `false`

  Whether to invert the depth map, so darker areas become higher relief.

  - `smoothing` · *number* · default: `0.24`

  How much to smooth the depth map before Meshy builds the relief, from `0` to `10`.

  - `relief_scale` · *number* · default: `1.0`

  How much to zoom the relief and its texture inside the outline, about the center, up to `10`. A value over `1` enlarges the subject, and a value under `1` shrinks it. It doesn't change the relief's height. `0` uses the default.

  - `depth_threshold` · *number* · default: `0.1`

  The depth-map value under which Meshy sets the depth to zero, from `0` to `1`.

  - `remove_background` · *boolean* · default: `true`

  Whether to trace the keychain's outline from the subject, so the keychain follows the subject's shape. `false` uses the `badge_shape` outline instead. Meshy also uses `badge_shape` when it can't find the subject's outline.

  This is separate from the prototype's `remove_background` parameter, which sets whether the prototype image has a transparent background.

  - `export_resolution` · *integer* · default: `512`

  The mesh resolution of the exported model, from `64` to `512`. Meshy builds the geometry from a 512-pixel depth map, so a finer mesh would add faces without adding detail. `0` uses the default.

#### `output`

Optional. Sets the file format the build returns.

  - `format` · *string* · default: `glb`

  The file format the build returns.

  Available values:
  * `glb`: one `model.glb` file, in `model_urls.glb`
  * `obj`: a zip file with `model.obj`, `model.mtl`, and `texture.png`, in `model_urls.obj`
  * `zip`: a zip file with every file Meshy generates, in `model_urls.bundle_zip`

### Returns

The `result` field holds the ID of the new build task. [Get the task](#retrieve-a-keychain-task) or [stream it](#stream-a-keychain-task) until `status` is `SUCCEEDED`. Then download the file from the one entry in `model_urls`.

### Failure modes

  - `400 - Bad Request`

  The request can't run. For example:
  * `input_task_id` is missing or isn't a valid task ID.
  * The prototype task's status isn't `SUCCEEDED`. If it's still running, wait and retry. If it failed or was canceled, create a new prototype task.
  * The prototype task succeeded but has no image. Create a new prototype task.
  * An `options` field is outside its range or isn't an available value.

  The error message says which problem it found.

  - `401 - Unauthorized`

  The API key is missing or invalid. Check the `Authorization` header.

  - `402 - Payment Required`

  One of these applies:
  * The account doesn't have enough credits.
  * The API key, workspace, or member reached its credit limit.
  * The account is on the free plan.

  Check your credits and plan, then retry.

  - `404 - Not Found`

  `input_task_id` doesn't match any Keychain prototype task your account created with the API. A prototype made in the web app also returns `404`. Send the `result` ID from a prototype create response.

  - `429 - Too Many Requests`

  One of these limits was reached:
  * You sent more requests than your rate limit allows. Wait a few seconds, then retry. See [Rate limits](/api/rate-limits).
  * Too many of your tasks are queued or running. Wait for some to finish, then retry.
  * On an unlimited plan with no credits left, you reached the number of tasks that can run without credits. Wait for a task to finish, or add credits.

**cURL**

```bash
# Stage 2: chain build off a succeeded prototype task
curl https://api.meshy.ai/openapi/creative-lab/keychain/v1/build \
  -X POST \
  -H "Authorization: Bearer ${YOUR_API_KEY}" \
  -H 'Content-Type: application/json' \
  -d '{
    "input_task_id": "018a210d-8ba4-705c-b111-1f1776f7f578",
    "options": {
      "badge_shape": "circle",
      "size_mm": 40,
      "relief_height_mm": 2.5
    },
    "output": {
      "format": "glb"
    }
  }'
```

```javascript
import axios from 'axios'

const headers = { Authorization: `Bearer ${YOUR_API_KEY}` };

// Stage 2: chain build off a succeeded prototype task
const payload = {
  input_task_id: "018a210d-8ba4-705c-b111-1f1776f7f578",
  options: {
    badge_shape: "circle",
    size_mm: 40,
    relief_height_mm: 2.5,
  },
  output: { format: "glb" },
};

try {
  const response = await axios.post(
    'https://api.meshy.ai/openapi/creative-lab/keychain/v1/build',
    payload,
    { headers }
  );
  console.log(response.data);
} catch (error) {
  console.error(error);
}
```

```python
import requests

headers = {
    "Authorization": f"Bearer {YOUR_API_KEY}"
}

# Stage 2: chain build off a succeeded prototype task
payload = {
    "input_task_id": "018a210d-8ba4-705c-b111-1f1776f7f578",
    "options": {
        "badge_shape": "circle",
        "size_mm": 40,
        "relief_height_mm": 2.5,
    },
    "output": {"format": "glb"},
}

response = requests.post(
    "https://api.meshy.ai/openapi/creative-lab/keychain/v1/build",
    headers=headers,
    json=payload,
)
response.raise_for_status()
print(response.json())
```

**Response**

```json
{
  "result": "019c320e-9a8f-7a1c-9c11-2a1876f8a9bb"
}
```

<ImageExample
  title="Build example"
  caption="The build task converts the selected prototype image into a 3D-printable keychain model."
>
  <ImageExampleCard
src="/images/creative-lab/keychain/build-preview.webp"
alt="Creative Lab Keychain build model preview"
label="Build model preview"
  />
</ImageExample>

---

## GET /openapi/creative-lab/keychain/v1/(prototype|build)/:id -- Get a Keychain task

Returns a prototype or build task. The path must match the task's stage. A build task requested through `/prototype/:id` returns `404`, and so does a prototype task requested through `/build/:id`.

For the fields, see [The Keychain prototype task object](#the-keychain-prototype-task-object) and [The Keychain build task object](#the-keychain-build-task-object).

### Parameters

  - `id` · *path*

  The task ID from the create response.

### Returns

The [prototype task object](#the-keychain-prototype-task-object) or the [build task object](#the-keychain-build-task-object), matching the stage in the path.

### Failure modes

  - `400 - Bad Request`

  `id` isn't a valid task ID. Send the `result` ID from the create response.

  - `403 - Forbidden`

  Your team has **IP Filtering** turned on, and Meshy flagged the prototype task's image for third-party intellectual property. Build tasks and teams on the Enterprise plan don't get this error. Create a prototype task from an image you have the rights to use.

  - `404 - Not Found`

  No Keychain task with this ID belongs to your account, or the task's stage doesn't match the path. Check the ID, and use `/prototype` or `/build` to match the task.

  - `500 - Internal Server Error`

  Meshy couldn't run the intellectual property check. Retry the request.

**cURL**

```bash
# Prototype
curl https://api.meshy.ai/openapi/creative-lab/keychain/v1/prototype/018a210d-8ba4-705c-b111-1f1776f7f578 \
  -H "Authorization: Bearer ${YOUR_API_KEY}"

# Build
curl https://api.meshy.ai/openapi/creative-lab/keychain/v1/build/019c320e-9a8f-7a1c-9c11-2a1876f8a9bb \
  -H "Authorization: Bearer ${YOUR_API_KEY}"
```

```javascript
import axios from 'axios'

const headers = { Authorization: `Bearer ${YOUR_API_KEY}` };

// Prototype
const prototypeId = '018a210d-8ba4-705c-b111-1f1776f7f578';
const proto = await axios.get(
  `https://api.meshy.ai/openapi/creative-lab/keychain/v1/prototype/${prototypeId}`,
  { headers }
);
console.log(proto.data);

// Build
const buildId = '019c320e-9a8f-7a1c-9c11-2a1876f8a9bb';
const build = await axios.get(
  `https://api.meshy.ai/openapi/creative-lab/keychain/v1/build/${buildId}`,
  { headers }
);
console.log(build.data);
```

```python
import requests

headers = {
    "Authorization": f"Bearer {YOUR_API_KEY}"
}

# Prototype
prototype_id = "018a210d-8ba4-705c-b111-1f1776f7f578"
proto = requests.get(
    f"https://api.meshy.ai/openapi/creative-lab/keychain/v1/prototype/{prototype_id}",
    headers=headers,
)
proto.raise_for_status()
print(proto.json())

# Build
build_id = "019c320e-9a8f-7a1c-9c11-2a1876f8a9bb"
build = requests.get(
    f"https://api.meshy.ai/openapi/creative-lab/keychain/v1/build/{build_id}",
    headers=headers,
)
build.raise_for_status()
print(build.json())
```

**Prototype Response**

```json
{
  "id": "018a210d-8ba4-705c-b111-1f1776f7f578",
  "type": "creative-lab-keychain-prototype",
  "name": "",
  "status": "SUCCEEDED",
  "progress": 100,
  "created_at": 1729123456000,
  "started_at": 1729123460000,
  "finished_at": 1729123486000,
  "expires_at": 1729382686000,
  "preceding_tasks": 0,
  "task_error": null,
  "consumed_credits": 6,
  "image_urls": [
    "https://assets.meshy.ai/***/concept.png?Expires=***"
  ]
}
```

**Build Response**

```json
{
  "id": "019c320e-9a8f-7a1c-9c11-2a1876f8a9bb",
  "type": "creative-lab-keychain-build",
  "name": "",
  "status": "SUCCEEDED",
  "progress": 100,
  "created_at": 1729123500000,
  "started_at": 1729123510000,
  "finished_at": 1729123535000,
  "expires_at": 1729382735000,
  "preceding_tasks": 0,
  "task_error": null,
  "consumed_credits": 30,
  "model_urls": {
    "glb": "https://assets.meshy.ai/***/tasks/019c320e-9a8f-7a1c-9c11-2a1876f8a9bb/output/model.glb?Expires=***"
  }
}
```

---

## DELETE /openapi/creative-lab/keychain/v1/(prototype|build)/:id -- Delete a Keychain task

Cancels a Keychain task. Canceling a `PENDING` task refunds its credits. An `IN_PROGRESS` task is canceled without a refund, because a worker has already started it. A task with a final status (`SUCCEEDED`, `FAILED`, or `CANCELED`) can't be canceled.

The path must match the task's stage. For example, `DELETE` on `/prototype/:id` with a build task's ID returns `404`.

### Path parameters

  - `id` · *path*

  The ID of the task to cancel.

### Returns

`204 No Content` with an empty body.

### Failure modes

  - `400 - Bad Request`

  One of these applies:
  * `id` isn't a valid task ID. Send the `result` ID from the create response.
  * The task already has a final status (`SUCCEEDED`, `FAILED`, or `CANCELED`), so it can't be canceled.

  - `404 - Not Found`

  No Keychain task with this ID belongs to your account, or the task's stage doesn't match the path. Check the ID, and use `/prototype` or `/build` to match the task.

  **cURL**

  ```bash
  curl --request DELETE \
    --url https://api.meshy.ai/openapi/creative-lab/keychain/v1/prototype/018a210d-8ba4-705c-b111-1f1776f7f578 \
    -H "Authorization: Bearer ${YOUR_API_KEY}"
  ```

  ```javascript
  import axios from 'axios'

  const taskId = '018a210d-8ba4-705c-b111-1f1776f7f578'
  const headers = { Authorization: `Bearer ${YOUR_API_KEY}` }

  try {
    await axios.delete(
      `https://api.meshy.ai/openapi/creative-lab/keychain/v1/prototype/${taskId}`,
      { headers }
    )
  } catch (error) {
    console.error(error)
  }
  ```

  ```python
  import requests

  task_id = "018a210d-8ba4-705c-b111-1f1776f7f578"
  headers = {
      "Authorization": f"Bearer {YOUR_API_KEY}"
  }

  response = requests.delete(
      f"https://api.meshy.ai/openapi/creative-lab/keychain/v1/prototype/{task_id}",
      headers=headers,
  )
  response.raise_for_status()
  ```

**Response**

```json
// Returns 204 No Content on success (empty body).
```

---

## GET /openapi/creative-lab/keychain/v1/(prototype|build)/:id/stream -- Stream a Keychain task

Streams a Keychain task's updates as Server-Sent Events (SSE). The path must match the task's stage. If it doesn't, for example a build task's ID at `/prototype/:id/stream`, the stream sends one `error` event with `status_code: 404` and closes.

### Parameters

  - `id` · *path*

  The task ID from the create response.

### Returns

A stream of [prototype](#the-keychain-prototype-task-object) or [build](#the-keychain-build-task-object) task objects. Each event has the full task object, as [Get a Keychain task](#retrieve-a-keychain-task) returns it. While the task is `PENDING` or `IN_PROGRESS`, its output fields are still empty (`null`, `[]`, or `{}`), and `finished_at` is `null`.

If **IP Filtering** blocks the task's result, the stream sends one `error` event in its place, with the `status_code` that a get request would return.

  **cURL**

  ```bash
  curl -N https://api.meshy.ai/openapi/creative-lab/keychain/v1/build/019c320e-9a8f-7a1c-9c11-2a1876f8a9bb/stream \
  -H "Authorization: Bearer ${YOUR_API_KEY}"
  ```

  ```javascript
  const response = await fetch(
    'https://api.meshy.ai/openapi/creative-lab/keychain/v1/build/019c320e-9a8f-7a1c-9c11-2a1876f8a9bb/stream',
    {
      headers: { Authorization: `Bearer ${YOUR_API_KEY}` }
    }
  );

  const reader = response.body.getReader();
  const decoder = new TextDecoder();
  let buffer = '';

  while (true) {
    const { done, value } = await reader.read();
    if (done) break;

    buffer += decoder.decode(value, { stream: true });
    const lines = buffer.split('\n');
    buffer = lines.pop();

    for (const line of lines) {
      if (line.startsWith('data:')) {
        const data = JSON.parse(line.slice(5));
        console.log(data);

        if (['SUCCEEDED', 'FAILED', 'CANCELED'].includes(data.status)) {
          reader.cancel();
        }
      }
    }
  }
  ```

  ```python
  import requests
  import json

  headers = {
      "Authorization": f"Bearer {YOUR_API_KEY}",
      "Accept": "text/event-stream"
  }

  response = requests.get(
      'https://api.meshy.ai/openapi/creative-lab/keychain/v1/build/019c320e-9a8f-7a1c-9c11-2a1876f8a9bb/stream',
      headers=headers,
      stream=True
  )

  for line in response.iter_lines():
      if line:
          if line.startswith(b'data:'):
              data = json.loads(line.decode('utf-8')[5:])
              print(data)

              if data['status'] in ['SUCCEEDED', 'FAILED', 'CANCELED']:
                  break

  response.close()
  ```

  **Response Stream**

  ```javascript
  // Error event example (wrong stage or task not found)
  event: error
  data: {
    "status_code": 404,
    "message": "Task not found"
  }

  // Message event examples illustrate task progress.
  // Every frame is the full task object; fields not yet populated are null / empty.
  // The following PENDING frame is shortened to the fields that change.
  event: message
  data: {
    "id": "019c320e-9a8f-7a1c-9c11-2a1876f8a9bb",
    "progress": 0,
    "status": "PENDING"
  }

  event: message
  data: {
    "id": "019c320e-9a8f-7a1c-9c11-2a1876f8a9bb",
    "type": "creative-lab-keychain-build",
    "status": "SUCCEEDED",
    "progress": 100,
    "created_at": 1729123500000,
    "started_at": 1729123510000,
    "finished_at": 1729123535000,
    "expires_at": 1729382735000,
    "task_error": null,
    "consumed_credits": 30,
    "model_urls": {
      "glb": "https://assets.meshy.ai/***/tasks/019c320e-9a8f-7a1c-9c11-2a1876f8a9bb/output/model.glb?Expires=***"
    }
  }
  ```

---

## GET /openapi/creative-lab/keychain/v1/(prototype|build) -- List Keychain tasks

Returns your Keychain tasks of one stage, one page at a time. The path selects the stage. `/prototype` returns only prototype tasks, and `/build` returns only build tasks.

### Path parameters

  - `stage` · *path* · **required**

  The stage to list, `prototype` or `build`.

### Query parameters

  - `page_num` · *integer* · default: `1`

  The page to return, from `1` to `255`. `0` returns the first page. A value outside `0` to `255` returns `400`.

  - `page_size` · *integer* · default: `10`

  Number of tasks per page, up to `100`. A value from `101` to `255` returns 100 tasks, and `0` uses the default. A value outside `0` to `255` returns `400`.

  - `sort_by` · *string* · default: `-created_at`

  The sort order.

  Available values:
  * `-created_at`: newest first
  * `+created_at`: oldest first

### Returns

An array of [prototype task objects](#the-keychain-prototype-task-object) or [build task objects](#the-keychain-build-task-object), matching the stage in the path.

  **cURL**

  ```bash
  # List prototype tasks
  curl https://api.meshy.ai/openapi/creative-lab/keychain/v1/prototype?page_size=10 \
    -H "Authorization: Bearer ${YOUR_API_KEY}"

  # List build tasks
  curl https://api.meshy.ai/openapi/creative-lab/keychain/v1/build?page_size=10 \
    -H "Authorization: Bearer ${YOUR_API_KEY}"
  ```

  ```javascript
  import axios from 'axios'

  const headers = { Authorization: `Bearer ${YOUR_API_KEY}` }

  try {
    const { data } = await axios.get(
      'https://api.meshy.ai/openapi/creative-lab/keychain/v1/prototype',
      { headers, params: { page_size: 10 } }
    )
    console.log(data)
  } catch (error) {
    console.error(error)
  }
  ```

  ```python
  import requests

  headers = {
      "Authorization": f"Bearer {YOUR_API_KEY}"
  }

  response = requests.get(
      "https://api.meshy.ai/openapi/creative-lab/keychain/v1/prototype",
      headers=headers,
      params={"page_size": 10},
  )
  response.raise_for_status()
  print(response.json())
  ```

**Response (List Prototype Tasks)**

```json
[
  {
    "id": "018a210d-8ba4-705c-b111-1f1776f7f578",
    "type": "creative-lab-keychain-prototype",
    "name": "",
    "status": "SUCCEEDED",
    "progress": 100,
    "created_at": 1729123456000,
    "started_at": 1729123460000,
    "finished_at": 1729123486000,
    "expires_at": 1729382686000,
    "preceding_tasks": 0,
    "task_error": null,
    "consumed_credits": 6,
    "image_urls": [
      "https://assets.meshy.ai/***/concept.png?Expires=***"
    ]
  }
]
```

---

## The Keychain prototype task object
A prototype task generates a colorized concept image from a photo. To turn the image into a 3D model, pass the task's ID to the [build endpoint](#create-a-keychain-build-task) as `input_task_id`.

### Properties

- `id` · *string*

  The task ID. Don't rely on its format.

- `type` · *string*

  The task type, always `creative-lab-keychain-prototype`.

- `name` · *string*

  The `name` you sent when you created the task, or `""` if you didn't send one.

- `name_text` · *string*

  The name Meshy added to the keychain, after trimming whitespace and removing invisible formatting characters. Left out when you didn't send `name_text`. To check that your HTTP client encoded the text correctly, compare it with what you sent.

- `status` · *string*

  The task's status.

  Available values:
  * `PENDING`: waiting in the queue
  * `IN_PROGRESS`: generating the result
  * `SUCCEEDED`: final, with the result
  * `FAILED`: final, with the reason in `task_error`
  * `CANCELED`: final, with no result

- `progress` · *integer*

  Percentage of the work done, from `0` to `100`. It's `0` until the task starts and `100` when it succeeds.

- `created_at` · *timestamp*

  Time the task was created, in Unix milliseconds.

- `started_at` · *timestamp*

  Time a worker started the task, in Unix milliseconds. `null` until then.

- `finished_at` · *timestamp*

  Time the task reached a final status, in Unix milliseconds. `null` until then.

- `expires_at` · *timestamp*

  Time the task's result expires, in Unix milliseconds. It's 3 days after `finished_at`, or 3 days after `created_at` until the task finishes. For Enterprise accounts, which keep API results indefinitely, it's about 100 years later. See [Asset retention](/api/asset-retention).

- `preceding_tasks` · *integer*

  The task's position in the queue while it's `PENDING`. `1` means it starts next. `0` after the task leaves the queue, and always `0` in list results.

- `task_error` · *object*

  Why the task failed. `null` unless `status` is `FAILED`. See [Errors](/api/errors#task-errors).

- `consumed_credits` · *integer*

  Number of credits charged for the task, after any refund. A request that returns an error isn't charged. A failed task is `0`, because Meshy refunds it. Canceling refunds a task only while it's `PENDING`. If Meshy can't read the charge, a get or stream response leaves the field out, and a list request returns `500`. In that case, retry the request.

- `image_urls` · *array of strings*

  Download URLs for the concept image. The array has one URL after the task succeeds, and is empty until then.

<span id="example-keychain-prototype-task-object" />

**Example Keychain Prototype Task Object**

```json
{
  "id": "018a210d-8ba4-705c-b111-1f1776f7f578",
  "type": "creative-lab-keychain-prototype",
  "name": "",
  "name_text": "Luna",
  "status": "SUCCEEDED",
  "progress": 100,
  "created_at": 1729123456000,
  "started_at": 1729123460000,
  "finished_at": 1729123486000,
  "expires_at": 1729382686000,
  "preceding_tasks": 0,
  "task_error": null,
  "consumed_credits": 6,
  "image_urls": [
    "https://assets.meshy.ai/***/concept.png?Expires=***"
  ]
}
```

---

## The Keychain build task object
A build task generates the 3D keychain from a succeeded prototype task. It returns one model file in the format you requested.

### Properties

- `id` · *string*

  The task ID. Don't rely on its format.

- `type` · *string*

  The task type, always `creative-lab-keychain-build`.

- `name` · *string*

  The `name` you sent when you created the task, or `""` if you didn't send one.

- `status` · *string*

  The task's status.

  Available values:
  * `PENDING`: waiting in the queue
  * `IN_PROGRESS`: generating the result
  * `SUCCEEDED`: final, with the result
  * `FAILED`: final, with the reason in `task_error`
  * `CANCELED`: final, with no result

- `progress` · *integer*

  Percentage of the work done, from `0` to `100`. It's `0` until the task starts and `100` when it succeeds.

- `created_at` · *timestamp*

  Time the task was created, in Unix milliseconds.

- `started_at` · *timestamp*

  Time a worker started the task, in Unix milliseconds. `null` until then.

- `finished_at` · *timestamp*

  Time the task reached a final status, in Unix milliseconds. `null` until then.

- `expires_at` · *timestamp*

  Time the task's result expires, in Unix milliseconds. It's 3 days after `finished_at`, or 3 days after `created_at` until the task finishes. For Enterprise accounts, which keep API results indefinitely, it's about 100 years later. See [Asset retention](/api/asset-retention).

- `preceding_tasks` · *integer*

  The task's position in the queue while it's `PENDING`. `1` means it starts next. `0` after the task leaves the queue, and always `0` in list results.

- `task_error` · *object*

  Why the task failed. `null` unless `status` is `FAILED`. See [Errors](/api/errors#task-errors).

- `consumed_credits` · *integer*

  Number of credits charged for the task, after any refund. A request that returns an error isn't charged. A failed task is `0`, because Meshy refunds it. Canceling refunds a task only while it's `PENDING`. If Meshy can't read the charge, a get or stream response leaves the field out, and a list request returns `500`. In that case, retry the request.

- `model_urls` · *object*

  Download URLs for the model file, with one entry for the `output.format` you requested. `{}` until the task succeeds.

  - `glb` · *string*

  Download URL for the GLB file. Present when `output.format` is `glb`.

  - `obj` · *string*

  Download URL for a zip file with `model.obj`, `model.mtl`, and `texture.png`. Present when `output.format` is `obj`.

  - `bundle_zip` · *string*

  Download URL for a zip file with every file Meshy generates. Present when `output.format` is `zip`.

<span id="example-keychain-build-task-object" />

**Example Keychain Build Task Object**

```json
{
  "id": "019c320e-9a8f-7a1c-9c11-2a1876f8a9bb",
  "type": "creative-lab-keychain-build",
  "name": "",
  "status": "SUCCEEDED",
  "progress": 100,
  "created_at": 1729123500000,
  "started_at": 1729123510000,
  "finished_at": 1729123535000,
  "expires_at": 1729382735000,
  "preceding_tasks": 0,
  "task_error": null,
  "consumed_credits": 30,
  "model_urls": {
    "glb": "https://assets.meshy.ai/***/tasks/019c320e-9a8f-7a1c-9c11-2a1876f8a9bb/output/model.glb?Expires=***"
  }
}
```
