> **Reading as an AI agent?** This is the Markdown version of https://docs.meshy.ai/api/v2/remesh, 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

---

# Remesh API

Rebuild a model's mesh with a new topology and face count, in the formats you choose. The remeshed model keeps its size. To change the size, see [Resize the result](#resize-the-result).

> **Note:** Moving from v1? The main changes for Remesh:
>   * `target_formats` works as on v1. STL and 3MF files follow the v2 [model size](/api/migrate-to-v2/reference#model-size) rules, and a `model_url` upload keeps its size.
>   * A request with any of these parameters returns `400`, even if the value is `null` or `false`:
>     * `resize_height`
>     * `resize_longest_side`
>     * `origin_at`
>     * `auto_size`
>     * `convert_format_only`
>   * To change the size or move the origin, run [Resize](https://docs.meshy.ai/api/v2/resize.md) on the Remesh task. Instead of `convert_format_only`, run one [Convert](https://docs.meshy.ai/api/v2/convert.md) task.
>   * Results are in `output`.
>
>   See [what changed for Remesh](/api/migrate-to-v2/reference#remesh).

---

## POST /openapi/v2/remesh -- Create a Remesh task

Creates a Remesh 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).

### Parameters

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

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

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

  Required unless you send `input_task_id`. The model to remesh, as a public URL or a data URI. Sending both `input_task_id` and `model_url` returns `400`.

  The model must be a GLB, glTF, OBJ, FBX, or STL file of at most 400 MB from a URL, or 100 MB as a data URI. A data URI must hold a GLB or glTF file (`data:model/gltf-binary;base64,...`). A larger file returns `400`.

  A file over 100 MB must also follow these rules, or the request returns `400`:
  * A GLB, glTF, FBX, or OBJ file can have at most 10,000,000 faces. Meshy counts faces as triangles, so a quad counts as 2, and a mesh drawn more than once counts once per copy.
  * An FBX file must be binary FBX 7.1 or newer.
  * A GLB or glTF file must not use Draco compression.

  The remeshed model keeps the file's size. Meshy returns it as one centered mesh, without rigs, animations, or morph targets, so the model doesn't keep its position. See [Model size](/api/migrate-to-v2/reference#model-size).

  - `topology` · *string* · default: `triangle`

  The face type of the remeshed model, `triangle` or `quad`. GLB files store only triangles, so Meshy splits each quad into two triangles in the GLB file. To keep the quads, add `obj` or `fbx` to `target_formats`.

  - `target_polycount` · *integer* · default: `30000`

  The number of faces to aim for, from `100` to `300000`. A value outside the range returns `400`.

  - `decimation_mode` · *integer*

  Adaptive face count, by level. The face count follows the model's surface area. When you set it, Meshy ignores `target_polycount`.

  Available values:
  * `1`: ultra
  * `2`: high
  * `3`: medium
  * `4`: low

  - `target_formats` · *string[]* · default: `["glb"]`

  The file formats to generate. Meshy generates only the formats you list. Sending `null` or `[]` is the same as leaving it out.

  Available values:
  * `glb`
  * `obj`
  * `fbx`
  * `stl`
  * `usdz`
  * `blend`
  * `3mf`

  A `quad` mesh keeps its quads in OBJ and FBX files.

  For a model Meshy generated, Meshy scales STL and 3MF files down to at most 150 mm on the longest side. Uploaded models, and models you resized with [Resize](https://docs.meshy.ai/api/v2/resize.md), keep their own size. See [Model size](/api/migrate-to-v2/reference#model-size).

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

  The width and height, in pixels, of the task's preview images: `512` or `1024`. It applies to `output.thumbnail_url` and to any optional preview you request. Any other value returns `400`.

### 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
  * The model 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>`)
  * An FBX file over 100 MB is ASCII (`ASCII FBX files over 100 MB are not supported; use binary FBX or GLB`)
  * A file over 100 MB has a header that can't be read, such as a Draco-compressed GLB or glTF, or a binary FBX older than 7.1 (`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`)
  * `target_polycount` is outside `100` to `300000`
  * `target_formats` has an unsupported format
  * The request has one of the v1 resize or format parameters listed in the note at the top of this page, even as `null` or `false`. The code is `parameter_unknown` and the message is `Unknown parameter "<parameter>": it is a v1 parameter. Use /openapi/v2/convert or /openapi/v2/resize instead.`

  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 remesh. 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
# Remesh a model file to about 10,000 quad faces, as OBJ and FBX files
curl https://api.meshy.ai/openapi/v2/remesh \
  -X POST \
  -H "Authorization: Bearer ${MESHY_API_KEY}" \
  -H 'Content-Type: application/json' \
  -d '{
    "model_url": "https://cdn.meshy.ai/model/example_model_2.glb",
    "topology": "quad",
    "target_polycount": 10000,
    "target_formats": ["obj", "fbx"]
  }'

# Remesh a Meshy task with an adaptive face count
curl https://api.meshy.ai/openapi/v2/remesh \
  -X POST \
  -H "Authorization: Bearer ${MESHY_API_KEY}" \
  -H 'Content-Type: application/json' \
  -d '{
    "input_task_id": "018a210d-8ba4-705c-b111-1f1776f7f578",
    "decimation_mode": 3
  }'
```

```javascript
// Remesh a model file to about 10,000 quad faces, as OBJ and FBX files
const response = await fetch("https://api.meshy.ai/openapi/v2/remesh", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.MESHY_API_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    model_url: "https://cdn.meshy.ai/model/example_model_2.glb",
    topology: "quad",
    target_polycount: 10000,
    target_formats: ["obj", "fbx"],
  }),
});
const task = await response.json();
console.log(task.id, task.status);
```

```python
import os
import requests

# Remesh a model file to about 10,000 quad faces, as OBJ and FBX files
response = requests.post(
    "https://api.meshy.ai/openapi/v2/remesh",
    headers={"Authorization": f"Bearer {os.environ['MESHY_API_KEY']}"},
    json={
        "model_url": "https://cdn.meshy.ai/model/example_model_2.glb",
        "topology": "quad",
        "target_polycount": 10000,
        "target_formats": ["obj", "fbx"],
    },
)
response.raise_for_status()
task = response.json()
print(task["id"], task["status"])
```

**Response**

```json
{
  "id": "018a210d-8ba4-705c-b111-1f1776f7f578",
  "type": "remesh",
  "status": "PENDING",
  "progress": 0,
  "created_at": 1790640079880,
  "started_at": null,
  "finished_at": null,
  "expires_at": null,
  "preceding_tasks": 3,
  "consumed_credits": 5,
  "task_error": null,
  "input": {
    "model_url": "https://cdn.meshy.ai/model/example_model_2.glb",
    "topology": "quad",
    "target_polycount": 10000,
    "target_formats": ["obj", "fbx"]
  },
  "output": null
}
```

---

## Resize the result

To change the size of a remeshed model, run a [Resize](https://docs.meshy.ai/api/v2/resize.md) task on the Remesh task. Resize returns a GLB file. For other formats, run a [Convert](https://docs.meshy.ai/api/v2/convert.md) task on the Resize task.

Pass each task's `id` as the next task's `input_task_id`. Wait until a task's status is `SUCCEEDED` before you create the next one.

The chain keeps what the Remesh task made. After a `quad` remesh, the OBJ, FBX, and Blend files from Convert keep the quads at the new size. A textured OBJ file comes with its `.mtl` file, and each task's `texture_urls` lists the texture maps.

Resize and Convert tasks have no preview image. Read the preview from the Remesh task's `output`.

For the size of STL and 3MF files after a resize, see [Convert the result](https://docs.meshy.ai/api/v2/resize.md#convert-the-result) on the Resize page.

Meshy charges each task separately. See [Pricing](/api/pricing).

**cURL**

```bash
# 1. Remesh to about 10,000 triangle faces
curl https://api.meshy.ai/openapi/v2/remesh \
  -X POST \
  -H "Authorization: Bearer ${MESHY_API_KEY}" \
  -H 'Content-Type: application/json' \
  -d '{
    "model_url": "https://cdn.meshy.ai/model/example_model_2.glb",
    "topology": "triangle",
    "target_polycount": 10000
  }'

# 2. When the Remesh task succeeds, resize it to 1.8 m tall
curl https://api.meshy.ai/openapi/v2/resize \
  -X POST \
  -H "Authorization: Bearer ${MESHY_API_KEY}" \
  -H 'Content-Type: application/json' \
  -d '{
    "input_task_id": "<Remesh task ID>",
    "resize_height": 1.8
  }'

# 3. When the Resize task succeeds, convert it to FBX and USDZ
curl https://api.meshy.ai/openapi/v2/convert \
  -X POST \
  -H "Authorization: Bearer ${MESHY_API_KEY}" \
  -H 'Content-Type: application/json' \
  -d '{
    "input_task_id": "<Resize task ID>",
    "target_formats": ["fbx", "usdz"]
  }'
```

```javascript
const API = "https://api.meshy.ai/openapi/v2";
const headers = {
  Authorization: `Bearer ${process.env.MESHY_API_KEY}`,
  "Content-Type": "application/json",
};

async function create(path, body) {
  const response = await fetch(`${API}/${path}`, {
    method: "POST",
    headers,
    body: JSON.stringify(body),
  });
  if (!response.ok) throw new Error(await response.text());
  return (await response.json()).id;
}

async function wait(id) {
  for (;;) {
    const response = await fetch(`${API}/tasks/${id}`, { headers });
    if (!response.ok) throw new Error(await response.text());
    const task = await response.json();
    if (task.status === "SUCCEEDED") return task;
    if (task.status === "FAILED" || task.status === "CANCELED") {
      throw new Error(JSON.stringify(task.task_error));
    }
    const seconds = Number(response.headers.get("Retry-After") ?? 5);
    await new Promise((resolve) => setTimeout(resolve, seconds * 1000));
  }
}

// 1. Remesh, 2. Resize to 1.8 m tall, 3. Convert to FBX and USDZ
const remesh = await wait(await create("remesh", {
  model_url: "https://cdn.meshy.ai/model/example_model_2.glb",
  topology: "triangle",
  target_polycount: 10000,
}));
const resize = await wait(await create("resize", {
  input_task_id: remesh.id,
  resize_height: 1.8,
}));
const convert = await wait(await create("convert", {
  input_task_id: resize.id,
  target_formats: ["fbx", "usdz"],
}));

console.log(convert.output.model_urls);
console.log(remesh.output.texture_urls);
```

```python
import os
import time
import requests

API = "https://api.meshy.ai/openapi/v2"
HEADERS = {"Authorization": f"Bearer {os.environ['MESHY_API_KEY']}"}

def create(path, body):
    response = requests.post(f"{API}/{path}", headers=HEADERS, json=body)
    response.raise_for_status()
    return response.json()["id"]

def wait(task_id):
    while True:
        response = requests.get(f"{API}/tasks/{task_id}", headers=HEADERS)
        response.raise_for_status()
        task = response.json()
        if task["status"] == "SUCCEEDED":
            return task
        if task["status"] in ("FAILED", "CANCELED"):
            raise RuntimeError(task["task_error"])
        time.sleep(int(response.headers.get("Retry-After", 5)))

# 1. Remesh, 2. Resize to 1.8 m tall, 3. Convert to FBX and USDZ
remesh = wait(create("remesh", {
    "model_url": "https://cdn.meshy.ai/model/example_model_2.glb",
    "topology": "triangle",
    "target_polycount": 10000,
}))
resize = wait(create("resize", {"input_task_id": remesh["id"], "resize_height": 1.8}))
convert = wait(create("convert", {"input_task_id": resize["id"], "target_formats": ["fbx", "usdz"]}))

print(convert["output"]["model_urls"])
print(remesh["output"]["texture_urls"])
```

---

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

| 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=remesh`](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) |

---

## Remesh 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 URLs to the remeshed files, one per format in `target_formats`, keyed by format. If you left out `target_formats`, the only key is `glb`. An `obj` with a base color texture also gets an `mtl` key, with the URL of its material file.

  - `thumbnail_url` · *string*

  Signed URL to a PNG preview of the remeshed model, with a transparent background.

  - `texture_urls` · *array*

  The model's texture maps after the remesh, one item per texture set, with a signed URL for each of these maps:
  * `base_color`
  * `metallic`
  * `roughness`
  * `normal`
  * `metallic_roughness`
  * `emission`

  A map that wasn't produced is `null`. The array is empty when the input model has no textures.

**Succeeded Remesh task**

```json
{
  "id": "018a210d-8ba4-705c-b111-1f1776f7f578",
  "type": "remesh",
  "status": "SUCCEEDED",
  "progress": 100,
  "created_at": 1790640079880,
  "started_at": 1790640079885,
  "finished_at": 1790640120427,
  "expires_at": 1790899320427,
  "preceding_tasks": 0,
  "consumed_credits": 5,
  "task_error": null,
  "input": {
    "model_url": "https://cdn.meshy.ai/model/example_model_2.glb",
    "topology": "quad",
    "target_polycount": 10000,
    "target_formats": ["obj", "fbx"]
  },
  "output": {
    "model_urls": {
      "fbx": "https://assets.meshy.ai/***/output/model.fbx?Expires=***",
      "obj": "https://assets.meshy.ai/***/output/model.obj?Expires=***",
      "mtl": "https://assets.meshy.ai/***/output/model.mtl?Expires=***"
    },
    "thumbnail_url": "https://assets.meshy.ai/***/output/preview.png?Expires=***",
    "texture_urls": [
      {
        "base_color": "https://assets.meshy.ai/***/output/texture_0.png?Expires=***",
        "metallic": "https://assets.meshy.ai/***/output/texture_0_metallic.png?Expires=***",
        "roughness": "https://assets.meshy.ai/***/output/texture_0_roughness.png?Expires=***",
        "normal": null,
        "metallic_roughness": "https://assets.meshy.ai/***/output/texture_0_metallic_roughness.png?Expires=***",
        "emission": null
      }
    ]
  }
}
```
