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.
Moving from v1? The main changes for Remesh:
target_formatsworks as on v1. STL and 3MF files follow the v2 model size rules, and amodel_urlupload keeps its size.- A request with any of these parameters returns
400, even if the value isnullorfalse:resize_heightresize_longest_sideorigin_atauto_sizeconvert_format_only
- To change the size or move the origin, run Resize on the Remesh task. Instead of
convert_format_only, run one Convert task. - Results are in
output.
Create a Remesh task
Creates a Remesh task and returns the task object. The task runs in the background. To read its result, see Get the result. For how long a task usually takes, see Processing times.
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": "01a1aeac-afb0-77bf-a47b-47a43ee563bc"
}'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, 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 statusSUCCEEDED. Remesh uses the task's GLB file.
- Name
- model_url
- Type
- string
- Required
- Description
Required unless you send
input_task_id. The model to remesh, as a public URL or a data URI. Sending bothinput_task_idandmodel_urlreturns400.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 returns400.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.
- Name
- topology
- Type
- string
- default triangle
- Description
The face type of the remeshed model,
triangleorquad. GLB files store only triangles, so Meshy splits each quad into two triangles in the GLB file. To keep the quads, addobjorfbxtotarget_formats.Try and preview
- Name
- target_polycount
- Type
- integer
- default 30000
- Description
The number of faces to aim for, from
100to300000. A value outside the range returns400.Try and preview
- Name
- decimation_mode
- Type
- integer
- Description
Adaptive face count, by level. The face count follows the model's surface area. When you set it, Meshy ignores
target_polycount.Try and previewAvailable values:
1: ultra2: high3: medium4: low
- Name
- target_formats
- Type
- string[]
- default ["glb"]
- Description
The file formats to generate. Meshy generates only the formats you list. Sending
nullor[]is the same as leaving it out.Available values:
glbobjfbxstlusdzblend3mf
A
quadmesh 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, keep their own size. See Model size.
- Name
- thumbnail_resolution
- Type
- integer
- default 512
- Description
The width and height, in pixels, of the task's preview images:
512or1024. It applies tooutput.thumbnail_urland to any optional preview you request. Any other value returns400.
Returns
202 Accepted with 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 TasksRetry-After: how many seconds to wait before you first read it
Failure modes
- Name
400 - Bad Request- Description
The request can't run. For example:
- Neither
input_task_idnormodel_urlwas sent - Both
input_task_idandmodel_urlwere 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_polycountis outside100to300000target_formatshas 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
nullorfalse. The code isparameter_unknownand the message isUnknown 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.
- Neither
- Name
401 - Unauthorized- Description
The API key is missing or invalid. Check the
Authorizationheader.
- Name
402 - Payment Required- Description
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.
- Name
403 - Forbidden- Description
input_task_idis a bas-relief model, which this endpoint can't remesh. 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.
- Name
429 - Too Many Requests- Description
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.
- You sent too many requests. Wait the number of seconds in
Resize the result
To change the size of a remeshed model, run a Resize task on the Remesh task. Resize returns a GLB file. For other formats, run a Convert 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 on the Resize page.
Meshy charges each task separately. See Pricing.
Remesh, Resize, then Convert
# 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"]
}'
Get the result
Read Remesh tasks the same way as every other v2 task, through the Tasks routes. To list only Remesh tasks, filter by type=remesh.
| To | Call |
|---|---|
| Get one task | GET /openapi/v2/tasks/{id} |
| Wait for updates | GET /openapi/v2/tasks/{id}/stream or a webhook |
| List your tasks | GET /openapi/v2/tasks?type=remesh |
| Delete a task | DELETE /openapi/v2/tasks/{id} |
Remesh output
When the task succeeds, output holds these fields. The rest of the task object is the same for every task type. The URLs in output stop working at expires_at.
curl https://api.meshy.ai/openapi/v2/tasks/01a1af0c-84c7-7249-8649-f506c7d35a51 \
-H "Authorization: Bearer ${MESHY_API_KEY}"Loading…- Name
- model_urls
- Type
- object
- Description
Signed URLs to the remeshed files, one per format in
target_formats, keyed by format. If you left outtarget_formats, the only key isglb. Anobjwith a base color texture also gets anmtlkey, with the URL of its material file.
- Name
- thumbnail_url
- Type
- string
- Description
Signed URL to a PNG preview of the remeshed model, with a transparent background.
- Name
- texture_urls
- Type
- array
- Description
The model's texture maps after the remesh, one item per texture set, with a signed URL for each of these maps:
base_colormetallicroughnessnormalmetallic_roughnessemission
A map that wasn't produced is
null. The array is empty when the input model has no textures.