> **API v1 is deprecated and stops working on March 15, 2027.** For new integrations, use API v2.
>
> - This page on v2: https://docs.meshy.ai/api/v2/model-edit.md
> - Migrate to API v2: https://docs.meshy.ai/api/migrate-to-v2

> **Reading as an AI agent?** This is the Markdown version of https://docs.meshy.ai/api/model-edit.
>
> - 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
> - Command-line access via the Meshy CLI: https://docs.meshy.ai/api/cli

---
# Model Edit API

Change the shape of a 3D model by describing the change in a sentence. Edit the whole model, or select the faces around which the change happens.

Model Edit regenerates the model's geometry and returns an untextured GLB file with a preview image. To texture the edited model, send its task ID to the [Retexture API](/api/retexture).

---

## POST /openapi/v1/model-edit -- Create a Model Edit task

Creates a Model Edit task, which reshapes a model as `prompt` describes. With `selection_face_indices`, the change stays around the faces you select. Without it, any part of the model can change.

Meshy checks the model while it handles your request, so a model it can't edit returns `400` before Meshy creates a task. The task then runs in the background, as described in [Task lifecycle](/api/task-lifecycle#how-a-task-runs).

The model must meet all of these requirements:
* **Source**: a task listed under `input_task_id`, or a GLB file you send as `model_url`
* **Texture**: none. A textured model returns `400`.
* **Size**: at most 4,000,000 faces and 4,000,000 vertices, and at most 134,217,728 bytes (128 MiB) of geometry, counted as 12 bytes per vertex plus 24 bytes per face. A `model_url` file over 4,000,000 faces returns `400`. An `input_task_id` model over the other two limits returns `400`. A `model_url` file over them, or an input task whose size Meshy has no record of, fails the task with the message `The source model is too large to edit`, and Meshy refunds its credits.
* **Watertight**: a `model_url` file, or the result of a Repair Printability task, must be a closed surface with no holes. A `model_url` file that isn't returns `400`. To fix it, run [Repair Printability](/api/repair-printability) on it, then send that task's `id` as `input_task_id`. A Repair Printability task whose model still has holes returns `400`, and Meshy can't edit that model. A model whose shape Meshy can't measure also returns `400`.

A task costs 20 credits. Meshy charges them when it creates the task, and refunds them if the task fails. See [Pricing](/api/pricing).

### Parameters

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

  Required unless you send `model_url`. The ID of a task whose GLB to edit. The task must be one you created with the API and have the status `SUCCEEDED`. It must be one of these:
  * A Text to 3D preview task, or an Image to 3D or Multi-Image to 3D task with `should_texture: false`, made with `meshy-6` or a Meshy 7 model, such as `meshy-7.1` or `latest`
  * A Remesh task made with `input_task_id` from a task in the first item, if it has no texture
  * A Repair Printability task
  * An earlier Model Edit task

  Meshy 6 Lite, Smart Topology (`meshy-t2` and `meshy-t2.5`), and `geometry_resolution: "4k"` models return `400`. A task of another kind, such as Retexture, returns `400` too, except a Relief task, which returns `403`.

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

  Required unless you send `input_task_id`. The model to edit, 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 an `http` or `https` URL whose path ends in `.glb`, or 100 MB as a data URI. It must not use Draco compression. To edit another format, run [Convert](/api/convert) to GLB first, download the GLB, and send it as `model_url`.

  - `prompt` · *string* · **required**

  The change to make, in one sentence, up to 600 characters. Describe a change of shape, such as adding, removing, enlarging, or reshaping a part, for example `Give the dog a pair of boots`. Longer text returns `400`.

  To change color or material, use [Retexture](/api/retexture).

  - `selection_face_indices` · *integer[]*

  The faces around which to make the change, as indices of the model's triangles. For how Meshy numbers the faces, see [Select faces](#select-faces). Leave it out to let any part of the model change.

  Send 1 to 500,000 indices, each from `0` to the model's face count minus 1. Order and repeats don't matter. An empty array, an index past the last face, or a selection too small to change returns `400`.

  - `reference_image_urls` · *string[]*

  Up to 5 images that show what the change should look like, each as a public URL or a data URI (`data:image/png;base64,...`). Each image must be a PNG, JPEG, or WebP file of at most 20 MB. More than 5 images returns `400`.

