Resize API
Resize a 3D model to a real-world size, in meters. Set its height or the length of its longest side, or have Meshy estimate the object's real-world height.
Create a Resize task
Creates a Resize task. The task runs in the background. For how long a task usually takes, see Processing times.
Request
# Simple: resize to a specific height
curl https://api.meshy.ai/openapi/v1/resize \
-X POST \
-H "Authorization: Bearer ${YOUR_API_KEY}" \
-H 'Content-Type: application/json' \
-d '{
"input_task_id": "018a210d-8ba4-705c-b111-1f1776f7f578",
"resize_height": 1.8
}'
# Advanced: resize longest side with custom origin
curl https://api.meshy.ai/openapi/v1/resize \
-X POST \
-H "Authorization: Bearer ${YOUR_API_KEY}" \
-H 'Content-Type: application/json' \
-d '{
"model_url": "https://example.com/model.glb",
"resize_longest_side": 2.0,
"origin_at": "center"
}'
Response
{
"result": "0193bfc5-ee4f-73f8-8525-44b398884ce9"
}
Parameters
- Name
- input_task_id
- Type
- string
- Required
- Description
Required unless you send
model_url. The ID of the Meshy task whose model you want to resize. The task must have the statusSUCCEEDED. Meshy returns the resized model as a GLB file.
- Name
- model_url
- Type
- string
- Required
- Description
Required unless you send
input_task_id. The model to resize, 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.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.
A GLB, OBJ, FBX, or STL file keeps its format in the result. A
.gltffile or a data URI comes back as GLB.
Send exactly one of resize_height, resize_longest_side, or auto_size. Sending none of them, or more than one, returns 400.
- Name
- resize_height
- Type
- number
- Description
The model's new height in meters, greater than 0. A negative value returns
400.
- Name
- resize_longest_side
- Type
- number
- Description
The new length of the model's longest side in meters, greater than 0. A negative value returns
400. Meshy keeps the model's aspect ratio.
- Name
- auto_size
- Type
- boolean
- Description
Whether to estimate the object's real-world height with AI vision and resize the model to it. Unless you set
origin_at, Meshy puts the origin at the bottom.
- Name
- origin_at
- Type
- string
- default bottom
- Description
Where to put the model's origin after resizing,
bottomorcenter.
Returns
The result field of the response holds the ID of the new Resize 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 resize mode: None of
resize_height,resize_longest_side, andauto_sizewas sent. - Mutually exclusive parameters: The request has more than one of
resize_height,resize_longest_side, andauto_size. Send only one. - Negative size:
resize_heightorresize_longest_sideis negative. - Invalid input task:
input_task_idisn't a successful task. - Invalid model format: The
model_urlfile has an unsupported extension. - Unreachable URL: Meshy can't download the
model_urlfile. - 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.
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 resize. 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 Resize task
Returns a Resize task by its ID.
Request
curl https://api.meshy.ai/openapi/v1/resize/a43b5c6d-7e8f-901a-234b-567c890d1e2f \
-H "Authorization: Bearer ${YOUR_API_KEY}"
Response
{
"id": "0193bfc5-ee4f-73f8-8525-44b398884ce9",
"type": "resize",
"model_urls": {
"glb": "https://assets.meshy.ai/.../model.glb?Expires=..."
},
"progress": 100,
"status": "SUCCEEDED",
"created_at": 1699999999000,
"started_at": 1700000000000,
"finished_at": 1700000001000,
"task_error": null,
"consumed_credits": 1
}
Parameters
- Name
- id
- Type
- path
- Description
The task ID from the create response.
Returns
The Resize task object.
Delete a Resize task
Permanently deletes a Resize task, including its models and data. You can't undo a delete.
Request
curl --request DELETE \
--url https://api.meshy.ai/openapi/v1/resize/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 Resize tasks
Returns a list of your Resize tasks.
Request
curl https://api.meshy.ai/openapi/v1/resize?page_size=10 \
-H "Authorization: Bearer ${YOUR_API_KEY}"
Response
[
{
"id": "0193bfc5-ee4f-73f8-8525-44b398884ce9",
"type": "resize",
"model_urls": {
"glb": "https://assets.meshy.ai/.../model.glb?Expires=..."
},
"progress": 100,
"status": "SUCCEEDED",
"created_at": 1699999999000,
"started_at": 1700000000000,
"finished_at": 1700000001000,
"task_error": null,
"consumed_credits": 1
}
]
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 Resize task objects.
Stream a Resize task
Streams a Resize task's updates as Server-Sent Events (SSE).
Request
curl -N https://api.meshy.ai/openapi/v1/resize/a43b5c6d-7e8f-901a-234b-567c890d1e2f/stream \
-H "Authorization: Bearer ${YOUR_API_KEY}"
Response Stream
// Message event examples illustrate task progress.
event: message
data: {
"id": "0193bfc5-ee4f-73f8-8525-44b398884ce9",
"progress": 0,
"status": "PENDING"
}
event: message
data: {
"id": "0193bfc5-ee4f-73f8-8525-44b398884ce9",
"type": "resize",
"model_urls": {
"glb": "https://assets.meshy.ai/.../model.glb?Expires=..."
},
"progress": 100,
"status": "SUCCEEDED",
"created_at": 1699999999000,
"started_at": 1700000000000,
"finished_at": 1700000001000,
"task_error": null,
"consumed_credits": 1
}
Parameters
- Name
- id
- Type
- path
- Description
The task ID from the create response.
Returns
A stream of Resize 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 Resize task object
A Resize task object describes one resize of a 3D model. It holds the status, the progress, and the model file when the task succeeds.
Properties
- 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
resize.
- Name
- model_urls
- Type
- object
- Description
Download URL for the resized model file. For
input_task_id, the file is always GLB. Formodel_url, a GLB, OBJ, FBX, or STL file keeps its format, and a.gltffile or a data URI comes back as GLB.
- 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
- status
- Type
- string
- Description
The task status, one of
PENDING,IN_PROGRESS,SUCCEEDED,FAILED, orCANCELED.
- Name
- preceding_tasks
- Type
- integer
- Description
The number of tasks ahead of this one in the queue. The value is meaningful only while the task is
PENDING.
- Name
- created_at
- Type
- timestamp
- Description
Time the task was created, in Unix milliseconds.
- Name
- started_at
- Type
- timestamp
- Description
Time the task started, in Unix milliseconds. It's
0until the task starts.
- Name
- finished_at
- Type
- timestamp
- Description
Time the task finished, in Unix milliseconds. It's
0until the task finishes.
- 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, which is
1for a Resize task. It's0for aFAILEDtask.