> **Reading as an AI agent?** This is the Markdown version of https://docs.meshy.ai/api/v2/uv-unwrap, part of the Meshy API v2 docs.
>
> - v2 docs index: https://docs.meshy.ai/api/v2/llms.txt
> - All v2 pages in one file: https://docs.meshy.ai/api/v2/llms-full.txt
> - OpenAPI spec for v2: https://docs.meshy.ai/api/v2/openapi.yaml

---

# UV Unwrap API

Generate a fresh UV layout for a 3D model, ready to texture.

> **Note:** Moving from v1? The request is the same, and results are in `output`. See [what changed for UV Unwrap](/api/migrate-to-v2/reference#other-endpoints).

---

## POST /openapi/v2/uv-unwrap -- Create a UV Unwrap task

Creates a UV Unwrap task and returns the [task object](https://docs.meshy.ai/api/v2/tasks.md#the-task-object). The task runs in the background. To read its result, see [Get the result](#get-the-result). For how long a task usually takes, see [Processing times](/api/task-lifecycle#processing-times).

UV Unwrap works on meshes up to a maximum face count. A mesh with more faces returns `400`, and the message gives the limit. If Meshy can't check the face count before the task starts, the task fails instead. To lower the face count, run [Remesh](https://docs.meshy.ai/api/v2/remesh.md) first.

### Parameters

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

  Required unless you send `model_url`. The ID of a task that produced a 3D model to unwrap, for example a Text to 3D, Image to 3D, or Remesh task. The task must be one you created with the API and have the status `SUCCEEDED`. UV Unwrap reads the task's GLB.

  - `model_url` · *string* · **required**

  Required unless you send `input_task_id`. The model to unwrap, as a public URL or a data URI (`data:model/gltf-binary;base64,...`). Sending both `input_task_id` and `model_url` returns `400`.

  The model must be a GLB file of at most 400 MB from a URL, or 100 MB as a data URI. A GLB over 100 MB must not use Draco compression. Another format, or a larger file, returns `400`.

  To unwrap another format, run [Convert](https://docs.meshy.ai/api/v2/convert.md) to GLB first, and send that task's `id` as `input_task_id`.

### Returns

`202 Accepted` with the [task object](https://docs.meshy.ai/api/v2/tasks.md#the-task-object). The task starts as `PENDING`, with your request in `input` and `output` set to `null`.

Two response headers help you read the task:
* `Location`: the task's URL on [Tasks](https://docs.meshy.ai/api/v2/tasks.md#how-a-task-runs)
* `Retry-After`: how many seconds to wait before you first read it

### Failure modes

  - `400 - Bad Request`

  The request can't run. For example:
  * Neither `input_task_id` nor `model_url` was sent
  * Both `input_task_id` and `model_url` were sent
  * The input task hasn't succeeded
  * `model_url` isn't a GLB file
  * The file can't be downloaded or is too large
  * A file over 100 MB has too many faces (`model has too many faces: <N> faces, the limit for files over 100 MB is <limit>`)
  * A file over 100 MB has a header that can't be read, for example a Draco-compressed GLB (`invalid model file content`)
  * A file over 100 MB has a header too complex to check (`model header is too complex to check for files over 100 MB`)
  * The mesh has more faces than UV Unwrap allows. The message is `The input mesh has <N> faces, exceeding the UV Unwrap maximum of <limit>. Run remesh first.`

  The error message says which problem it found. See [Errors](https://docs.meshy.ai/api/v2/errors.md#request-errors).

  - `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 account reached a credit limit.
  * The account is on the free plan.

  Check your credits and plan, then retry.

  - `403 - Forbidden`

  `input_task_id` is a bas-relief model, which this endpoint can't unwrap. The message is `This model type does not support this operation`. Send a different model.

  - `404 - Not Found`

  `input_task_id` doesn't match any of your tasks.

  - `429 - Too Many Requests`

  One of these limits was reached:
  * You sent too many requests. Wait the number of seconds in `Retry-After`, then retry.
  * 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
# Unwrap a Meshy task, such as a Remesh result
curl https://api.meshy.ai/openapi/v2/uv-unwrap \
  -X POST \
  -H "Authorization: Bearer ${MESHY_API_KEY}" \
  -H 'Content-Type: application/json' \
  -d '{
    "input_task_id": "018a210d-8ba4-705c-b111-1f1776f7f578"
  }'
```

```javascript
// Unwrap a Meshy task, such as a Remesh result
const response = await fetch("https://api.meshy.ai/openapi/v2/uv-unwrap", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.MESHY_API_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    input_task_id: "018a210d-8ba4-705c-b111-1f1776f7f578",
  }),
});
const task = await response.json();
console.log(task.id, task.status);
```

```python
import os
import requests

# Unwrap a Meshy task, such as a Remesh result
response = requests.post(
    "https://api.meshy.ai/openapi/v2/uv-unwrap",
    headers={"Authorization": f"Bearer {os.environ['MESHY_API_KEY']}"},
    json={"input_task_id": "018a210d-8ba4-705c-b111-1f1776f7f578"},
)
response.raise_for_status()
task = response.json()
print(task["id"], task["status"])
```

**Response**

```json
{
  "id": "0199a8f6-3d27-7c2e-9b41-6e0c5d2f8a13",
  "type": "uv-unwrap",
  "status": "PENDING",
  "progress": 0,
  "created_at": 1790640079880,
  "started_at": null,
  "finished_at": null,
  "expires_at": null,
  "preceding_tasks": 1,
  "consumed_credits": 5,
  "task_error": null,
  "input": {
    "input_task_id": "018a210d-8ba4-705c-b111-1f1776f7f578"
  },
  "output": null
}
```

---

## Get the result
Read UV Unwrap tasks the same way as every other v2 task, through the [Tasks](https://docs.meshy.ai/api/v2/tasks.md) routes. To list only UV Unwrap tasks, filter by `type=uv-unwrap`.

| To | Call |
| --- | --- |
| Get one task | [`GET /openapi/v2/tasks/{id}`](https://docs.meshy.ai/api/v2/tasks.md#get-a-task) |
| Wait for updates | [`GET /openapi/v2/tasks/{id}/stream`](https://docs.meshy.ai/api/v2/tasks.md#stream-a-task) or a [webhook](https://docs.meshy.ai/api/v2/webhooks.md) |
| List your tasks | [`GET /openapi/v2/tasks?type=uv-unwrap`](https://docs.meshy.ai/api/v2/tasks.md#list-tasks) |
| Delete a task | [`DELETE /openapi/v2/tasks/{id}`](https://docs.meshy.ai/api/v2/tasks.md#delete-a-task) |

---

## UV Unwrap output
When the task succeeds, `output` holds these fields. The rest of the [task object](https://docs.meshy.ai/api/v2/tasks.md#the-task-object) is the same for every task type. The URLs in `output` stop working at `expires_at`.

  - `model_urls` · *object*

  Signed URL to the unwrapped model, under the `glb` key.

  - `thumbnail_url` · *string*

  Signed URL to a preview image of the unwrapped model.

UV Unwrap output has no `texture_urls`.

The unwrapped model has no textures. To texture it, run [Retexture](https://docs.meshy.ai/api/v2/retexture.md) with the UV Unwrap task's `id` as `input_task_id`.

**Succeeded UV Unwrap task**

```json
{
  "id": "0199a8f6-3d27-7c2e-9b41-6e0c5d2f8a13",
  "type": "uv-unwrap",
  "status": "SUCCEEDED",
  "progress": 100,
  "created_at": 1790640079880,
  "started_at": 1790640079886,
  "finished_at": 1790640131664,
  "expires_at": 1790899331664,
  "preceding_tasks": 0,
  "consumed_credits": 5,
  "task_error": null,
  "input": {
    "input_task_id": "018a210d-8ba4-705c-b111-1f1776f7f578"
  },
  "output": {
    "model_urls": {
      "glb": "https://assets.meshy.ai/***/output/model.glb?Expires=***"
    },
    "thumbnail_url": "https://assets.meshy.ai/***/output/preview.png?Expires=***"
  }
}
```