### Returns

`202 Accepted`. The `result` field of the response holds the ID of the new Model Edit task.

### Failure modes

  - `400 - Bad Request`

  The request can't run. For example:
  * **Missing input**: Neither `input_task_id` nor `model_url` was sent, or `prompt` is only spaces.
  * **Invalid parameters**: A value breaks a field rule. `prompt` is missing or longer than 600 characters, `selection_face_indices` has a negative index or more than 500,000 indices, or there are more than 5 `reference_image_urls`. The message lists these rules: `Invalid parameters: send a prompt of 1 to 600 characters, at most 500000 selection_face_indices of 0 or more, and at most 5 reference_image_urls`. The v2 endpoint names each problem instead. See [Model Edit API (v2)](/api/v2/model-edit#create-a-model-edit-task).
  * **Conflicting inputs**: Both `input_task_id` and `model_url` were sent. The message is `Provide either input_task_id or model_url, not both`.
  * **Empty selection**: `selection_face_indices` is an empty array. Leave it out to edit the whole model.
  * **Face out of range**: An index in `selection_face_indices` isn't a face of the model. For example, the message is `selection_face_indices: face 5000 is out of range: the model has 3322 faces`. Number the faces as [Select faces](#select-faces) describes.
  * **Selection too small**: The selected faces cover no part of the model that Meshy can change. Select a larger area.
  * **Not watertight**: The `model_url` file has holes. The message is `model_url: the model is not watertight; repair it with POST /openapi/v1/print/repair first`. Run [Repair Printability](/api/repair-printability) on it, then send that task's `id` as `input_task_id`.
  * **Still not watertight after repair**: The `input_task_id` Repair Printability task's model still has holes. The message is `input_task_id: the repaired model is still not watertight, so it cannot be edited`.
  * **Can't measure the model**: Meshy can't measure the model's shape. For example, the message is `model_url: the model could not be measured, so it cannot be edited`.
  * **Textured model**: The model has a texture. The message is `Model editing requires an untextured model`.
  * **Too many faces**: The model has more than 4,000,000 faces.
  * **Model too large**: The `input_task_id` model is over the vertex or size limit. The message is `The source model is too large to edit`.
  * **Unreadable model**: Meshy can't read the GLB file, for example because it uses Draco compression.
  * **Unsupported input task**: The `input_task_id` task isn't one this endpoint edits, or hasn't succeeded. For example, the message is `Model editing does not support Meshy 6 Lite models`.
  * **Input task files removed**: Meshy deleted the `input_task_id` task's files after its `expires_at`. The message is `Missing model file`. Create the input task again.
  * **Unreachable URL**: Meshy can't download the `model_url` file or a `reference_image_urls` image.
  * **Model file too large**: The `model_url` file is over 400 MB from an `http` or `https` URL, or over 100 MB as a data URI.
  * **Unusable image**: A `reference_image_urls` image is larger than 20 MB, or Meshy can't read it.

  Fix the request, then send it again. See [Errors](/api/errors#request-errors).

  - `401 - Unauthorized`

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

  - `402 - Payment Required`

  For example:
  * **Insufficient credits**: The account doesn't have enough credits for this task, or the account reached a credit limit. Check your credit balance, then retry.
  * **Free plan**: Creating a task requires a paid plan. Upgrade your plan in your [subscription settings](https://www.meshy.ai/settings/subscription), then retry.

  - `403 - Forbidden`

  One of these applies:
  * Content moderation blocked the prompt or a reference image. Change the input, then retry.
  * `input_task_id` is a bas-relief model, which this endpoint can't edit. 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. Check the task ID, then send the request again.

  - `429 - Too Many Requests`

  For example:
  * **Selection processing is busy**: Meshy is converting too many selections. The message is `Selection processing is busy; try again shortly`. Wait a few seconds, then retry.
  * **Rate limit**: You exceeded your rate limit, or you have too many pending tasks. Wait, then retry. See [Rate limits](/api/rate-limits).

  - `503 - Service Unavailable`

  Meshy couldn't check whether the model is watertight. The message is `Could not check whether the model is watertight; try again shortly`. Wait a few seconds, then retry.

Meshy charges nothing for a request that returns an error. A task that Meshy created can still fail. For the reasons, see `task_error` in the [Model Edit task object](#the-model-edit-task-object).

**cURL**

```bash
# Edit the faces you selected on a Meshy task's model
curl https://api.meshy.ai/openapi/v1/model-edit \
  -X POST \
  -H "Authorization: Bearer ${YOUR_API_KEY}" \
  -H 'Content-Type: application/json' \
  -d '{
    "input_task_id": "0193bfc5-ee4f-73f8-8525-44b398884ce9",
    "prompt": "Add a short horn to the top of the head",
    "selection_face_indices": [1204, 1205, 1206, 1311, 1312]
  }'

# Edit the whole model from a public GLB URL, with a reference image
curl https://api.meshy.ai/openapi/v1/model-edit \
  -X POST \
  -H "Authorization: Bearer ${YOUR_API_KEY}" \
  -H 'Content-Type: application/json' \
  -d '{
    "model_url": "https://example.com/models/dog.glb",
    "prompt": "Give the dog a pair of boots",
    "reference_image_urls": ["https://example.com/images/boots.png"]
  }'
```

```javascript
import axios from 'axios'

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

// Edit the faces you selected on a Meshy task's model
const payload = {
  input_task_id: "0193bfc5-ee4f-73f8-8525-44b398884ce9",
  prompt: "Add a short horn to the top of the head",
  selection_face_indices: [1204, 1205, 1206, 1311, 1312]
};

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

```python
import requests

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

# Edit the faces you selected on a Meshy task's model
payload = {
    "input_task_id": "0193bfc5-ee4f-73f8-8525-44b398884ce9",
    "prompt": "Add a short horn to the top of the head",
    "selection_face_indices": [1204, 1205, 1206, 1311, 1312],
}

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

**Response**

```json
{
  "result": "019ad9e2-5b7c-7a41-9c3e-2f8d6b1a4e07"
}
```

---

## Select faces

`selection_face_indices` names faces by their index among the triangles of the GLB file that the task edits. That file is the `input_task_id` task's `model_urls.glb`, or your `model_url` file.

A model that Meshy generates is a single mesh, so face `i` is the triangle that indices `3i`, `3i + 1`, and `3i + 2` of its index buffer make.

### Get the indices from a 3D tool

A tool gives the same indices as Meshy when it keeps the file's triangle order. The following tools keep it for a single-mesh model:

* trimesh: load the file with `process=False`.
* Blender: import the file with the default glTF import settings.
* three.js: read `faceIndex` from a raycast hit on a model that `GLTFLoader` loads.

Any other tool that keeps the order gives the same indices. A step that changes the triangles renumbers the faces, for example merging triangles into quads, a game engine's mesh optimization, or exporting the file again.

### Files with more than one mesh

For a file with more than one mesh or primitive, Meshy numbers the triangles in this order:

1. The nodes of the file's default scene, depth first. Each node's own mesh comes before its children, and nodes come in the order the file lists them.
2. Within a mesh, each primitive whose mode is `TRIANGLES`, in order. Meshy doesn't number other primitives, such as triangle strips.
3. Within a primitive, its triangles in the order its index buffer stores them. A primitive without an index buffer makes a triangle of every three vertices, in order.

### How far an edit reaches

Meshy turns the selected faces into a grid of 16 × 16 × 16 cells over the model, the same way the model editor in the Meshy web app does. The edit works on those cells, so the change reaches about one sixteenth of the model's longest side around the faces you select, not only the faces themselves. Selecting one face selects its whole cell, so an edit can't target an area smaller than a cell. A selection that covers no cell returns `400`, so select a larger area.

Meshy regenerates the whole mesh, so the parts outside the selection aren't guaranteed to be identical to the input.

### Edit the result again

The edited model is a new mesh with new face indices. Before you edit it again, select the faces on the new model, then send the Model Edit task's `id` as `input_task_id`. An edit usually adds faces and vertices, so an edited model can be over the size limits even when its input wasn't.

You can also send the task's `id` as `input_task_id` to other endpoints, for example to texture the model with [Retexture](/api/retexture). An edited model usually has more triangles than [Rigging](/api/rigging) takes, so run [Remesh](/api/remesh) on it before you rig it.

**Select faces with trimesh**

```python
import numpy as np
import requests
import trimesh

# Load the GLB as one mesh, keeping the file's face order
mesh = trimesh.load("model.glb", force="mesh", process=False)

# Select the faces whose center is in the top fifth of the model
# (glTF models are Y-up)
centers = mesh.triangles_center
top = mesh.bounds[1][1] - 0.2 * mesh.extents[1]
selection = np.flatnonzero(centers[:, 1] > top).tolist()

# A request takes 1 to 500,000 indices
assert 1 <= len(selection) <= 500_000, len(selection)

response = requests.post(
    "https://api.meshy.ai/openapi/v1/model-edit",
    headers={"Authorization": f"Bearer {YOUR_API_KEY}"},
    json={
        "input_task_id": "0193bfc5-ee4f-73f8-8525-44b398884ce9",
        "prompt": "Add a short horn to the top of the head",
        "selection_face_indices": selection,
    },
)
response.raise_for_status()
print(response.json())
```

---

## GET /openapi/v1/model-edit/:id -- Get a Model Edit task

Returns a Model Edit task by its ID.

### Parameters

  - `id` · *path*

  The task ID from the create response.

### Returns

The [Model Edit task object](#the-model-edit-task-object).

**cURL**

```bash
curl https://api.meshy.ai/openapi/v1/model-edit/019ad9e2-5b7c-7a41-9c3e-2f8d6b1a4e07 \
  -H "Authorization: Bearer ${YOUR_API_KEY}"
```

```javascript
import axios from 'axios'

const taskId = '019ad9e2-5b7c-7a41-9c3e-2f8d6b1a4e07';
const headers = { Authorization: `Bearer ${YOUR_API_KEY}` };

try {
  const response = await axios.get(
    `https://api.meshy.ai/openapi/v1/model-edit/${taskId}`,
    { headers }
  );
  console.log(response.data);
} catch (error) {
  console.error(error);
}
```

```python
import requests

task_id = "019ad9e2-5b7c-7a41-9c3e-2f8d6b1a4e07"
headers = {
    "Authorization": f"Bearer {YOUR_API_KEY}"
}

response = requests.get(
    f"https://api.meshy.ai/openapi/v1/model-edit/{task_id}",
    headers=headers,
)
response.raise_for_status()
print(response.json())
```

For an example response, see the [example Model Edit task object](#example-model-edit-task-object).

---

## DELETE /openapi/v1/model-edit/:id -- Delete a Model Edit task

Permanently deletes a Model Edit task, including its edited model. You can't undo a delete.

### Task status
Deleting a `PENDING` task refunds the credits it used when you created it.

An `IN_PROGRESS` task can't be deleted. The request returns `409 Conflict`,
and the task keeps running. Meshy doesn't refund a task that has started,
so deleting it would cost you both the credits and the result. Wait for it
to reach `SUCCEEDED`, `FAILED`, or `CANCELED`, then delete it.

Deleting a task in a final status (`SUCCEEDED`, `FAILED`, or `CANCELED`)
doesn't refund its credits.

**cURL**

```bash
curl https://api.meshy.ai/openapi/v1/model-edit/019ad9e2-5b7c-7a41-9c3e-2f8d6b1a4e07 \
  -X DELETE \
  -H "Authorization: Bearer ${YOUR_API_KEY}"
```

---

## GET /openapi/v1/model-edit -- List Model Edit tasks

Returns a list of your Model Edit tasks, newest first unless you set `sort_by`.

### Parameters

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

  The page number to return, starting at `1`.

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

  The number of tasks per page, up to `100`.

  - `sort_by` · *string*

  The sort order.

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

### Returns

A list of [Model Edit task objects](#the-model-edit-task-object). An empty page is an empty array.

**cURL**

```bash
curl "https://api.meshy.ai/openapi/v1/model-edit?page_num=1&page_size=10" \
  -H "Authorization: Bearer ${YOUR_API_KEY}"
```

---

## GET /openapi/v1/model-edit/:id/stream -- Stream a Model Edit task

Streams a Model Edit task's updates as Server-Sent Events (SSE). To learn sooner that the task finished, use this endpoint instead of polling `GET /openapi/v1/model-edit/:id`.

### Parameters

  - `id` · *path*

  The task ID from the create response.

### Returns

A stream of [Model Edit task objects](#the-model-edit-task-object) as Server-Sent Events.

Each `message` event holds the full task object, in the same shape the Get endpoint returns. While the task is `PENDING` or `IN_PROGRESS`, its result fields don't have values yet. `model_urls` is empty, and `thumbnail_url` is `""`. To follow the task, watch `status` and `progress`.

The stream closes after the event of a task that reached `SUCCEEDED`, `FAILED`, or `CANCELED`. An `error` event ends the stream early, for example when the task isn't found.

**cURL**

```bash
curl https://api.meshy.ai/openapi/v1/model-edit/019ad9e2-5b7c-7a41-9c3e-2f8d6b1a4e07/stream \
  -H "Authorization: Bearer ${YOUR_API_KEY}" \
  -N
```

---

## The Model Edit task object
A Model Edit task object describes one edit of a 3D model. It holds the status, the progress, and the edited model when the task succeeds.

  - `id` · *string*

  The task ID. Treat it as an opaque string, and don't rely on its format.

  - `type` · *string*

  The task type, always `model-edit`.

  - `model_urls` · *object*

  Signed download URLs for the edited model. Model Edit always returns a single `glb` key. The model has no texture, and its faces are numbered anew.

  - `thumbnail_url` · *string*

  Signed download URL for a PNG preview image of the edited model.

  - `texture_urls` · *array*

  Always `null`. The edited model has no texture.

  - `progress` · *integer*

  How much of the task is done, as a percentage from `0` to `100`.

  - `status` · *string*

  The task status, one of `PENDING`, `IN_PROGRESS`, `SUCCEEDED`, `FAILED`, or `CANCELED`.

  - `preceding_tasks` · *integer*

  The number of tasks ahead of this one in the queue. The value is meaningful only while the task is `PENDING`. The field is left out when the value is `0`.

  - `created_at` · *timestamp*

  Time the task was created, in Unix milliseconds.

  - `started_at` · *timestamp*

  Time the task started, in Unix milliseconds. It's `0` until the task starts.

  - `finished_at` · *timestamp*

  Time the task finished, in Unix milliseconds. It's `0` until the task finishes.

  - `expires_at` · *timestamp*

  Time the signed download URLs expire, in Unix milliseconds. Meshy keeps the edited model for 3 days after the task finishes, so download it, or send the task to another endpoint, before then. See [Asset retention](/api/asset-retention).

  - `task_error` · *object*

  The error details when the task fails, and `null` otherwise. Two codes are specific to Model Edit:
  * [`model_edit_no_shape_edit`](/api/errors#model-edit-no-shape-edit): the prompt doesn't change the model's shape
  * [`model_edit_selection_failed`](/api/errors#model-edit-selection-failed): Meshy couldn't tell which part of the model to change

  See [Errors](/api/errors#task-errors).

  - `consumed_credits` · *integer*

  The number of credits the task used, 20 for a Model Edit task. It's `0` for a `FAILED` task, because Meshy refunds the credits when a task fails.

<span id="example-model-edit-task-object" />

**Example Model Edit Task Object**

```json
{
  "id": "019ad9e2-5b7c-7a41-9c3e-2f8d6b1a4e07",
  "type": "model-edit",
  "model_urls": {
    "glb": "https://assets.meshy.ai/***/tasks/019ad9e2-5b7c-7a41-9c3e-2f8d6b1a4e07/output/model.glb?Expires=***"
  },
  "thumbnail_url": "https://assets.meshy.ai/***/tasks/019ad9e2-5b7c-7a41-9c3e-2f8d6b1a4e07/output/preview.png?Expires=***",
  "texture_urls": null,
  "progress": 100,
  "status": "SUCCEEDED",
  "created_at": 1796421600000,
  "started_at": 1796421605000,
  "finished_at": 1796421672000,
  "expires_at": 1796680872000,
  "task_error": null,
  "consumed_credits": 20
}
```
