Retexture API
Generate new textures for an existing 3D model from a text prompt or reference images. The model can come from another Meshy task or from a model file.
Create a Retexture task
Creates a Retexture task. The task runs in the background. For how long a task usually takes, see Processing times.
Request
# Retexture with text prompt
curl https://api.meshy.ai/openapi/v1/retexture \
-H "Authorization: Bearer ${YOUR_API_KEY}" \
-H 'Content-Type: application/json' \
-d '{
"model_url": "https://cdn.meshy.ai/model/example_model_2.glb",
"text_style_prompt": "red fangs, Samurai outfit that fused with japanese batik style",
"enable_original_uv": true,
"enable_pbr": true
}'
# Retexture with image style and PBR
curl https://api.meshy.ai/openapi/v1/retexture \
-H "Authorization: Bearer ${YOUR_API_KEY}" \
-H 'Content-Type: application/json' \
-d '{
"model_url": "https://cdn.meshy.ai/model/example_model_2.glb",
"image_style_url": "<your publicly accessible image url or base64-encoded data URI>",
"ai_model": "latest",
"enable_pbr": true,
"enable_original_uv": true
}'
Response
{
"result": "018a210d-8ba4-705c-b111-1f1776f7f578"
}
Parameters
- Name
- input_task_id
- Type
- string
- Required
- Description
Required unless you send
model_url. The ID of a task that produced a 3D model to texture, for example a Text to 3D, Image to 3D, Remesh, or Retexture task. The task must be one you created with the API and have the statusSUCCEEDED. Meshy textures the task's GLB.
- Name
- model_url
- Type
- string
- Required
- Description
Required unless you send
input_task_id. The model to texture, as a public URL or a data URI. If you send both, Meshy usesinput_task_id.The model must be a GLB, glTF, OBJ, FBX, or STL file of at most 400 MB from an
httporhttpsURL, or 100 MB as a data URI. For a data URI, use the MIME typeapplication/octet-stream, for exampledata:application/octet-stream;base64,<your base64-encoded model data>.A file over 100 MB must also follow these rules:
- 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.
Send one of these three style inputs.
- Name
- text_style_prompt
- Type
- string
- Required
- Description
Required unless you send
image_style_urlormultiview_image_urls. Text that describes the texture you want, up to 800 characters. Longer text returns400.
- Name
- image_style_url
- Type
- string
- Required
- Description
Required unless you send
text_style_promptormultiview_image_urls. A 2D image whose style the texture follows, as a public URL or a data URI (data:image/jpeg;base64,<your base64-encoded image data>). If you send bothtext_style_promptandimage_style_url, Meshy usesimage_style_url.The image must be a
.jpg,.jpeg,.png, or.webpfile of at most 20 MB.The texture might not fit well when the object in the image has a very different shape from the model.
- Name
- multiview_image_urls
- Type
- string[]
- Required
- Description
Required unless you send
text_style_promptorimage_style_url. One to four images of the same object from different views. The first image is the main (front) view. The order of the other views (left, back, right) doesn't matter. An empty array, or more than four images, returns400.Each image follows the same format and size rules as
image_style_url, at most 20 MB per image. You can't combinemultiview_image_urlswithtext_style_promptorimage_style_url.multiview_image_urlsneeds an explicit"ai_model": "meshy-7". Any otherai_model, including the defaultlatest, returns400.
- Name
- ai_model
- Type
- string
- default latest
- Description
The AI model that generates the texture.
Available values:
meshy-6-litemeshy-6meshy-7latest: Meshy 7
- Name
- enable_original_uv
- Type
- boolean
- default false
- Description
Whether to keep the model's UV layout instead of generating a new one.
- For a model Meshy generated, from
input_task_idor amodel_urlthat points to a Meshy output, usetrueto reuse its optimized UV layout. - For a model you uploaded from elsewhere, use
trueto keep UVs that are already good. Leave itfalseto let Meshy generate new UVs, which suits a model without proper UV mapping.
- For a model Meshy generated, from
- Name
- enable_pbr
- Type
- boolean
- default false
- Description
Whether to also generate PBR maps (metallic, roughness, and normal) with the base color. With
meshy-6, Meshy also generates an emission map, except at atexture_resolutionof8k.meshy-6-lite,meshy-7, andlatestdon't generate an emission map.
- Name
- texture_resolution
- Type
- string
- default 2k
- Description
The size of the base color texture. Higher resolutions capture more surface detail.
Available values:
2k: 2048 × 2048 pixels4k: 4096 × 4096 pixels8k: 8192 × 8192 pixels
4kand8kneed anai_modelofmeshy-6,meshy-7, orlatest. Withmeshy-6-lite, they return400. At8k, Meshy doesn't generate an emission map.
- Name
- hd_texture
- Type
- boolean
- ⚠ deprecated
- default false
- Description
Use
texture_resolutioninstead.trueis the same astexture_resolution: "4k". If you send both, Meshy usestexture_resolution.
- Name
- remove_lighting
- Type
- boolean
- default true
- Description
Whether to remove highlights and shadows from the base color texture. The result works better under your own lighting.
Meshy applies it only with
meshy-6, at atexture_resolutionof2kor4k. Withmeshy-7orlatest, or at8k, Meshy accepts it and ignores it. Withmeshy-6-lite, sending it with any value returns400.
- Name
- target_formats
- Type
- string[]
- Description
The file formats to generate. Meshy generates only the formats you list, which can shorten the task. If you leave it out, Meshy generates every format except
3mf.Available values:
glbobjfbxstlusdz3mf
- Name
- alpha_thumbnail
- Type
- boolean
- default false
- Description
Whether to also render a preview with a transparent background (RGBA), returned in
alpha_thumbnail_urlwhen you get the task.thumbnail_urldoesn't change.
Returns
The result field of the response holds the ID of the new Retexture task.
Failure modes
- Name
400 - Bad Request- Description
The request can't run. The error message says which problem it found. For example:
- Missing parameter: Neither
model_urlnorinput_task_idwas sent. - Missing style: None of
text_style_prompt,image_style_url, andmultiview_image_urlswas sent. - Conflicting style inputs:
multiview_image_urlswas sent withtext_style_promptorimage_style_url. - Unsupported model for multi-view:
multiview_image_urlswas sent without an explicit"ai_model": "meshy-7". - Invalid input task:
input_task_idisn't a successful task of a supported type. - Invalid model format: The
model_urlfile has an unsupported extension. - Unreachable URL: Meshy can't download the
model_urlfile, theimage_style_urlimage, or amultiview_image_urlsimage. - Model file too large: The
model_urlfile is over 400 MB from anhttporhttpsURL, or over 100 MB as a data URI. - Too many faces: The
model_urlfile is over 100 MB and has more than 10,000,000 faces. Reduce the face count, then send the file again. - ASCII FBX over 100 MB: The
model_urlfile is an ASCII FBX over 100 MB. Send it as binary FBX or GLB. - Unreadable model file: The
model_urlfile is over 100 MB, and Meshy can't read its header. For example, it's a Draco-compressed GLB or glTF, or a binary FBX older than 7.1. - Model header too complex: The
model_urlfile is over 100 MB, and its header has too many meshes, nodes, or records to check. Reduce the number of objects in the file, then send it again. - Image too large: The
image_style_urlimage or amultiview_image_urlsimage is over 20 MB.
Fix the request, then send it again. See Errors.
- Missing parameter: Neither
- Name
401 - Unauthorized- Description
The API key is missing or invalid. Check the
Authorizationheader.
- Name
402 - Payment Required- Description
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, then retry.
- Name
403 - Forbidden- Description
input_task_idis a bas-relief model, which this endpoint can't retexture. The message isThis model type does not support this operation. Send a different model.
- Name
404 - Not Found- Description
input_task_iddoesn't match any of your tasks. Check the task ID, then send the request again.
- Name
429 - Too Many Requests- Description
You exceeded your rate limit. Wait, then retry. See Rate limits.
Get a Retexture task
Returns a Retexture task by its ID.
Request
curl https://api.meshy.ai/openapi/v1/retexture/018a210d-8ba4-705c-b111-1f1776f7f578 \
-H "Authorization: Bearer ${YOUR_API_KEY}"
Response
{
"id": "018a210d-8ba4-705c-b111-1f1776f7f578",
"type": "retexture",
"model_urls": {
"glb": "https://assets.meshy.ai/***/tasks/018a210d-8ba4-705c-b111-1f1776f7f578/output/model.glb?Expires=***",
"fbx": "https://assets.meshy.ai/***/tasks/018a210d-8ba4-705c-b111-1f1776f7f578/output/model.fbx?Expires=***",
"obj": "https://assets.meshy.ai/***/tasks/018a210d-8ba4-705c-b111-1f1776f7f578/output/model.obj?Expires=***",
"usdz": "https://assets.meshy.ai/***/tasks/018a210d-8ba4-705c-b111-1f1776f7f578/output/model.usdz?Expires=***",
"mtl": "https://assets.meshy.ai/***/tasks/018a210d-8ba4-705c-b111-1f1776f7f578/output/model.mtl?Expires=***",
"stl": "https://assets.meshy.ai/***/tasks/018a210d-8ba4-705c-b111-1f1776f7f578/output/model.stl?Expires=***"
},
"thumbnail_url": "https://assets.meshy.ai/***/tasks/018a210d-8ba4-705c-b111-1f1776f7f578/output/preview.png?Expires=***",
"text_style_prompt": "red fangs, Samurai outfit that fused with japanese batik style",
"texture_image_url": "",
"progress": 100,
"started_at": 1692771667037,
"created_at": 1692771650657,
"expires_at": 1692771679037,
"finished_at": 1692771669037,
"status": "SUCCEEDED",
"texture_urls": [
{
"base_color": "https://assets.meshy.ai/***/tasks/018a210d-8ba4-705c-b111-1f1776f7f578/output/texture_0.png?Expires=***",
"metallic": "https://assets.meshy.ai/***/tasks/018a210d-8ba4-705c-b111-1f1776f7f578/output/texture_0_metallic.png?Expires=XXX",
"normal": "https://assets.meshy.ai/***/tasks/018a210d-8ba4-705c-b111-1f1776f7f578/output/texture_0_normal.png?Expires=XXX",
"roughness": "https://assets.meshy.ai/***/tasks/018a210d-8ba4-705c-b111-1f1776f7f578/output/texture_0_roughness.png?Expires=XXX"
}
],
"task_error": {
"message": ""
},
"consumed_credits": 10
}
Parameters
- Name
- id
- Type
- path
- Description
The task ID from the create response.
Returns
Delete a Retexture task
Permanently deletes a Retexture task, including its models and data. You can't undo a delete.
Request
curl --request DELETE \
--url https://api.meshy.ai/openapi/v1/retexture/a43b5c6d-7e8f-901a-234b-567c890d1e2f \
-H "Authorization: Bearer ${YOUR_API_KEY}"
Response
// 200 OK on success, with an empty body.
//
// 409 Conflict when the task is IN_PROGRESS. The task keeps running:
{
"message": "Task is IN_PROGRESS and cannot be deleted. Credits for a task the worker has already started are not refundable; wait for it to reach SUCCEEDED, FAILED or CANCELED, then delete it."
}
Path parameters
- Name
- id
- Type
- path
- Description
The ID of the task to 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.
Returns
200 OK when the task is deleted, or 409 Conflict when the task is
IN_PROGRESS.
List Retexture tasks
Returns a list of your Retexture tasks.
Request
curl https://api.meshy.ai/openapi/v1/retexture?page_size=10 \
-H "Authorization: Bearer ${YOUR_API_KEY}"
Response
[
{
"id": "018a210d-8ba4-705c-b111-1f1776f7f578",
"type": "retexture",
"model_urls": {
"glb": "https://assets.meshy.ai/***/tasks/018a210d-8ba4-705c-b111-1f1776f7f578/output/model.glb?Expires=***",
"fbx": "https://assets.meshy.ai/***/tasks/018a210d-8ba4-705c-b111-1f1776f7f578/output/model.fbx?Expires=***",
"usdz": "https://assets.meshy.ai/***/tasks/018a210d-8ba4-705c-b111-1f1776f7f578/output/model.usdz?Expires=***"
},
"thumbnail_url": "https://assets.meshy.ai/***/tasks/018a210d-8ba4-705c-b111-1f1776f7f578/output/preview.png?Expires=***",
"text_style_prompt": "red fangs, Samurai outfit that fused with japanese batik style",
"progress": 100,
"started_at": 1692771667037,
"created_at": 1692771650657,
"expires_at": 1692771679037,
"finished_at": 1692771669037,
"status": "SUCCEEDED",
"texture_urls": [
{
"base_color": "https://assets.meshy.ai/***/tasks/018a210d-8ba4-705c-b111-1f1776f7f578/output/texture_0.png?Expires=***",
"metallic": "https://assets.meshy.ai/***/tasks/018a210d-8ba4-705c-b111-1f1776f7f578/output/texture_0_metallic.png?Expires=XXX",
"normal": "https://assets.meshy.ai/***/tasks/018a210d-8ba4-705c-b111-1f1776f7f578/output/texture_0_normal.png?Expires=XXX",
"roughness": "https://assets.meshy.ai/***/tasks/018a210d-8ba4-705c-b111-1f1776f7f578/output/texture_0_roughness.png?Expires=XXX"
}
],
"preceding_tasks": 0,
"task_error": {
"message": ""
},
"consumed_credits": 10
}
]
Parameters
- Name
- page_num
- Type
- integer
- default 1
- Description
The page number to return.
- Name
- page_size
- Type
- integer
- default 10
- Description
The number of tasks per page, up to
100.
- Name
- sort_by
- Type
- string
- Description
The sort order.
Available values:
+created_at: oldest first-created_at: newest first
Returns
A paginated list of Retexture task objects.
Stream a Retexture task
Streams a Retexture task's updates as Server-Sent Events (SSE).
Request
curl -N https://api.meshy.ai/openapi/v1/retexture/018a210d-8ba4-705c-b111-1f1776f7f578/stream \
-H "Authorization: Bearer ${YOUR_API_KEY}"
Response Stream
// Error event example
event: error
data: {
"status_code": 404,
"message": "Task not found"
}
// Message event examples illustrate task progress.
// These examples are shortened. Each event holds the full task object.
event: message
data: {
"id": "018a210d-8ba4-705c-b111-1f1776f7f578",
"progress": 0,
"status": "PENDING"
}
event: message
data: {
"id": "018a210d-8ba4-705c-b111-1f1776f7f578",
"progress": 50,
"status": "IN_PROGRESS"
}
event: message
data: {
"id": "018a210d-8ba4-705c-b111-1f1776f7f578",
"type": "retexture",
"progress": 100,
"status": "SUCCEEDED",
"created_at": 1692771650657,
"started_at": 1692771667037,
"finished_at": 1692771669037,
"model_urls": {
"glb": "https://assets.meshy.ai/***/tasks/018a210d-8ba4-705c-b111-1f1776f7f578/output/model.glb?Expires=***",
"fbx": "https://assets.meshy.ai/***/tasks/018a210d-8ba4-705c-b111-1f1776f7f578/output/model.fbx?Expires=***",
"obj": "https://assets.meshy.ai/***/tasks/018a210d-8ba4-705c-b111-1f1776f7f578/output/model.obj?Expires=***",
"usdz": "https://assets.meshy.ai/***/tasks/018a210d-8ba4-705c-b111-1f1776f7f578/output/model.usdz?Expires=***",
"mtl": "https://assets.meshy.ai/***/tasks/018a210d-8ba4-705c-b111-1f1776f7f578/output/model.mtl?Expires=***",
"stl": "https://assets.meshy.ai/***/tasks/018a210d-8ba4-705c-b111-1f1776f7f578/output/model.stl?Expires=***"
},
"texture_urls": [
{
"base_color": "https://assets.meshy.ai/***/tasks/018a210d-8ba4-705c-b111-1f1776f7f578/output/texture_0.png?Expires=***",
"metallic": "https://assets.meshy.ai/***/tasks/018a210d-8ba4-705c-b111-1f1776f7f578/output/texture_0_metallic.png?Expires=XXX",
"normal": "https://assets.meshy.ai/***/tasks/018a210d-8ba4-705c-b111-1f1776f7f578/output/texture_0_normal.png?Expires=XXX",
"roughness": "https://assets.meshy.ai/***/tasks/018a210d-8ba4-705c-b111-1f1776f7f578/output/texture_0_roughness.png?Expires=XXX"
}
],
"preceding_tasks": 0,
"task_error": {
"message": ""
},
"consumed_credits": 10
}
Parameters
- Name
- id
- Type
- path
- Description
The task ID from the create response.
Returns
A stream of Retexture task objects as Server-Sent Events.
Each 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.
The Retexture task object
A Retexture task object describes one retexture of a 3D model. It holds the status, the progress, and the model and texture files when the task succeeds.
Properties
Example Retexture Task Model
{
"id": "018a210d-8ba4-705c-b111-1f1776f7f578",
"type": "retexture",
"model_urls": {
"glb": "https://assets.meshy.ai/***/tasks/018a210d-8ba4-705c-b111-1f1776f7f578/output/model.glb?Expires=***",
"fbx": "https://assets.meshy.ai/***/tasks/018a210d-8ba4-705c-b111-1f1776f7f578/output/model.fbx?Expires=***",
"usdz": "https://assets.meshy.ai/***/tasks/018a210d-8ba4-705c-b111-1f1776f7f578/output/model.usdz?Expires=***"
},
"text_style_prompt": "red fangs, Samurai outfit that fused with japanese batik style",
"image_style_url": "https://assets.meshy.ai/***/image/example_image.jpg?Expires=***",
"thumbnail_url": "https://assets.meshy.ai/***/tasks/018a210d-8ba4-705c-b111-1f1776f7f578/output/preview.png?Expires=***",
"progress": 100,
"started_at": 1692771667037,
"created_at": 1692771650657,
"expires_at": 1692771679037,
"finished_at": 1692771669037,
"status": "SUCCEEDED",
"texture_urls": [
{
"base_color": "https://assets.meshy.ai/***/tasks/018a210d-8ba4-705c-b111-1f1776f7f578/output/texture_0.png?Expires=***",
"metallic": "https://assets.meshy.ai/***/tasks/018a210d-8ba4-705c-b111-1f1776f7f578/output/texture_0_metallic.png?Expires=XXX",
"normal": "https://assets.meshy.ai/***/tasks/018a210d-8ba4-705c-b111-1f1776f7f578/output/texture_0_normal.png?Expires=XXX",
"roughness": "https://assets.meshy.ai/***/tasks/018a210d-8ba4-705c-b111-1f1776f7f578/output/texture_0_roughness.png?Expires=XXX"
}
],
"preceding_tasks": 0,
"task_error": {
"message": ""
},
"consumed_credits": 10
}
- Name
- id
- Type
- string
- Description
The task ID. Treat it as an opaque string, and don't rely on its format.
- Name
- type
- Type
- string
- Description
The task type, always
retexture.
- Name
- model_urls
- Type
- object
- Description
Download URLs for the textured 3D model, one per file format.
- Name
glb- Type
- string
- Description
The GLB file.
- Name
fbx- Type
- string
- Description
The FBX file.
- Name
obj- Type
- string
- Description
The OBJ file.
- Name
usdz- Type
- string
- Description
The USDZ file.
- Name
mtl- Type
- string
- Description
The MTL file. Meshy returns it with the OBJ file when the model has textures.
- Name
stl- Type
- string
- Description
The STL file.
- Name
3mf- Type
- string
- Description
The 3MF file. Present only when
target_formatsincludes3mf.
- Name
- text_style_prompt
- Type
- string
- Description
The text prompt you created the task with.
- Name
- image_style_url
- Type
- string
- Description
The style image you created the task with.
- Name
- multiview_image_urls
- Type
- string[]
- Description
Download URLs for the multi-view reference images you created the task with. Present only when you created the task with
multiview_image_urls.
- Name
- thumbnail_url
- Type
- string
- Description
Download URL for a thumbnail image of the model.
- Name
- alpha_thumbnail_url
- Type
- string
- Description
Download URL for a version of
thumbnail_urlwith a transparent background (RGBA). Present only when you created the task withalpha_thumbnail: trueand Meshy rendered the transparent preview.
- Name
- progress
- Type
- integer
- Description
How much of the task is done, as a percentage. It's
0until the task starts and100when it succeeds.
- Name
- started_at
- Type
- timestamp
- Description
Time the task started, in Unix milliseconds. It's
0until the task starts.
- Name
- created_at
- Type
- timestamp
- Description
Time the task was created, in Unix milliseconds.
- Name
- expires_at
- Type
- timestamp
- Description
Time the task's results expire, in Unix milliseconds.
- Name
- finished_at
- Type
- timestamp
- Description
Time the task finished, in Unix milliseconds. It's
0until the task finishes.
- Name
- status
- Type
- string
- Description
The task status, one of
PENDING,IN_PROGRESS,SUCCEEDED,FAILED, orCANCELED.
- Name
- texture_urls
- Type
- array
- Description
Download URLs for the generated textures, as an array of objects. The array usually holds one object. Each object has these fields:
- Name
base_color- Type
- string
- Description
Download URL for the base color map.
- Name
metallic- Type
- string
- Description
Download URL for the metallic map. Meshy leaves this field out when you create the task with
enable_pbr: false.
- Name
normal- Type
- string
- Description
Download URL for the normal map. Meshy leaves this field out when you create the task with
enable_pbr: false.
- Name
roughness- Type
- string
- Description
Download URL for the roughness map. Meshy leaves this field out when you create the task with
enable_pbr: false.
- Name
emission- Type
- string
- Description
Download URL for the emission map. Meshy leaves this field out when you create the task with any of these:
enable_pbr: false- an
ai_modelofmeshy-6-lite,meshy-7, orlatest texture_resolution: 8k
- Name
- preceding_tasks
- Type
- integer
- Description
The number of tasks ahead of this one in the queue. Present only while the task is
PENDING.
- Name
- task_error
- Type
- object
- Description
The error details when the task fails. See Errors.
- Name
- consumed_credits
- Type
- integer
- Description
The number of credits the task used. Present when the status is
PENDING,IN_PROGRESS, orSUCCEEDED. It's0for aFAILEDtask, because Meshy refunds the credits when a task fails.