# Meshy API v2 > Meshy is an AI-powered 3D model generation platform. API v2 gives every task one response shape (the task object), one set of task routes (`/openapi/v2/tasks`), and one error format. - API Base URL: `https://api.meshy.ai/openapi/v2/` - Documentation: https://docs.meshy.ai/api/v2 - OpenAPI Specification: https://docs.meshy.ai/api/v2/openapi.yaml (JSON: https://docs.meshy.ai/api/v2/openapi.json). Use this spec for v2 code. https://docs.meshy.ai/openapi.yaml is the v1 spec. - All v2 pages in one file: https://docs.meshy.ai/api/v2/llms-full.txt - Moving from v1: https://docs.meshy.ai/api/migrate-to-v2 - API v1 is deprecated: it gets no new features after January 15, 2027, and every v1 endpoint that has a v2 version stops working on March 15, 2027. Its docs index, which also lists the endpoints that have no v2 version such as Creative Lab, is https://docs.meshy.ai/api/v1/llms.txt ## Instructions for Large Language Models When generating code that calls Meshy API v2, follow these guidelines. ### 1. Authentication Same as v1. Send your API key as a Bearer token in the `Authorization` header: ``` Authorization: Bearer msy_YOUR_API_KEY ``` Create keys on the API Keys page (https://www.meshy.ai/developers/keys). Never call the API from browser JavaScript: it exposes your API key. Call it from your server. ### 2. Every Create Returns the Task Object A create (`POST /openapi/v2/`) returns `202 Accepted` with the task object, not the result: - `id`, `type`, `status` (`PENDING` at first), `progress`, `input` (your request) and `output` (`null` until the task succeeds). - The `Location` header is `/openapi/v2/tasks/{id}`, and `Retry-After` says how many seconds to wait before the first poll. Text to 3D is the one exception: its create response also keeps `result` (the task ID), and its `Location` is `/openapi/v2/text-to-3d/{id}`. Read that task on the Tasks routes like any other. ### 3. Read Every Task on the Tasks Routes There are no per-endpoint read routes on v2 (`GET /openapi/v2/image-to-3d/{id}` returns `404` with the code `route_not_found`). For every task type: - `GET /openapi/v2/tasks/{id}`: get one task. While it is `PENDING` or `IN_PROGRESS`, wait `Retry-After` seconds (5 if the header is missing) before the next poll. - `GET /openapi/v2/tasks?type=`: list tasks, newest first, as `{"data": [...], "has_more": ...}`. `page_size` is 1 to 100 (default 10). - `GET /openapi/v2/tasks/{id}/stream`: Server-Sent Events with the full task object until a final status. Errors arrive as `error` events while the HTTP status stays `200`. - `DELETE /openapi/v2/tasks/{id}`: delete a task. `409` while it is `IN_PROGRESS`. Tasks created on v1 are readable here too, by the same ID (except Creative Lab tasks). ### 4. Task Statuses and Results - `status` is `PENDING`, `IN_PROGRESS`, `SUCCEEDED`, `FAILED` or `CANCELED`. Stop polling on the last three. - On `SUCCEEDED`, the results are in `output`, whose fields depend on `type` (for example `output.model_urls.glb` for Image to 3D, `output.image_urls` for Text to Image). Each endpoint page lists its output fields. - Every link in `output` is signed and stops working at `expires_at`. Download the files you need. How long Meshy keeps them: https://docs.meshy.ai/api/v2/asset-retention.md - Timestamps (`created_at`, `started_at`, `finished_at`, `expires_at`) are Unix epoch milliseconds. ### 5. Errors - A request that fails returns an HTTP error with `{"type": "...", "code": "...", "message": "...", "doc_url": ...}`, where `doc_url` is a link or `null`. Branch on `code` or `type`, not on `message`: `400` bad input, `401` missing or bad API key, `402` not enough credits, a credit limit, or a plan that doesn't allow the request, `403` not allowed (an IP allowlist or content moderation), `404` unknown task or route, `429` too many requests (wait `Retry-After` seconds when the header is sent). The one exception is Text to 3D: a request it rejects before reading the API key returns only `{"message": "..."}`. - A create request with a parameter the endpoint doesn't define (a typo, a wrong-case name, or a v1 name such as `hd_texture`) returns `400` `parameter_unknown`, and `message` says what to send instead. Text to 3D requests with `mode` ignore such a parameter. - Rate limits: 20 requests per second (100 on Enterprise). Concurrent tasks, meaning tasks in `PENDING` or `IN_PROGRESS`: Pro 10, Studio 60 (20 on some earlier Studio plans), Enterprise 100 by default or a custom limit. A team's API keys share one set of limits for the whole team. Going over either limit returns `429`: `rate_limit_exceeded` for requests per second (wait `Retry-After` seconds), `pending_task_limit_reached` for concurrent tasks (no `Retry-After`; wait for a task to finish). Details: https://docs.meshy.ai/api/v2/rate-limits.md - A task that fails later has `status: "FAILED"` and a `task_error` with `type` (`invalid_input`, `timeout`, `service_unavailable` or `server_error`), `code` (or `null`), `message` and `doc_url`. Branch on `type`: retry `timeout`, `service_unavailable` and `server_error`; fix the input for `invalid_input`. ### 6. Webhooks To be notified instead of polling, set a webhook's payload version to v2 on the Webhooks page (https://www.meshy.ai/developers/webhooks). Each delivery carries the task object with the header `Meshy-Webhook-Version: v2`. Deliveries can arrive out of order or more than once, so handle each `id` and `status` pair once. Setup, headers, retries and Send test: https://docs.meshy.ai/api/v2/webhooks.md ### 7. Metadata To tag a task with your own key-value pairs, send the `X-Meshy-Metadata` header when you create it, for example `user=alex@example.com,team=fab`. Meshy reads it only from API keys of Studio and Enterprise teams and ignores it on other plans. The tags come back in `metadata` on usage records. On those teams, a malformed header returns `400` `metadata_invalid` and creates no task. Creative Lab endpoints ignore the header on every plan. Details: https://docs.meshy.ai/api/v2/metadata.md ### 8. Choosing a Model and an Endpoint A textured 3D model comes from two AI models: `ai_model` picks the geometry model on Text to 3D, Image to 3D and Multi-Image to 3D, and `texture_model` picks the texture model on those three endpoints and on Retexture. When a request makes a textured model, `texture_model` is required: there is no default texture model. With `should_texture: false`, Meshy ignores it, and Text to 3D requests with `mode` ignore it too. Before the first create request, find out what the user will make. A game character, a product render and a 3D print each need a different pair. If the user hasn't said, ask one short question, then pick the pair from the "Choose by project" table on the Models page (https://docs.meshy.ai/api/v2/models.md). When you write integration code instead of making a model, keep `ai_model` and `texture_model` as settings, and note which pair fits which use case. - Leave `ai_model` out, or send `latest`, for the newest standard model (currently Meshy 7.1). Pair it with `texture_model: "meshy-7"`. - For a game character to rig and animate, other low-poly game assets, or any model with a face-count budget, whether the user says so or the prompt does, send `meshy-t2.5` (or `meshy-smart-topology-latest`) with `target_polycount` on Text to 3D or Image to 3D, and `texture_model: "meshy-n1"`. Send `meshy-t2` when speed matters more than detail. Smart Topology models make triangles only. Don't remesh a `meshy-7.1` mesh down to a face count with `should_remesh` and `target_polycount` for these. - For the finest geometry detail, add `geometry_resolution: "2k"` or `"4k"` with `meshy-7.1` or `latest` (+5 credits). Multi-Image to 3D takes `2k` only. A `4k` mesh can reach about 10 million faces. - For the cheapest drafts, send `ai_model: "meshy-6-lite"` with `texture_model: "meshy-6-lite"`. The mesh costs 5 credits and the texture is 2K only. - For several reference images (2 to 4, front view first), use Multi-Image to 3D. Geometry takes `meshy-7.1`, `meshy-6` or `meshy-6-lite`. Texture takes `meshy-7` or `meshy-n1`. - `target_polycount` is 100 to 30,000 for `meshy-t2.5` (default 15,000) and 100 to 15,000 for `meshy-t2` (default 4,000). Smart Topology models make triangles only, so `topology: "quad"` returns `400`. `meshy-n1` textures models with up to 7,999,999 triangles. - Texture models: `meshy-7` for PBR maps, 4K or 8K, or a text prompt; `meshy-n1` for clean, stylized color from reference images only (2K base color, no PBR, no text prompt); `meshy-6-lite` for the lowest cost (2K). Image to 3D and Text to 3D take all three with every `ai_model`. On Text to 3D, `meshy-n1` with `meshy-6` or `meshy-6-lite` needs `texture_image_url`. Multi-Image to 3D takes `meshy-7` or `meshy-n1`. Pairs and options: https://docs.meshy.ai/api/v2/image-to-3d.md - An option the chosen texture model doesn't support (for example `enable_pbr: true` with `meshy-n1`) returns `400`. The texture model doesn't change the price: a textured task costs the mesh-only price plus the Retexture price at that texture resolution. - `latest`, `meshy-standard-latest` and `meshy-smart-topology-latest` move to a newer model when one comes out. For results that stay the same, send a fixed name such as `meshy-7.1` or `meshy-t2.5`. `texture_model` takes a fixed name only. On Retexture, `texture_model` is required and takes `meshy-7`, `meshy-n1` or `meshy-6-lite`. Send `meshy-n1` for a 2K base color texture from one to four reference images, for 10 credits, on 3D models of up to 7,999,999 faces. It takes no `texture_prompt`, no `enable_pbr: true`, and no `4k` or `8k`. With more than one image, the first is the front view. Pick the endpoint from the goal: | Goal | Endpoint | |---|---| | A 3D model from text | `POST /openapi/v2/text-to-3d` (`should_texture: false` for the mesh only) | | A 3D model from one photo | `POST /openapi/v2/image-to-3d` | | A 3D model from several photos of one object | `POST /openapi/v2/multi-image-to-3d` | | New textures on a model | `POST /openapi/v2/retexture` | | A rigged, animated character | Optional: `POST /openapi/v2/rigging/check` first (1 credit). The task's `output` says whether Meshy can rig the model and which `animation_type` to send. Then `POST /openapi/v2/rigging`, then `POST /openapi/v2/animations` with the rig task's `id` as `rig_task_id`. Rigging takes a humanoid model, or a four-legged animal with `animation_type: "quadruped"`. A quadruped rig takes only animations whose `rig_type` is `quadruped` | | Images, not a 3D model | `POST /openapi/v2/text-to-image` or `POST /openapi/v2/image-to-image` | | An object to hold or print from a photo, for example a keychain, fridge magnet or figure | Creative Lab, which isn't part of v2: https://docs.meshy.ai/api/creative-lab-keychain.md | | A bas-relief model and depth map from a photo, for 3D printing, laser engraving or CNC | `POST /openapi/v2/relief`; `variant` `high` for deeper carving, `low` (the default) for shallow; optional `size_mm`; `should_generate_model: false` for the depth map only; 20 credits | | A model checked and fixed for 3D printing | `POST /openapi/v2/print/analyze`, then `POST /openapi/v2/print/repair` | | Your credit balance | `GET /openapi/v2/balance` | Credits for every task: https://docs.meshy.ai/api/pricing.md ### 9. Common Mistakes to Avoid 1. **Reading the result from the create response.** It only has the task: poll `GET /openapi/v2/tasks/{id}` or stream it. 2. **Using v1 read routes or v1 field names.** v1 puts results at the top level (`model_urls`, `result`); v2 puts them in `output` and your request in `input`. 3. **Polling without waiting.** Honor `Retry-After`. Polls count toward your rate limit. 4. **Resending a create after a timeout.** Each create is a new task and costs credits again. List recent tasks with `GET /openapi/v2/tasks?type=` to find the one you created. 5. **Downloading too late.** Links stop working at `expires_at`. 6. **Using Text to Image or Image to Image for a physical object.** They return images. A 3D model from a photo is Image to 3D. A keychain, magnet, figure, lamp or keycap from a photo is a Creative Lab task. 7. **Sending both `texture_prompt` and `texture_image_url`.** A request with both returns `400` with the code `parameters_conflict`. Send only one of them. ### 10. Complete Code Examples Text to 3D in one call: create the task, get it on the Tasks route until it finishes, then download the model. ```python import os import time import requests API = "https://api.meshy.ai/openapi/v2" headers = {"Authorization": f"Bearer {os.environ['MESHY_API_KEY']}"} # 1. Create a textured model in one task response = requests.post( f"{API}/text-to-3d", headers=headers, json={"prompt": "a small wooden treasure chest with iron bands", "texture_model": "meshy-7"}, timeout=60, ) response.raise_for_status() task = response.json() # 2. Get the task on the Tasks route until it finishes while task["status"] not in ("SUCCEEDED", "FAILED", "CANCELED"): time.sleep(int(response.headers.get("Retry-After", 5))) response = requests.get(f"{API}/tasks/{task['id']}", headers=headers, timeout=30) response.raise_for_status() task = response.json() # 3. Download the model if task["status"] != "SUCCEEDED": error = task["task_error"] or {} raise SystemExit(f"Task {task['status']}: {error.get('message') or 'unknown error'}") file = requests.get(task["output"]["model_urls"]["glb"], timeout=300) file.raise_for_status() with open("model.glb", "wb") as f: f.write(file.content) ``` Image to 3D works the same way. Only the create request changes: ```python response = requests.post( f"{API}/image-to-3d", headers=headers, json={"image_url": "https://docs.meshy.ai/images/api/quick-start/source-photo.webp", "texture_model": "meshy-7"}, timeout=60, ) ``` The same loop on `GET /openapi/v2/tasks/{id}` reads every task type. JavaScript versions of these steps: https://docs.meshy.ai/api/v2/quick-start.md --- # API v2 Reference # Meshy API v2 documentation Source: https://docs.meshy.ai/api/v2 # Meshy API v2 documentation Generate and process 3D models, textures, animations, and images from your own code with Meshy API v2. > **Note:** API v2 gives every task type one response shape, one set of task routes, and one error format. New to the API? Start with the [v2 Quickstart](https://docs.meshy.ai/api/v2/quick-start.md). Using v1 today? See [Migrate to API v2](/api/migrate-to-v2). --- ## Overview The Meshy API is a REST API with predictable, resource-oriented URLs. It accepts JSON request bodies (`Content-Type: application/json`), returns JSON responses, and uses standard HTTP methods, status codes, and authentication. You create tasks with it and get their results in your own app. Every endpoint is under this base URL: **BASE URL** ``` https://api.meshy.ai ``` Every v2 endpoint is under `/openapi/v2/`, for example `https://api.meshy.ai/openapi/v2/text-to-3d`. ### How to use these docs Each endpoint has its own page, and the sidebar lists the main pages. To find a page, search the docs or press `Ctrl+K` or `Cmd+K`. ### Get started To make your first request, follow the [Quickstart](https://docs.meshy.ai/api/v2/quick-start.md). To try endpoints without writing code, track usage, and manage webhooks, use the [Developer Platform](/api/developer-platform). --- ## OpenAPI specification Meshy publishes a machine-readable [OpenAPI 3.1](https://spec.openapis.org/oas/v3.1.0) spec of API v2. Use it to generate clients, import the API into your tools, or compare versions for changes. The spec comes in two formats: - YAML: [`https://docs.meshy.ai/api/v2/openapi.yaml`](https://docs.meshy.ai/api/v2/openapi.yaml) - JSON: [`https://docs.meshy.ai/api/v2/openapi.json`](https://docs.meshy.ai/api/v2/openapi.json) --- ## For AI agents Coding agents can read the v2 docs as plain text: - [`/api/v2/llms.txt`](https://docs.meshy.ai/api/v2/llms.txt): an index of every v2 page, with instructions for writing v2 code. - [`/api/v2/llms-full.txt`](https://docs.meshy.ai/api/v2/llms-full.txt): every v2 page in one file. - [`/api/v2/openapi.yaml`](https://docs.meshy.ai/api/v2/openapi.yaml) ([JSON](https://docs.meshy.ai/api/v2/openapi.json)): the OpenAPI spec for v2. - Any v2 page as Markdown: add `.md` to its URL, for example [`/api/v2/tasks.md`](https://docs.meshy.ai/api/v2/tasks.md). --- ## Resources For help with the API, see the following resources: - [Help Center](https://help.meshy.ai/en/): how to use Meshy, and answers to common questions about the API and plugins. - [Developer Platform](https://www.meshy.ai/developers): your API keys, usage, and webhooks. - [Community](https://discord.com/invite/KgD5yVM9Y4): help from other users and developers. - [Contact](mailto:support@meshy.ai): email your questions about the Meshy API and plugins. --- # Quickstart Source: https://docs.meshy.ai/api/v2/quick-start # Quickstart > **Start by creating your API key:** Every request in this guide needs one. Creating a key takes seconds. > > [Create your API key](https://www.meshy.ai/developers/keys) Make your first 3D model with Meshy API v2 in four steps. You get an API key, create a task, follow it on the Tasks route, and download the result. > **Note:** Moving from v1? See [Migrate to API v2](/api/migrate-to-v2) instead. --- ## 1. Get your API key [Create an API key](https://www.meshy.ai/developers/keys) on the **API Keys** page of the [Developer Platform](https://www.meshy.ai/developers). You can't view the key again after you leave that screen, so store it somewhere safe. Send it in every request as a `Bearer` token in the `Authorization` header. See [Authentication](/api/authentication). You need a paid plan to create and manage API keys. On the Free plan, you can't create keys of your own, and the Playground uses a built-in key for testing. ![Open the API Keys page in the Developer Platform, then create your key](/images/api/quick-start/api-key-settings.webp) Store the key in an environment variable instead of pasting it into your code. Run this in your terminal: **Export your key** ```bash export MESHY_API_KEY="" ``` The JavaScript examples use `fetch`, which is built into Node.js 18 and later. The Python examples use [`requests`](https://pypi.org/project/requests/) (`pip install requests`). --- ## 2. Create an Image to 3D task Send an image to [Image to 3D](https://docs.meshy.ai/api/v2/image-to-3d.md). To start from a text prompt or several photos instead, use [Text to 3D](https://docs.meshy.ai/api/v2/text-to-3d.md) or [Multi-Image to 3D](https://docs.meshy.ai/api/v2/multi-image-to-3d.md). Every endpoint works the same way from here. The following examples all use this photo and texture the model with Meshy 7, which `texture_model` picks. To try another image, change `image_url`. To pick another texture model, see [Texture models](https://docs.meshy.ai/api/v2/image-to-3d.md#texture-models). ![Sample fantasy character illustration used as the Image to 3D input in this guide](https://docs.meshy.ai/images/api/quick-start/source-photo.webp) **cURL** ```bash curl https://api.meshy.ai/openapi/v2/image-to-3d \ -X POST \ -H "Authorization: Bearer ${MESHY_API_KEY}" \ -H "Content-Type: application/json" \ -d '{ "image_url": "https://docs.meshy.ai/images/api/quick-start/source-photo.webp", "texture_model": "meshy-7" }' ``` ```javascript const headers = { Authorization: `Bearer ${process.env.MESHY_API_KEY}`, "Content-Type": "application/json", }; const res = await fetch("https://api.meshy.ai/openapi/v2/image-to-3d", { method: "POST", headers, body: JSON.stringify({ image_url: "https://docs.meshy.ai/images/api/quick-start/source-photo.webp", texture_model: "meshy-7", }), }); if (!res.ok) throw new Error(`${res.status}: ${(await res.json()).message}`); const task = await res.json(); console.log("Task created:", task.id); ``` ```python import os import requests headers = {"Authorization": f"Bearer {os.environ['MESHY_API_KEY']}"} response = requests.post( "https://api.meshy.ai/openapi/v2/image-to-3d", headers=headers, json={"image_url": "https://docs.meshy.ai/images/api/quick-start/source-photo.webp", "texture_model": "meshy-7"}, ) response.raise_for_status() task = response.json() print("Task created:", task["id"]) ``` The response is `202 Accepted` with the [task object](https://docs.meshy.ai/api/v2/tasks.md#the-task-object). Keep its `id`, because every next step needs it. The `Location` header gives the path to read the task from. **Response: 202 Accepted** ```json { "id": "018a210d-8ba4-705c-b111-1f1776f7f578", "type": "image-to-3d", "status": "PENDING", "progress": 0, "created_at": 1791846275575, "started_at": null, "finished_at": null, "expires_at": null, "preceding_tasks": 1, "consumed_credits": 30, "task_error": null, "input": { "image_url": "https://docs.meshy.ai/images/api/quick-start/source-photo.webp", "texture_model": "meshy-7" }, "output": null } ``` --- ## 3. Get the task until it finishes The task runs in the background and usually takes about 2 minutes. Get it from `/openapi/v2/tasks/` until `status` is `SUCCEEDED`, `FAILED`, or `CANCELED`. Between requests, wait the number of seconds in the `Retry-After` header. The same route works for tasks from every endpoint. For typical processing times, and how long to wait before you give up, see [Processing times](/api/task-lifecycle#processing-times) and [How long to wait](/api/task-lifecycle#how-long-to-wait). **cURL** ```bash curl https://api.meshy.ai/openapi/v2/tasks/ \ -H "Authorization: Bearer ${MESHY_API_KEY}" ``` ```javascript let current; while (true) { const res = await fetch(`https://api.meshy.ai/openapi/v2/tasks/${task.id}`, { headers }); if (!res.ok) throw new Error(`${res.status}: ${(await res.json()).message}`); current = await res.json(); if (["SUCCEEDED", "FAILED", "CANCELED"].includes(current.status)) break; console.log(current.status, current.progress); const waitSeconds = Number(res.headers.get("retry-after")) || 5; await new Promise((resolve) => setTimeout(resolve, waitSeconds * 1000)); } ``` ```python import time while True: response = requests.get( f"https://api.meshy.ai/openapi/v2/tasks/{task['id']}", headers=headers, ) response.raise_for_status() current = response.json() if current["status"] in ("SUCCEEDED", "FAILED", "CANCELED"): break print(current["status"], current["progress"]) time.sleep(int(response.headers.get("Retry-After", 5))) ``` **Response: SUCCEEDED** ```json { "id": "018a210d-8ba4-705c-b111-1f1776f7f578", "type": "image-to-3d", "status": "SUCCEEDED", "progress": 100, "created_at": 1791846275575, "started_at": 1791846275578, "finished_at": 1791846334536, "expires_at": 1792105534536, "preceding_tasks": 0, "consumed_credits": 30, "task_error": null, "input": { "image_url": "https://docs.meshy.ai/images/api/quick-start/source-photo.webp", "texture_model": "meshy-7" }, "output": { "model_urls": { "glb": "https://assets.meshy.ai/***/tasks/018a210d-8ba4-705c-b111-1f1776f7f578/output/model.glb?Expires=***" }, "thumbnail_url": "https://assets.meshy.ai/***/tasks/018a210d-8ba4-705c-b111-1f1776f7f578/output/preview.png?Expires=***", "thumbnail_urls": null, "texture_urls": [ { "base_color": "https://assets.meshy.ai/***/tasks/018a210d-8ba4-705c-b111-1f1776f7f578/output/texture_0.png?Expires=***", "metallic": null, "roughness": null, "normal": null, "metallic_roughness": null, "emission": null } ] } } ``` If the task fails, `status` is `FAILED`, and `task_error` says why. Fix the input or create another task. See [Errors](https://docs.meshy.ai/api/v2/errors.md#task-errors). > **Note:** To get notified when the task finishes instead of polling, [stream the task](https://docs.meshy.ai/api/v2/tasks.md#stream-a-task) or use a [webhook](https://docs.meshy.ai/api/v2/webhooks.md). --- ## 4. Download your model The files are in `output`. `output.model_urls.glb` is a signed URL that works until `expires_at`. You can also paste it into your browser to download the file. Image to 3D returns only a GLB file, unless you list other formats in `target_formats` when you create the task. **cURL** ```bash curl -L "" -o model.glb ``` ```javascript const file = await fetch(current.output.model_urls.glb); await writeFile("model.glb", Buffer.from(await file.arrayBuffer())); ``` ```python file = requests.get(current["output"]["model_urls"]["glb"]) file.raise_for_status() with open("model.glb", "wb") as f: f.write(file.content) ``` ![The resulting 3D model generated from the sample fantasy character photo](/images/api/quick-start/image-to-3d-output.webp) > **Note:** On every plan except Enterprise, Meshy keeps the files for 3 days. Download the files you need before then. See [Asset retention](https://docs.meshy.ai/api/v2/asset-retention.md). --- ## Put it all together This script creates the task, waits for it to finish, and downloads the model. ```javascript const API = "https://api.meshy.ai/openapi/v2"; const headers = { Authorization: `Bearer ${process.env.MESHY_API_KEY}`, "Content-Type": "application/json", }; async function call(path, init = {}) { const res = await fetch(`${API}${path}`, { ...init, headers, signal: AbortSignal.timeout(init.method === "POST" ? 60_000 : 30_000), }); if (!res.ok) throw new Error(`${res.status}: ${(await res.json()).message}`); return { body: await res.json(), retryAfter: Number(res.headers.get("retry-after")) || 5 }; } // 1. Create the task let { body: task, retryAfter } = await call("/image-to-3d", { method: "POST", body: JSON.stringify({ image_url: "https://docs.meshy.ai/images/api/quick-start/source-photo.webp", texture_model: "meshy-7", }), }); // 2. Get the task until it finishes, for up to 60 minutes const deadline = task.created_at + 60 * 60 * 1000; while (!["SUCCEEDED", "FAILED", "CANCELED"].includes(task.status)) { if (Date.now() > deadline) { // The task is still running. Check it again later with the same ID instead of creating a new one. throw new Error(`Task ${task.id} is still ${task.status}; check it again later`); } await new Promise((resolve) => setTimeout(resolve, retryAfter * 1000)); ({ body: task, retryAfter } = await call(`/tasks/${task.id}`)); } // 3. Download the model (only if the task succeeded) if (task.status !== "SUCCEEDED") { throw new Error(`Task ${task.status}: ${task.task_error?.message ?? "unknown error"}`); } const file = await fetch(task.output.model_urls.glb); await writeFile("model.glb", Buffer.from(await file.arrayBuffer())); console.log("Saved model.glb"); ``` ```python import os import time import requests API = "https://api.meshy.ai/openapi/v2" headers = {"Authorization": f"Bearer {os.environ['MESHY_API_KEY']}"} # 1. Create the task response = requests.post( f"{API}/image-to-3d", headers=headers, json={"image_url": "https://docs.meshy.ai/images/api/quick-start/source-photo.webp", "texture_model": "meshy-7"}, timeout=60, ) response.raise_for_status() task = response.json() # 2. Get the task until it finishes, for up to 60 minutes deadline = task["created_at"] / 1000 + 60 * 60 while task["status"] not in ("SUCCEEDED", "FAILED", "CANCELED"): if time.time() > deadline: # The task is still running. Check it again later with the same ID instead of creating a new one. raise SystemExit(f"Task {task['id']} is still {task['status']}; check it again later") time.sleep(int(response.headers.get("Retry-After", 5))) response = requests.get(f"{API}/tasks/{task['id']}", headers=headers, timeout=30) response.raise_for_status() task = response.json() # 3. Download the model (only if the task succeeded) if task["status"] != "SUCCEEDED": error = task["task_error"] or {} raise SystemExit(f"Task {task['status']}: {error.get('message') or 'unknown error'}") file = requests.get(task["output"]["model_urls"]["glb"], timeout=300) file.raise_for_status() with open("model.glb", "wb") as f: f.write(file.content) print("Saved model.glb") ``` --- ## Explore common workflows - [Game-ready character](https://docs.meshy.ai/api/v2/rigging.md): Rig a humanoid model with a skeleton so it's ready to animate in Unity or Unreal. - [Smart Topology mesh](https://docs.meshy.ai/api/v2/image-to-3d.md): Set `ai_model` to `meshy-smart-topology-latest` on Image to 3D for a clean, game-ready triangle mesh. - [3D print model](https://docs.meshy.ai/api/v2/multi-color-print.md): Turn a finished model into a multi-color 3MF file, ready to slice and print. --- ## Next steps - Learn the [task object and the Tasks routes](https://docs.meshy.ai/api/v2/tasks.md) that every endpoint shares. - Browse every endpoint in the [API v2 overview](https://docs.meshy.ai/api/v2.md). - Check [Pricing](/api/pricing), [Rate limits](https://docs.meshy.ai/api/v2/rate-limits.md), and [Errors](https://docs.meshy.ai/api/v2/errors.md) before you go to production. - Prefer a UI? The [Developer Platform](/api/developer-platform) lets you run requests in the Playground, track usage and request logs, and manage webhooks. - Follow step-by-step recipes in the [Cookbook](https://www.meshy.ai/developers/cookbook/), and read tutorials on the [Developer Blog](https://www.meshy.ai/developers/blog/). - Have feedback or a problem? Join the Meshy [Discord](https://discord.com/invite/KgD5yVM9Y4) community. --- # Models Source: https://docs.meshy.ai/api/v2/models # Models Compare Meshy's geometry and texture models on the same input, and choose a pair for your project. Meshy makes a 3D model with two AI models. A geometry model builds the mesh, and a texture model paints it. You choose the geometry model with `ai_model` and the texture model with `texture_model`, so you can pair them to suit your project. Every example on this page started from the same input image and the default settings, so the model is the only difference between them. --- ## Choose by project The following table suggests a geometry model and a texture model for common projects. | Project | Geometry model | Texture model | Why | | --- | --- | --- | --- | | A detailed hero asset, such as a product render or a cinematic prop | `meshy-7.1` | `meshy-7` | Meshy 7.1 makes a dense, detailed mesh, and Meshy 7 adds PBR maps at up to 8K. | | A game character to rig and animate | `meshy-t2.5` | `meshy-n1` | Meshy T2.5 makes a clean triangle mesh at the face count you set, and Meshy N1 paints clean color with few seams. | | Many props for a game scene, or user-generated content | `meshy-t2` | `meshy-n1` | The faster Smart Topology model, with 4,000 faces by default and separate parts. | | A real object from 2 to 4 photos | `meshy-7.1` on [Multi-Image to 3D](https://docs.meshy.ai/api/v2/multi-image-to-3d.md) | `meshy-7` | Both models read every photo, so the sides and the back match the object. | | A model to 3D print | `meshy-7.1` | None, or `meshy-7` to print in color | The printer prints the mesh. Meshy 7 separates colors well for [Multi-Color Print](https://docs.meshy.ai/api/v2/multi-color-print.md). | | Many drafts at a low cost | `meshy-6-lite` | `meshy-6-lite` | The mesh costs 5 credits and the texture 10. | --- ## Geometry models Meshy has two kinds of geometry models: - **Standard models** make a dense, detailed mesh that follows the input closely. - **Smart Topology models** make a clean, low-poly triangle mesh at the face count you set with `target_polycount`. ### Standard models The following comparison shows the mesh that each standard model made from the same image, without a texture. Drag any model to turn all of them. To zoom, hold ⌘ or Ctrl and scroll. The following table compares the standard models. | | Meshy 7.1 | Meshy 6 | Meshy 6 Lite | | --- | --- | --- | --- | | Model ID | `meshy-7.1`, `latest`, or `meshy-standard-latest` | `meshy-6` | `meshy-6-lite` | | Strengths | Fine detail built as real geometry, with the shape aligned closely to the input | Clean hard surfaces and smooth organic shapes | Quality close to Meshy 6, in less time and at a quarter of the cost | | Faces in the example | 890,226 | 678,776 | 30,513 | | Mesh only, typical time | 75 s | 90 s | 40 s | | Higher geometry resolution | `geometry_resolution`: `2k` or `4k` | Not supported | Not supported | | Multi-Image to 3D | Supported | Supported | Supported | | Remeshed by default | No | No | Yes, to 30,000 faces | | Credits for the mesh | 20 | 20 | 5 | The typical times are medians for Image to 3D. For other endpoints and options, see [Task lifecycle](/api/task-lifecycle#processing-times). Meshy 7.1 puts faces where the detail is: many where the surface has fine detail, few where it's flat. Its face count depends on the input, so the count in the example is one result, not a fixed size. `geometry_resolution: "4k"` makes the finest detail, for hero assets and close-up renders. A `4k` mesh can reach about 10 million faces and 490 MB, which is more than most 3D printing and modeling tools handle well. `4k` works on Image to 3D and Text to 3D, not on Multi-Image to 3D. ### Smart Topology models The following comparison shows the Smart Topology meshes from the same image, with the Meshy 7.1 mesh for comparison. Wireframe view shows the faces. You set the face count with `target_polycount`. The following images show the Meshy T2.5 mesh at four values, from the same image. The following table compares the Smart Topology models. | | Meshy T2.5 | Meshy T2 | | --- | --- | --- | | Model ID | `meshy-t2.5`, or `meshy-smart-topology-latest` | `meshy-t2` | | Strengths | Sharper detail, and a shape closer to the input image than Meshy T2 | Faster generation, with the model's parts kept separate | | `target_polycount` | `100` to `30000`, default `15000` | `100` to `15000`, default `4000` | | Faces in the example | 15,721 | 4,353 | | Mesh only, typical time | 15 s | 4 s | | Face type | Triangles only | Triangles only | | Input | One image, or a text prompt | One image, or a text prompt | | Credits for the mesh | 5 | 5 | Smart Topology models make triangles only, so `topology: "quad"` returns `400`. To get quads, use a standard model and remesh it. See [Remesh](https://docs.meshy.ai/api/v2/remesh.md). --- ## Texture models The following comparison shows the same Meshy T2.5 mesh, painted by each texture model from the same image. Select Base color only to turn off the lights and see the painted color itself, including any shadows and highlights painted into it. Meshy 7 and Meshy 6 Lite also make PBR maps when you send `enable_pbr: true`. The following maps are the ones Meshy 7 made for the same model. The following table compares the texture models. | | Meshy 7 | Meshy N1 | Meshy 6 Lite | | --- | --- | --- | --- | | Model ID | `meshy-7` | `meshy-n1` | `meshy-6-lite` | | Best for | Realistic and detailed assets, PBR materials, and close-up renders | Stylized and low-poly game assets | Drafts and fast iteration | | Texture resolution | 2K, 4K, or 8K | 2K | 2K | | PBR maps | Supported | Not supported: base color only | Supported | | Text prompt | Supported | Not supported: reference images only | Supported | | Reference images | 1 to 4 | 1 to 4 | 1 | | Quad remesh (`topology: "quad"`) | Supported | Not supported | Supported | | Typical time at 2K | 40 s | 20 s | 35 s | | Credits | 10, or 15 at 8K | 10 | 10 | A request that asks a texture model for something it doesn't support returns `400`, for example a text prompt with Meshy N1 or a `4k` texture with Meshy 6 Lite. The credits are the texture's price on its own, the same as a [Retexture](https://docs.meshy.ai/api/v2/retexture.md) task. On Image to 3D, Multi-Image to 3D, and Text to 3D, a textured task costs the mesh plus the texture at that resolution, whichever texture model you pick. See [Pricing](/api/pricing#api-pricing). Meshy N1 generates color directly on the model instead of blending 2D views, so its textures have few seams and their colors follow the mesh. Text, patterns, and faces come out softer than with Meshy 7, so use Meshy 7 for photorealistic assets, fine detail, or PBR maps. Meshy 7 makes 8K textures natively, not by upscaling. Use 8K for close-up cinematics and hero assets. For assets in a real-time engine, 2K or 4K is usually enough. --- ## Multi-view Send 2 to 4 images of the same object to show the model the sides that one image can't. Send the front view first. The other views can be in any order. The views must show the same object in the same colors. When views disagree, the result is unpredictable. ### Multi-view geometry [Multi-Image to 3D](https://docs.meshy.ai/api/v2/multi-image-to-3d.md) builds the mesh from every image. In the following example, Meshy 7.1 built an explorer from the front image alone and from all three images. From the front alone, the back of the backpack is a guess. Meshy 7.1, Meshy 6, and Meshy 6 Lite take 1 to 4 images. Smart Topology models take one image. ### Multi-view texture Meshy 7 and Meshy N1 paint from 1 to 4 reference images. In the following example, both painted the same mesh from the front image alone and from all three images. With the front alone, both guessed the backpack's colors and patch. With all three, both match the back view. To send several reference images, use one of the following: - `texture_image_urls` on [Multi-Image to 3D](https://docs.meshy.ai/api/v2/multi-image-to-3d.md) - `multiview_image_urls` on [Retexture](https://docs.meshy.ai/api/v2/retexture.md) Meshy 6 Lite takes one reference image, so `texture_model` on Multi-Image to 3D takes only `meshy-7` and `meshy-n1`. --- ## Every pair The following grid shows the result of every pair of geometry and texture models on three inputs. Select a pair to see its result. Recommended marks the pair that Meshy recommends for each geometry model, as in [Choose by project](#choose-by-project). --- ## Set the models in a request The following table shows the parameters that set the models on each endpoint. | Endpoint | Geometry model | Texture model | | --- | --- | --- | | [Image to 3D](https://docs.meshy.ai/api/v2/image-to-3d.md) | `ai_model` | `texture_model`: `meshy-7`, `meshy-n1`, or `meshy-6-lite` | | [Multi-Image to 3D](https://docs.meshy.ai/api/v2/multi-image-to-3d.md) | `ai_model` | `texture_model`: `meshy-7` or `meshy-n1` | | [Text to 3D](https://docs.meshy.ai/api/v2/text-to-3d.md) | `ai_model` | `texture_model`: `meshy-7`, `meshy-n1`, or `meshy-6-lite` | | [Retexture](https://docs.meshy.ai/api/v2/retexture.md) | None: you send a model you already have | `texture_model`: `meshy-7`, `meshy-n1`, or `meshy-6-lite` | For example, the following Image to 3D request makes a game character with Meshy T2.5 and paints it with Meshy N1: ```json { "image_url": "https://example.com/character.png", "ai_model": "meshy-t2.5", "target_polycount": 15000, "texture_model": "meshy-n1" } ``` `texture_model` has no default. A request that makes a textured model without it returns `400`. To get the mesh only, send `"should_texture": false` instead. For the texture models each `ai_model` takes, and the options each texture model supports, see [Texture models](https://docs.meshy.ai/api/v2/image-to-3d.md#texture-models). --- # Tasks Source: https://docs.meshy.ai/api/v2/tasks # Tasks Get, list, stream, and delete every v2 task through four routes under `/openapi/v2/tasks`. Every v2 endpoint that creates a task returns the same task object. > **Note:** Moving from v1? The main changes for reading tasks: > * The routes on this page replace the per-endpoint read routes, such as `GET /openapi/v1/image-to-3d/{id}`. > * Results are in `output`. > > See [Task reads in the migration reference](/api/migrate-to-v2/reference#reading-tasks). --- ## How a task runs A create request returns the [task object](#the-task-object) right away, without waiting for the result. The task then runs in the background and moves through these statuses: `PENDING` -> `IN_PROGRESS` -> `SUCCEEDED` | `FAILED` - `PENDING`: Waiting in the queue - `IN_PROGRESS`: Generating the result - `SUCCEEDED`: Download the files in `output` - `FAILED`: Credits refunded This table shows what your code should do in each status. | Status | What your code should do | | --- | --- | | `PENDING` | Keep waiting. `preceding_tasks` is the task's position in the queue, and `1` means it starts next. | | `IN_PROGRESS` | Keep waiting. `progress` says how much of the work is done. | | `SUCCEEDED` | Download the files in `output` before `expires_at`. | | `FAILED` | Read `task_error`, then fix the input or create another task. See [Errors](https://docs.meshy.ai/api/v2/errors.md#task-errors). | | `CANCELED` | Stop waiting. The task doesn't produce a result. No v2 task type uses this status, but treat it as final. | To follow a task, use one of these: - [Get the task](#get-a-task) until it finishes. - [Stream the task](#stream-a-task). - Receive a [webhook](https://docs.meshy.ai/api/v2/webhooks.md). From your code, getting the task until it finishes looks like this: Create a task, then get it from the Tasks route until it finishes. 1. `POST /openapi/v2/image-to-3d` returns `202 {"id": "", "status": "PENDING"}` with `Location: /openapi/v2/tasks/` (task created). 2. Repeat after `Retry-After` seconds: `GET /openapi/v2/tasks/` returns `200 {"status": "IN_PROGRESS", "progress": 45}` with `Retry-After: 5`. 3. A later `GET /openapi/v2/tasks/` returns `200 {"status": "SUCCEEDED", "output": {"model_urls": {"glb": "..."}}}`. Every endpoint works this way. If your app stops waiting, the task keeps running. Get it later with the same task ID. Two response headers help you follow a task: - `Location`: the path to read the task from, `/openapi/v2/tasks/{id}`. It's on the create response. - `Retry-After`: how many seconds to wait before you poll again. It's on the create response, and on every read of a `PENDING` or `IN_PROGRESS` task. The value is a hint, and it's shorter when the task is about to start or finish. A task that's already finished gets no `Retry-After`, for example when Analyze Printability returns a cached result right away. If the header is missing, wait 5 seconds. Polls count toward your [rate limit](https://docs.meshy.ai/api/v2/rate-limits.md). For typical processing times, and how long your code should wait before it gives up, see [Processing times](/api/task-lifecycle#processing-times). The task keeps running even if your code stops waiting. To get notified instead of polling, use a webhook with Payload version set to v2 on the [Webhooks page](https://www.meshy.ai/developers/webhooks). Each delivery carries the [task object](#the-task-object), with the header `Meshy-Webhook-Version: v2`. See [Webhooks](https://docs.meshy.ai/api/v2/webhooks.md). --- ## The task object The create response, every read route on this page, and each v2 [webhook](https://docs.meshy.ai/api/v2/webhooks.md) delivery return this object. Only `input` and `output` depend on the [task type](#task-types). - `id` · *string* The task ID. Use it with the routes on this page. - `type` · *string* The task type, set by the endpoint that created the task. See [Task types](#task-types). Meshy adds a type for each new endpoint, so skip or log types your code doesn't handle. - `status` · *string* The task's status. See [How a task runs](#how-a-task-runs). Available values: * `PENDING`: waiting in the queue * `IN_PROGRESS`: generating the result * `SUCCEEDED`: final, with the results in `output` * `FAILED`: final, with the reason in `task_error` * `CANCELED`: final, with no result - `progress` · *integer* Percentage of the work done, from `0` to `100`. It's `100` when the task succeeds. - `created_at` · *integer* Time the task was created, in Unix milliseconds. - `started_at` · *integer | null* Time a worker started the task, in Unix milliseconds. `null` until then. - `finished_at` · *integer | null* Time the task reached a final status, in Unix milliseconds. `null` until then. - `expires_at` · *integer | null* Time the signed URLs in `output` stop working, in Unix milliseconds. It's 3 days after `finished_at`. `null` until the task succeeds. Always `null` for Text to 3D tasks, and for Enterprise plans, which keep files indefinitely. See [Asset retention](https://docs.meshy.ai/api/v2/asset-retention.md). - `preceding_tasks` · *integer* The task's position in the queue while it's `PENDING`. `1` means it starts next. `0` after the task leaves the queue, and always `0` in [list](#list-tasks) results. - `consumed_credits` · *integer | null* Number of credits charged for the task, after any refund. `0` for a failed task. `null` if Meshy couldn't read the charge. In that case, get the task again. - `task_error` · *object | null* The reason the task failed, with these fields: * `type` * `code` * `message` * `doc_url` `null` unless `status` is `FAILED`. See [Errors](https://docs.meshy.ai/api/v2/errors.md#task-errors). - `input` · *object | null* The parameters you sent to create the task, as you sent them. Meshy doesn't fill in defaults you left out, and it leaves out keys the endpoint doesn't accept. An image you sent as a data URI comes back as a signed URL to Meshy's copy, or shortened if there's no copy. A task created on v1 keeps its v1 parameter names. `null` when Meshy has no saved copy of the request. This happens for a moment right after the task is created, and for some older tasks. - `output` · *object | null* The results, shaped by `type`. `null` until the task succeeds. Each endpoint page describes its output, and [Task types](#task-types) lists the fields. Every field in the preceding list is always present: * A value that doesn't exist yet is `null`, never `0` or `""`. * Arrays are never `null`, except `dimensions_mm` in an `intended_print` object. Two task types can add one more top-level field: * [Auto Split](https://docs.meshy.ai/api/v2/auto-split.md#auto-split-output) can add `prompt_ignored`. * [Repair Printability](https://docs.meshy.ai/api/v2/repair-printability.md#repair-printability-output) adds `intended_print` to every task created on v2. Meshy can add fields at any time, so ignore fields you don't use. **A task in progress** ```json { "id": "018a210d-8ba4-705c-b111-1f1776f7f578", "type": "image-to-3d", "status": "IN_PROGRESS", "progress": 42, "created_at": 1791846275575, "started_at": 1791846275578, "finished_at": null, "expires_at": null, "preceding_tasks": 0, "consumed_credits": 30, "task_error": null, "input": { "image_url": "https://docs.meshy.ai/images/api/quick-start/source-photo.webp", "texture_model": "meshy-7" }, "output": null } ``` **A succeeded task** ```json { "id": "018a210d-8ba4-705c-b111-1f1776f7f578", "type": "image-to-3d", "status": "SUCCEEDED", "progress": 100, "created_at": 1791846275575, "started_at": 1791846275578, "finished_at": 1791846334536, "expires_at": 1792105534536, "preceding_tasks": 0, "consumed_credits": 30, "task_error": null, "input": { "image_url": "https://docs.meshy.ai/images/api/quick-start/source-photo.webp", "texture_model": "meshy-7" }, "output": { "model_urls": { "glb": "https://assets.meshy.ai/***/tasks/018a210d-8ba4-705c-b111-1f1776f7f578/output/model.glb?Expires=***" }, "thumbnail_url": "https://assets.meshy.ai/***/tasks/018a210d-8ba4-705c-b111-1f1776f7f578/output/preview.png?Expires=***", "thumbnail_urls": null, "texture_urls": [ { "base_color": "https://assets.meshy.ai/***/tasks/018a210d-8ba4-705c-b111-1f1776f7f578/output/texture_0.png?Expires=***", "metallic": null, "roughness": null, "normal": null, "metallic_roughness": null, "emission": null } ] } } ``` **A failed task** ```json { "id": "018a210d-8ba4-705c-b111-1f1776f7f578", "type": "convert", "status": "FAILED", "progress": 0, "created_at": 1790911760868, "started_at": 1790911760873, "finished_at": 1790911770684, "expires_at": null, "preceding_tasks": 0, "consumed_credits": 0, "task_error": { "type": "invalid_input", "code": "invalid_input", "message": "No valid objects found in uploaded model. The file may be empty or contain no importable geometry.", "doc_url": "https://docs.meshy.ai/en/api/v2/errors#invalid-input" }, "input": { "model_url": "https://example.com/model.glb", "target_formats": ["fbx"] }, "output": null } ``` --- ## Task types The `type` field and the `type` filter on [List tasks](#list-tasks) use these values. Each endpoint page describes its `output` in full. | `type` | Created by | `output` fields | | --- | --- | --- | | `text-to-3d-preview` | [Text to 3D](https://docs.meshy.ai/api/v2/text-to-3d.md#text-to-3d-output), preview | `model_urls`, `thumbnail_url`, `alpha_thumbnail_url`, `texture_urls` | | `text-to-3d-refine` | [Text to 3D](https://docs.meshy.ai/api/v2/text-to-3d.md#text-to-3d-output), refine | `model_urls`, `thumbnail_url`, `alpha_thumbnail_url`, `texture_urls` | | `text-to-3d` | [Text to 3D](https://docs.meshy.ai/api/v2/text-to-3d.md#text-to-3d-output), in one call | `model_urls`, `thumbnail_url`, `alpha_thumbnail_url`, `texture_urls` | | `image-to-3d` | [Image to 3D](https://docs.meshy.ai/api/v2/image-to-3d.md#image-to-3d-output) | `model_urls`, `thumbnail_url`, `thumbnail_urls`, `texture_urls` | | `multi-image-to-3d` | [Multi-Image to 3D](https://docs.meshy.ai/api/v2/multi-image-to-3d.md#multi-image-to-3d-output) | `model_urls`, `thumbnail_url`, `thumbnail_urls`, `texture_urls` | | `remesh` | [Remesh](https://docs.meshy.ai/api/v2/remesh.md#remesh-output) | `model_urls`, `thumbnail_url`, `texture_urls` | | `convert` | [Convert](https://docs.meshy.ai/api/v2/convert.md#convert-output) | `model_urls`, `texture_urls` | | `resize` | [Resize](https://docs.meshy.ai/api/v2/resize.md#resize-output) | `model_urls`, `texture_urls` | | `uv-unwrap` | [UV Unwrap](https://docs.meshy.ai/api/v2/uv-unwrap.md#uv-unwrap-output) | `model_urls`, `thumbnail_url` | | `rig` | [Rigging](https://docs.meshy.ai/api/v2/rigging.md#rigging-output) | `rigged_character_glb_url`, `rigged_character_fbx_url`, `basic_animations` | | `rig-check` | [Rigging Check](https://docs.meshy.ai/api/v2/rigging-check.md#rigging-check-output) | `riggable`, `animation_type`, `animatable`, `reasons` | | `animate` | [Animation](https://docs.meshy.ai/api/v2/animation.md#animation-output) | `animation_glb_url`, `animation_fbx_url`, `processed_usdz_url`, `processed_armature_fbx_url`, `processed_animation_fps_fbx_url` | | `text-to-motion` | [Text to Motion](https://docs.meshy.ai/api/v2/text-to-motion.md#text-to-motion-output) | `motion_url`, `motion_format`, `duration_ms`, `mode` | | `retexture` | [Retexture](https://docs.meshy.ai/api/v2/retexture.md#retexture-output) | `model_urls`, `thumbnail_url`, `texture_urls` | | `text-to-image` | [Text to Image](https://docs.meshy.ai/api/v2/text-to-image.md#text-to-image-output) | `image_urls` | | `image-to-image` | [Image to Image](https://docs.meshy.ai/api/v2/image-to-image.md#image-to-image-output) | `image_urls` | | `print-multi-color` | [Multi-Color Print](https://docs.meshy.ai/api/v2/multi-color-print.md#multi-color-print-output) | `model_urls` | | `print-analyze` | [Analyze Printability](https://docs.meshy.ai/api/v2/analyze-printability.md#analyze-printability-output) | `printability` | | `print-repair` | [Repair Printability](https://docs.meshy.ai/api/v2/repair-printability.md#repair-printability-output) | `model_urls`, `thumbnail_url`, `print_repair_report` | | `print-split` | [Auto Split](https://docs.meshy.ai/api/v2/auto-split.md#auto-split-output) | `model_urls`, `thumbnail_url`, `part_count` | | `relief` | [Relief](https://docs.meshy.ai/api/v2/relief.md#relief-output) | `model_urls`, `texture_urls`, `depth_map_url`, `thumbnail_url` | A few rules hold for every type: - `model_urls` has one key per file format the task produced, such as `glb` or `fbx`. Formats the task didn't produce have no key. - Each item in `texture_urls` has all six of these maps, with `null` for a map the task didn't produce: - `base_color` - `metallic` - `roughness` - `normal` - `metallic_roughness` - `emission` - Every URL is signed and stops working at `expires_at`. Download the files you need before then. See [Asset retention](https://docs.meshy.ai/api/v2/asset-retention.md). Creative Lab tasks aren't part of API v2, so they don't appear on these routes. Read them with their own [Creative Lab](/api/creative-lab-figure) routes. --- --- ## GET /openapi/v2/tasks/:id -- Get a task Returns one task of any type, including tasks you created on v1. Creative Lab tasks aren't available here. While the task is `PENDING` or `IN_PROGRESS`, the `Retry-After` header says how many seconds to wait before you get the task again. ### Parameters - `id` · *path* · **required** The task ID from the create response. ### Returns The [task object](#the-task-object). ### Errors - `400 - Bad Request` The ID isn't a valid task ID (`request_invalid`). Send the `id` from the create response. - `404 - Not Found` No task with this ID belongs to your account (`task_not_found`). Deleted tasks, tasks past their [retention period](https://docs.meshy.ai/api/v2/asset-retention.md), and Creative Lab tasks also return `404`. Check the ID, and use an API key from the account that created the task. **cURL** ```bash # Get one task by its ID curl https://api.meshy.ai/openapi/v2/tasks/018a210d-8ba4-705c-b111-1f1776f7f578 \ -H "Authorization: Bearer ${MESHY_API_KEY}" ``` ```javascript // Get one task by its ID const res = await fetch( "https://api.meshy.ai/openapi/v2/tasks/018a210d-8ba4-705c-b111-1f1776f7f578", { headers: { Authorization: `Bearer ${process.env.MESHY_API_KEY}` } }, ); if (!res.ok) throw new Error(`${res.status}: ${(await res.json()).message}`); const task = await res.json(); console.log(task.status, task.progress); ``` ```python # Get one task by its ID import os import requests response = requests.get( "https://api.meshy.ai/openapi/v2/tasks/018a210d-8ba4-705c-b111-1f1776f7f578", headers={"Authorization": f"Bearer {os.environ['MESHY_API_KEY']}"}, ) response.raise_for_status() task = response.json() print(task["status"], task["progress"]) ``` **Response headers** ```text HTTP/2 200 Content-Type: application/json; charset=utf-8 Retry-After: 5 ``` --- ## GET /openapi/v2/tasks -- List tasks Returns your tasks, newest first by default. ### Parameters - `type` · *string* The [task type](#task-types) to list. `text-to-3d` matches all three Text to 3D types. Leave it out to list tasks of every type. - `page_num` · *integer* · default: `1` The page to return, from `1` to `255`. `0` returns the first page. A value outside `0` to `255` returns `400`. - `page_size` · *integer* · default: `10` Number of tasks per page, up to `100`. A value from `101` to `255` returns 100 tasks, and `0` uses the default. A value outside `0` to `255` returns `400`. - `sort_by` · *string* · default: `-created_at` The sort order. Available values: * `-created_at`: newest first * `+created_at`: oldest first ### Returns An object with two fields: - `data` · *array* The tasks on this page, each a full [task object](#the-task-object). An empty array, never `null`, when there are none. - `has_more` · *boolean* Whether there's another page. If `true`, request the next page with `page_num` plus one. `false` on the last page. The response has no total count. ### Errors - `400 - Bad Request` One of these query parameters is invalid: * `type` isn't a known [task type](#task-types). The message lists the valid values. * `page_num` or `page_size` isn't a whole number from `0` to `255`. * `sort_by` isn't `-created_at` or `+created_at`. Fix the parameter, then send the request again. **cURL** ```bash # List your two newest Image to 3D tasks curl "https://api.meshy.ai/openapi/v2/tasks?type=image-to-3d&page_size=2" \ -H "Authorization: Bearer ${MESHY_API_KEY}" ``` ```javascript // List your two newest Image to 3D tasks const params = new URLSearchParams({ type: "image-to-3d", page_size: "2" }); const res = await fetch(`https://api.meshy.ai/openapi/v2/tasks?${params}`, { headers: { Authorization: `Bearer ${process.env.MESHY_API_KEY}` }, }); if (!res.ok) throw new Error(`${res.status}: ${(await res.json()).message}`); const { data, has_more } = await res.json(); for (const task of data) console.log(task.id, task.status); ``` ```python # List your two newest Image to 3D tasks import os import requests response = requests.get( "https://api.meshy.ai/openapi/v2/tasks", headers={"Authorization": f"Bearer {os.environ['MESHY_API_KEY']}"}, params={"type": "image-to-3d", "page_size": 2}, ) response.raise_for_status() page = response.json() for task in page["data"]: print(task["id"], task["status"]) ``` **Response (task objects shortened)** ```json { "data": [ { "id": "018a210d-8ba4-705c-b111-1f1776f7f578", "type": "image-to-3d", "status": "SUCCEEDED", "progress": 100, "...": "..." }, { "id": "018a2110-7a91-7c2e-9b10-5d6e7f8a9b0c", "type": "image-to-3d", "status": "IN_PROGRESS", "progress": 42, "...": "..." } ], "has_more": true } ``` --- ## GET /openapi/v2/tasks/:id/stream -- Stream a task Streams a task's updates as [Server-Sent Events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events) until the task reaches a final status. ### Parameters - `id` · *path* · **required** The task ID from the create response. ### Returns A `text/event-stream` with two kinds of events: - `message` The full [task object](#the-task-object). The first event arrives right away, and another each time the task changes. Meshy also repeats the latest state every 10 seconds, so a quiet connection still gets events. The stream closes after the event with a final status. - `error` The [error object](https://docs.meshy.ai/api/v2/errors.md#request-errors), plus `status_code`. For example, `{"type": "not_found", "code": "task_not_found", "message": "Task not found", "doc_url": "https://docs.meshy.ai/en/api/v2/asset-retention", "status_code": 404}`. The stream closes after this event. After the stream opens, the HTTP status stays `200`, so read errors from the events. An error before the stream opens, such as a missing API key, is an ordinary HTTP error. A stream closes after about 21 minutes, even if the task hasn't finished. A network drop can close it sooner. If the stream closes without a final status, open it again or [get the task](#get-a-task). **cURL** ```bash # Stream a task's updates until it finishes curl -N https://api.meshy.ai/openapi/v2/tasks/018a210d-8ba4-705c-b111-1f1776f7f578/stream \ -H "Authorization: Bearer ${MESHY_API_KEY}" ``` ```javascript // Stream a task's updates until it finishes const res = await fetch( "https://api.meshy.ai/openapi/v2/tasks/018a210d-8ba4-705c-b111-1f1776f7f578/stream", { headers: { Authorization: `Bearer ${process.env.MESHY_API_KEY}` } }, ); if (!res.ok) throw new Error(`${res.status}: ${(await res.json()).message}`); const reader = res.body.pipeThrough(new TextDecoderStream()).getReader(); let buffer = ""; while (true) { const { value, done } = await reader.read(); if (done) break; buffer += value; const events = buffer.split("\n\n"); buffer = events.pop(); for (const event of events) { const type = event.match(/^event:(.*)$/m)?.[1].trim(); const data = JSON.parse(event.match(/^data:(.*)$/m)[1]); if (type === "error") throw new Error(`${data.status_code}: ${data.message}`); console.log(data.status, data.progress); } } ``` ```python # Stream a task's updates until it finishes import json import os import requests response = requests.get( "https://api.meshy.ai/openapi/v2/tasks/018a210d-8ba4-705c-b111-1f1776f7f578/stream", headers={"Authorization": f"Bearer {os.environ['MESHY_API_KEY']}"}, stream=True, ) response.raise_for_status() response.encoding = "utf-8" event = None for line in response.iter_lines(decode_unicode=True): if line.startswith("event:"): event = line[len("event:"):].strip() elif line.startswith("data:"): data = json.loads(line[len("data:"):]) if event == "error": raise SystemExit(f"{data['status_code']}: {data['message']}") print(data["status"], data["progress"]) ``` **Events (task objects shortened)** ```text event:message data:{"id":"018a210d-8ba4-705c-b111-1f1776f7f578","type":"image-to-3d","status":"IN_PROGRESS","progress":42,...} event:message data:{"id":"018a210d-8ba4-705c-b111-1f1776f7f578","type":"image-to-3d","status":"SUCCEEDED","progress":100,...,"output":{"model_urls":{"glb":"..."},...}} ``` --- ## DELETE /openapi/v2/tasks/:id -- Delete a task Deletes a task of any type. You can't undo a delete, and the deleted task returns `404` on every route. Creative Lab tasks can't be deleted here, and return `404` as on [Get a task](#get-a-task). Deleting a `PENDING` task refunds its credits. An `IN_PROGRESS` task can't be deleted. Wait for a final status, then delete it. ### Parameters - `id` · *path* · **required** The ID of the task to delete. ### Returns `200` with an empty body. ### Errors - `400 - Bad Request` The ID isn't a valid task ID (`request_invalid`). Send the `id` from the create response. - `404 - Not Found` No task with this ID belongs to your account, or the task is already deleted (`task_not_found`). Creative Lab tasks also return `404`. Check the ID, and use an API key from the account that created the task. - `409 - Conflict` The task is `IN_PROGRESS`. Its credits aren't refundable after a worker starts it. Wait for `SUCCEEDED` or `FAILED`, then delete it. **cURL** ```bash # Delete a task curl -X DELETE https://api.meshy.ai/openapi/v2/tasks/018a210d-8ba4-705c-b111-1f1776f7f578 \ -H "Authorization: Bearer ${MESHY_API_KEY}" ``` ```javascript // Delete a task const res = await fetch( "https://api.meshy.ai/openapi/v2/tasks/018a210d-8ba4-705c-b111-1f1776f7f578", { method: "DELETE", headers: { Authorization: `Bearer ${process.env.MESHY_API_KEY}` }, }, ); if (!res.ok) throw new Error(`${res.status}: ${(await res.json()).message}`); ``` ```python # Delete a task import os import requests response = requests.delete( "https://api.meshy.ai/openapi/v2/tasks/018a210d-8ba4-705c-b111-1f1776f7f578", headers={"Authorization": f"Bearer {os.environ['MESHY_API_KEY']}"}, ) response.raise_for_status() ``` **409 Conflict** ```json { "type": "conflict", "code": "task_in_progress", "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.", "doc_url": null } ``` --- # Errors Source: https://docs.meshy.ai/api/v2/errors # Errors Find out why a request or a task failed, and what to do next. A request can fail right away with an HTTP error, and a task can fail later with a `task_error`. > **Note:** Moving from v1? The main changes for errors: > * A request error is the same object as a failed task's `task_error`, with a `code` to branch on. > * HTTP status codes don't change, and `message` is still there, but many messages are more specific. If your code matches `message` text, branch on `code` instead. > * Some requests that worked on v1 return `400`, for example one with a parameter the endpoint doesn't define. > > See [Errors in the migration reference](/api/migrate-to-v2/reference#errors). --- ## Request errors Meshy returns these errors right away, when it rejects a request. Every error has the same four fields, whatever the status. Branch on `code` or `type`, not on `message`. ### Response format - `type` · *string* The error category. It's never `null`. The type tells you what to do next, whatever the status. See [Error types](#error-types). - `code` · *string* The specific problem. It's never `null`. See [Request error codes](#request-error-codes). Meshy never renames or reuses a code. Meshy may add codes, so handle a code you don't recognize by its `type`. - `message` · *string* A description of the error that you can show to people. Don't branch on it, because the wording can change. - `doc_url` · *string | null* A link to the docs that explain the fix, when it needs more than `message` can hold. For example, `pending_task_limit_reached` links the queue limit of each plan, and `moderation_blocked` links its entry below. `null` when `message` already says what to change. When several parameters are wrong, `code` describes the first problem and `message` lists them all. Text to 3D errors use this object too. The exception is a request Meshy rejects before it reads the API key, for example because the key is missing or invalid. That error is `{"message": "..."}`. After a [stream](https://docs.meshy.ai/api/v2/tasks.md#stream-a-task) opens, its HTTP status stays `200`. An `error` event on the stream has the same four fields, plus `status_code`, the status the request would have had. ### Status codes - `2xx` Success. - `200 - OK` The request worked. Reads and deletes return `200`. - `202 - Accepted` Meshy created the task, and the task runs in the background. Every create returns `202` with the [task object](https://docs.meshy.ai/api/v2/tasks.md#the-task-object). - `4xx` Something is wrong with the request. Fix it before you send it again. - `400 - Bad Request` A parameter is missing, unknown, malformed, or not allowed with another one. `code` names the kind of problem, for example `parameter_missing` or `parameters_conflict`, and `message` names the parameter. Each endpoint page lists its own `400` errors. - `401 - Unauthorized` The API key is missing (`api_key_missing`) or isn't valid (`api_key_invalid`). See [Authentication](/api/authentication). - `402 - Payment Required` Your account can't pay for the task (`insufficient_credits`), or it reached a credit limit (`credit_limit_reached`). On the free plan, most create requests return `402` with `plan_upgrade_required`. - `403 - Forbidden` You aren't allowed to make this request. For example, the request came from an address outside the API key's IP allowlist (`ip_not_authorized`), or content moderation blocked the input or a task's files (a `moderation_blocked` code). It's also returned when the API key's team member is no longer active on the team, or the account is banned. - `404 - Not Found` The task or route doesn't exist. `task_not_found` means no task with this ID belongs to your account. `route_not_found` means the path or method doesn't exist on v2, for example `GET /openapi/v2/image-to-3d/{id}`. Check the path and method on the endpoint page. To read a task, use `GET /openapi/v2/tasks/{id}`. - `409 - Conflict` The task's state doesn't allow the operation (`task_in_progress`). For example, deleting an `IN_PROGRESS` task returns `409`, because Meshy can't refund a task that a worker has started. Wait for a final status, then delete the task. - `422 - Unprocessable Entity` The request is valid, but Meshy can't process its input. For example, [Rigging](https://docs.meshy.ai/api/v2/rigging.md) can return `422` with `model_not_riggable` when it can't find a humanoid body in the model. - `429 - Too Many Requests` One of these limits was reached: * You sent more requests than your rate limit allows (`rate_limit_exceeded`). Wait the number of seconds in the `Retry-After` header, then retry. See [Rate limits](https://docs.meshy.ai/api/v2/rate-limits.md). * Too many of your tasks are queued or running (`pending_task_limit_reached`). 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 (`concurrent_task_limit_reached`). Wait for a task to finish, or top up. - `5xx` Something went wrong on Meshy's side. Retry with backoff. If the error continues, check the [status page](https://status.meshy.ai) and contact us on [Discord](https://discord.com/invite/KgD5yVM9Y4). **400 Bad Request** ```json { "type": "invalid_input", "code": "parameters_conflict", "message": "texture_prompt and texture_image_url are mutually exclusive", "doc_url": null } ``` **404 Not Found** ```json { "type": "not_found", "code": "route_not_found", "message": "NoMatchingRoute: Please double check the path and method", "doc_url": null } ``` **403 Forbidden** ```json { "type": "invalid_input", "code": "moderation_blocked_nsfw", "message": "This content can't be generated because it may not comply with our Acceptable Use Policy regarding NSFW.", "doc_url": "https://docs.meshy.ai/en/api/v2/errors#moderation-blocked" } ``` --- ## Request error codes Every request error has one of these codes. The Status column shows the HTTP status that comes with each code. A few codes come with more than one status, because some endpoints answer the same problem with a different status. `type` follows the code, not the status. For example, the free-plan refusal is a `402` with the type `permission_denied`. | `code` | `type` | Status | What it means | What to do | | --- | --- | --- | --- | --- | | `request_body_invalid` | `invalid_input` | 400 | The body is empty, isn't valid JSON, or isn't a JSON object. | Send a JSON object. | | `parameter_missing` | `invalid_input` | 400 | A required parameter is missing, for example `texture_model` on a request for a textured model. Or the request has none of a set of alternatives, for example `input_task_id` or `model_url`. | Add the parameter that `message` names. | | `parameter_unknown` | `invalid_input` | 400 | The request has a parameter the endpoint doesn't define, for example the misspelled `texure_prompt` or the v1 parameter `hd_texture`. Text to 3D requests with `mode` ignore it instead. | Remove the parameter, or send the one that `message` names. | | `parameter_invalid_type` | `invalid_input` | 400 | A parameter has the wrong JSON type, for example a string where a number goes. | Send the type the endpoint page lists. | | `parameter_invalid_value` | `invalid_input` | 400 | A parameter's value isn't one the endpoint accepts, for example an unknown `ai_model`. | Send one of the documented values. | | `parameter_out_of_range` | `invalid_input` | 400 | A number, length, or count is outside its allowed range. | Send a value within the limits on the endpoint page. | | `parameters_conflict` | `invalid_input` | 400 | Two parameters can't be used together, or one needs another. For example, `texture_model: "meshy-n1"` can't make PBR maps, so it returns this code with `enable_pbr: true`. | Drop one of them, or add the one it needs. | | `input_task_not_found` | `invalid_input` | 400, 404 | The task in `input_task_id`, `preview_task_id`, or `rig_task_id` doesn't exist or belongs to another account. | Check the ID. | | `input_task_not_ready` | `invalid_input` | 400 | The referenced task hasn't succeeded yet. | Wait until it's `SUCCEEDED`, then send the request again. | | `input_task_expired` | `invalid_input` | 400, 404 | Meshy removed the referenced task's files after the [retention period](https://docs.meshy.ai/api/v2/asset-retention.md). | Create the input task again. | | `input_task_unsupported` | `invalid_input` | 400, 403, 404 | The referenced task is a kind this endpoint can't use. | Use a task of a type the endpoint page lists. | | `input_download_failed` | `invalid_input` | 400 | Meshy couldn't download a URL in the request. | Make the URL publicly readable, or send the file as a data URI. A Meshy download URL stops working at its task's `expires_at`. Send the task's `id` where the endpoint takes an input task, or your own copy of the file. | | `input_file_invalid` | `invalid_input` | 400, 422 | Meshy received a file but can't use it, for example because the file is empty, corrupt, too large, or in an unsupported format. | Send a file in a format and size the endpoint supports. | | `metadata_invalid` | `invalid_input` | 400 | The `X-Meshy-Metadata` header is malformed, or has more than 64 pairs or 8,192 bytes. | Fix the header. See [Metadata](https://docs.meshy.ai/api/v2/metadata.md). | | `model_not_available` | `invalid_input` | 400 | The `ai_model` is retired or isn't offered on this endpoint. | Use a model the endpoint page lists. | | `model_not_riggable` | `invalid_input` | 422 | Rigging couldn't find a humanoid body in the model, or can't rig it automatically. | Use a single humanoid character in a T-pose or A-pose, facing the +Z axis. | | `moderation_blocked` | `invalid_input` | 400, 403 | Content moderation blocked the input. | Change the prompt or images. See [`moderation_blocked`](#moderation-blocked). | | `moderation_blocked_nsfw`, `moderation_blocked_ip`, `moderation_blocked_public_figure` | `invalid_input` | 403 | Content moderation blocked the input, and the code names the check. | Change the prompt or images. | | `moderation_blocked_ip_filtering` | `invalid_input` | 403 | Your organization's IP filtering blocked the input or a task's files. | Change the input, or ask your organization's administrator about its IP whitelist. | | `request_invalid` | `invalid_input` | 400 | The request is invalid and no more specific code applies. | Read `message`, fix the request, and send it again. | | `api_key_missing` | `authentication_error` | 401 | The request has no API key. | Send `Authorization: Bearer `. See [Authentication](/api/authentication). | | `api_key_invalid` | `authentication_error` | 401, 404 | The API key isn't valid or was revoked. A `404` means the key's account no longer exists, or the API key selected in the API Playground doesn't exist. | Check the key, or create a new one. | | `insufficient_credits` | `insufficient_credits` | 402 | Your account doesn't have enough credits for the task. | Top up, then send the request again. | | `credit_limit_reached` | `insufficient_credits` | 402 | A member, workspace, or API key credit limit was reached. | Raise the limit, or wait until it resets. | | `plan_upgrade_required` | `permission_denied` | 402, 403 | Your plan doesn't include this request, for example creating tasks on the free plan. | Upgrade your plan. | | `ip_not_authorized` | `permission_denied` | 403 | The request came from an address outside the API key's IP allowlist. `message` names the address. | Add the address to the allowlist, or send the request from an allowed address. | | `team_access_denied` | `permission_denied` | 403 | Your account isn't a member of the team the request names. | Check the team, or use a key from that team. | | `access_denied` | `permission_denied` | 403 | You can't make this request, and no more specific code applies. | Read `message`. Contact support if you think it's wrong. | | `task_not_found` | `not_found` | 404 | The task doesn't exist, belongs to another account, was deleted, or was removed after its retention period. | Check the ID. | | `route_not_found` | `not_found` | 404 | The path or method doesn't exist on v2, for example `GET /openapi/v2/image-to-3d/{id}`. | Check the path and method on the endpoint page. To read a task, use `GET /openapi/v2/tasks/{id}`. | | `task_in_progress` | `conflict` | 409 | The task's state doesn't allow the operation, for example deleting an `IN_PROGRESS` task. | Wait for a final status, then try again. | | `rate_limit_exceeded` | `rate_limited` | 429 | You sent more requests than your rate limit allows. | Wait the number of seconds in `Retry-After`. See [Rate limits](https://docs.meshy.ai/api/v2/rate-limits.md). | | `pending_task_limit_reached` | `rate_limited` | 429 | Too many of your tasks are queued or running. | Wait for some to finish. | | `concurrent_task_limit_reached` | `rate_limited` | 429 | 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 top up. | | `internal_error` | `server_error` | 500 | Something went wrong on Meshy's side. | Retry with backoff. If it continues, contact support. | | `service_unavailable` | `service_unavailable` | 503, 502, 504, 422 | The service or one it depends on is temporarily unavailable, for example during maintenance. Rigging returns `422` when its pose estimation service fails. | Retry later. | ### `input_download_failed` Meshy couldn't download a URL in the request, such as `image_url` or `model_url`. `message` says why, for example the HTTP status the host returned or that the download timed out. Common causes: - **The URL has expired.** A signed URL stops working when its signature expires. Meshy's own result URLs stop working at the task's `expires_at`. To use a task's output as input, send the task's `id` where the endpoint takes `input_task_id`. See [Asset retention](https://docs.meshy.ai/api/v2/asset-retention.md). - **The URL isn't public.** Meshy downloads it without cookies or credentials. A URL behind a login, or one only your own network can reach, fails. - **The value isn't an `http(s)` URL.** Send an `http(s)` URL, or a data URI where the endpoint takes one. To skip the download, send the file as a data URI, such as `data:image/png;base64,...`. Each endpoint page says which parameters take one. --- ## Task errors A task that Meshy created can still fail while it runs. Its `status` becomes `FAILED`, Meshy refunds its credits, and `task_error` explains why. `task_error` is `null` for every other status. A failed task's `task_error` always has these four fields: - `type` · *string* The error category. It's never `null`. Branch on it to decide whether to retry. See [Error types](#error-types). - `code` · *string | null* A specific, documented problem you can act on. See [Error codes](#error-codes). Meshy may add codes, so handle a code you don't recognize by its `type`, as you would a `null` code. `null` for errors that have no public code: * Every `service_unavailable` error * Most `server_error` errors * Some `invalid_input` errors, for example an image with no clear subject - `message` · *string* A description of the error that you can show to people. Don't branch on it, because the wording can change. - `doc_url` · *string | null* A link to the code's entry in the error reference, for example `https://docs.meshy.ai/en/api/v2/errors#timeout`. Each code has an entry under the same anchor on this page. `null` when `code` is `null`. **A failed task with a code** ```json { "id": "018a210d-8ba4-705c-b111-1f1776f7f578", "type": "convert", "status": "FAILED", "consumed_credits": 0, "task_error": { "type": "invalid_input", "code": "invalid_input", "message": "No valid objects found in uploaded model. The file may be empty or contain no importable geometry.", "doc_url": "https://docs.meshy.ai/en/api/v2/errors#invalid-input" }, "output": null } ``` **A failed task without a code** ```json { "id": "018a210d-8ba4-705c-b111-1f1776f7f578", "type": "rig", "status": "FAILED", "consumed_credits": 0, "task_error": { "type": "service_unavailable", "code": null, "message": "The service is temporarily unavailable. Please retry in a few minutes.", "doc_url": null }, "output": null } ``` These examples show only part of each task object. For every field, see [the task object](https://docs.meshy.ai/api/v2/tasks.md#the-task-object). --- ## Error types `type` is one of the following values, on a request error and on a failed task's `task_error`. Use it to decide what to do next. A failed task uses only these types: - `invalid_input` - `timeout` - `service_unavailable` - `server_error` - `invalid_input` Something is wrong with the input you sent. Read `code` and `message`, fix the input, and create a new task. Sending the same input again fails the same way. - `timeout` The task ran past a server-side time limit, for processing or for waiting in the queue. This is often temporary. Create the task again, and if it keeps failing, try a simpler input. - `service_unavailable` The service was temporarily unavailable. Wait a moment, then create the task again. - `server_error` Something went wrong on Meshy's side. Retry the request, or create the task again. If it keeps failing, contact support with the task ID. - `authentication_error` The API key is missing or isn't valid. Fix the key. Sending the same request again fails the same way. - `insufficient_credits` Your account doesn't have enough credits for the task, or it reached a credit limit. Top up or raise the limit, then send the request again. - `permission_denied` Your plan, your API key's IP allowlist, or your team membership doesn't allow the request. - `not_found` The task doesn't exist for your account, or the route doesn't exist. Check the ID or the path. - `conflict` The task's state doesn't allow the operation yet. Wait for the state to change, then try again. - `rate_limited` You sent too many requests, or too many of your tasks are queued or running. Wait, then send the request again. When `Retry-After` is set, wait that many seconds. --- ## Error codes When `code` isn't `null`, it names one of the following problems. Some codes are more specific than their entry, and their `doc_url` links to that entry. For example, [`moderation_blocked`](#moderation-blocked) covers `moderation_blocked_nsfw`. ### `image_too_complex` Type: `invalid_input`. The input image or prompt describes a subject that is too geometrically complex for 3D generation. For example: - Dense piles of small objects, such as a crate full of fruit or a stack of books - Intricate repeating patterns, such as lattice structures, scaffolding, or wire meshes - Complex buildings, such as multi-story buildings with many windows and balconies - Several distinct objects in one image, instead of a single subject These inputs are likely too complex: ![A crate of mixed berries](/images/errors/bad_01_berry_crate.png) ![An intricate cathedral ceiling](/images/errors/bad_02_fractal_cathedral.png) ![A building under construction with scaffolding](/images/errors/bad_03_construction_building.png) ![A honeycomb lattice sphere](/images/errors/bad_04_honeycomb_sphere.png) To fix it, try one or more of the following: - Use one object per image. Meshy works best with one clear subject. - Simplify your subject. For example, use a simple vase instead of a vase filled with dozens of flowers. - Avoid scenes. Whole buildings, city blocks, furnished rooms, and landscapes are likely to be too much. Focus on a single object. - Avoid dense repeating structures. Scaffolding, wire meshes, lattices, and piles of small items are common triggers. ### `model_missing_uv` Type: `invalid_input`. The model has no UV coordinates, and the request asked Meshy to keep the model's own UVs. UV coordinates define how a 2D texture wraps onto the 3D surface. ![No UVs vs Good UVs](/images/errors/uv_missing_vs_good.png) To fix it, do one of the following: - To keep your own UV layout, for example for custom seam placement, add UVs to the model in your 3D software and upload it again. STL files can't store UVs, so use GLB, FBX, or OBJ. - If you don't need your own layout, let Meshy create the UVs. On [Retexture](https://docs.meshy.ai/api/v2/retexture.md), use `uv_mode: "auto"` (the default) or `"regenerate"`. ### `model_insufficient_uv` Type: `invalid_input`. The model has UV coordinates, but they cover too little of the UV space to texture well. This often happens with models whose exporter wrote placeholder or collapsed UVs. On [Retexture](https://docs.meshy.ai/api/v2/retexture.md), you get this error with `uv_mode: "preserve"`, which keeps the model's UVs and never replaces them. ![Insufficient UVs vs Good UVs](/images/errors/uv_insufficient_vs_good.png) To fix it, do one of the following: - To keep your own UV layout, unwrap the model's UVs again in your 3D software. Spread the islands across the UV space instead of a small corner of it. - If you don't need your own layout, use `uv_mode: "auto"` (the default), which unwraps the model again when its UVs are too sparse, or `"regenerate"`, which always does. You lose your seam placement, but the new UVs cover enough space to texture. ### `model_missing_texture` Type: `invalid_input`. A [Multi-Color Print](https://docs.meshy.ai/api/v2/multi-color-print.md) task's input model has no color that Meshy can split into print colors. Meshy builds a multi-color 3MF from the model's colors, so a plain white mesh has nothing to work with. For example, a model generated with `should_texture: false` has no color, and neither does the output of Repair Printability, or an Auto Split task that didn't keep the texture. What counts as color depends on the `style` you requested: - `realistic` samples the base color texture through the model's UVs. It needs a single base color texture, and UVs on every mesh part. - `cartoon` flattens colors per face. It accepts a base color texture on any part, or per-vertex colors (`COLOR_0`). A model with neither a base color texture nor vertex colors fails with both styles. Meshy refuses most of these requests before it creates the task, with a `400` and the same explanation. You get this code only when Meshy can't check the input up front. For example, Meshy checks an `.fbx` upload only after the task converts it. To fix it, use the option that fits your model: - Texture the model first. Run [Retexture](https://docs.meshy.ai/api/v2/retexture.md) on it, or generate it with `should_texture: true` on [Text to 3D](https://docs.meshy.ai/api/v2/text-to-3d.md) or [Image to 3D](https://docs.meshy.ai/api/v2/image-to-3d.md). Then send that task as `input_task_id`. - For a vertex-colored model, such as a photogrammetry scan or a hand-painted mesh, use `style: "cartoon"`, which reads `COLOR_0`. - For a partly textured or multi-texture model with `realistic`, give every mesh part UVs and the same single base color texture. To do that, texture the remaining parts, or merge the textures into one atlas. You can also switch to `style: "cartoon"`. ### `textured_split_refused` Type: `invalid_input`. An [Auto Split](https://docs.meshy.ai/api/v2/auto-split.md) task with `keep_texture: true` can't keep the input model's texture on the parts. For example, the model has no UVs, or its texture has no room for the new faces the cuts create. Meshy refunds the credits. To fix it, send the request again without `keep_texture`, or with `keep_texture: false`. The parts then come back with a flat color each. ### `invalid_input` Type: `invalid_input`. The input failed a check, and no more specific code applies. `message` gives the reason. For example: - An empty or corrupted model file - An unsupported variant of a file format, such as an ASCII FBX file or a meshopt-compressed GLB file - An uploaded model with no valid 3D objects, for example a file with only armatures, cameras, or lights The code `provider_content_refused` also links here. It means a model provider's safety check declined the input, for example a prompt, an image, or a model. To fix it, read `message` for the specific problem. Check that your input files and parameters meet the endpoint's requirements, or change the input. Then create a new task. ### `moderation_blocked` Type: `invalid_input`. Safety filters rejected your prompt or reference images. The filters check the text and the images together. `code` can also name the check that blocked the input: - `moderation_blocked_nsfw` - `moderation_blocked_ip` - `moderation_blocked_public_figure` To catch them all, match codes that start with `moderation_blocked`. To fix it, do one or both of the following: - Rephrase the prompt to remove suggestive or sensitive descriptions. - Change reference images that show content the filters might block. ### `moderation_unavailable` Type: `server_error`. Content moderation was temporarily unavailable, so Meshy failed the task instead of skipping the check. Nothing is wrong with your content. To fix it, create the task again. ### `timeout` Type: `timeout`. The task ran past a server-side processing time limit, so Meshy failed it and refunded its credits. High load, or an input too complex to finish in time, can cause it. This is different from a timeout in your own code. If your client stopped waiting, the task is still running. See [How long to wait](/api/task-lifecycle#how-long-to-wait). To fix it, follow these steps: 1. Create the task again. Timeouts are often temporary. 2. If it keeps failing, simplify your input. For inputs that are harder to process, see [`image_too_complex`](#image-too-complex). ### `queue_timeout` Type: `timeout`. The task waited in the queue too long without starting, so Meshy failed it and returned any credits charged for it. Your input didn't cause this error. To fix it, create the task again. ### `format_conversion_failed` Type: `server_error`. Meshy generated the model, but converting it to a format you requested failed. To fix it, follow these steps: 1. Create the task again. 2. If one format keeps failing, request a different format. --- ## Best practices 1. Branch on `type` and `code`, not on `message`. For a failed task with `timeout`, `service_unavailable`, or `server_error`, create a new task with exponential backoff. For `invalid_input`, fix the input. 2. Don't create a new task when your own request times out. The first task is probably still running, so get it by its ID first. See [How long to wait](/api/task-lifecycle#how-long-to-wait). 3. Log task IDs. Include the ID when you contact support. 4. Check inputs before you send them. Make sure images and models meet the endpoint's format requirements. 5. Call the API from your server. Code that runs in a browser exposes your API key to anyone who opens the page. --- # Rate limits Source: https://docs.meshy.ai/api/v2/rate-limits # Rate limits Check how many requests and tasks your plan allows, and use the error `code` to tell which limit you reached. --- ## Limits by plan To keep the API fast and available for everyone, Meshy limits each account in two ways: - Requests per second: how many API requests you can send each second. - Concurrent tasks: how many of your tasks can be `PENDING` or `IN_PROGRESS` at the same time. The limits depend on your plan: | Plan | Requests per second | Concurrent tasks | Priority | | --- | --- | --- | --- | | Pro | 20 | 10 | Default | | Premium | 20 | 30 | Higher than Pro | | Ultra | 20 | 100 | Highest | | Studio | 20 | 60, or 20 on some earlier Studio plans | Higher than Pro | | Enterprise | 100 | 100 by default, or a custom limit | Highest | Priority isn't a limit. When the queue is busy, Meshy starts the tasks with a higher priority first. API v1 and v2 share these limits, so requests and tasks on either version count toward them. ### What counts toward each limit Every API request counts toward requests per second, including requests to the [Tasks](https://docs.meshy.ai/api/v2/tasks.md) routes. Requests from the Meshy web app don't count. The concurrent tasks limit counts tasks, not requests. Every endpoint that creates a task checks this limit before it creates one. For example, Text to 3D, Image to 3D, Multi-Image to 3D, Retexture, Remesh, Rigging, Animation, Text to Image, and the 3D printing endpoints check it. Requests that don't create a task don't count toward it. For example, Balance, Usage, and requests to the Tasks routes don't count. ### Whose limits apply The following table shows whose limits your API keys, the Playground, and the web app count toward: | Where you work | Personal account | Team | | --- | --- | --- | | API keys | Your limits | The team's limits, shared by every API key in the team | | Playground | Your limits | Your own limits as the signed-in member | | Web app | Your concurrent tasks | Your own concurrent tasks. Tasks the team owner starts also count toward the team's limits. | --- ## When you reach a limit When you go over a limit, the API returns `429 Too Many Requests` with the type `rate_limited`. The error's `code` tells you which limit you reached: | `code` | Limit you reached | What to do | | --- | --- | --- | | `rate_limit_exceeded` | Requests per second | Wait the number of seconds in the `Retry-After` header, then retry. | | `pending_task_limit_reached` | Concurrent tasks | Wait for one of your tasks to finish, then create the next one. | | `concurrent_task_limit_reached` | The tasks that can run without credits, on an unlimited plan with no credits left | Wait for a task to finish, or top up. | Only `rate_limit_exceeded` comes with a `Retry-After` header. Branch on `code`, not on `message`, because the wording can change. Meshy may add codes, so handle a code you don't recognize by its `type`. For every code, see [Request error codes](https://docs.meshy.ai/api/v2/errors.md#request-error-codes). For example, a request over the per-second limit returns this body: **429 Too Many Requests** ```json { "type": "rate_limited", "code": "rate_limit_exceeded", "message": "Rate limit exceeded", "doc_url": "https://docs.meshy.ai/en/api/v2/rate-limits#how-limits-work" } ``` --- ## Rate limit headers API responses include these headers to help you pace your requests: | Header | Description | | --- | --- | | `X-RateLimit-Limit` | Requests allowed per second on your plan. | | `X-RateLimit-Remaining` | Requests left in the current second. | | `X-RateLimit-Reset` | Seconds until your budget is full again. | | `Retry-After` | Seconds to wait before your next request. Sent with a `429` whose code is `rate_limit_exceeded`. Also sent with the `202` that creates a task, and when you get a task, while the task is `PENDING` or `IN_PROGRESS`. On the `202`, it's how long to wait before you first poll the task's `Location`. | When `Retry-After` is present, wait that many seconds before you send the next request. For how to follow a task until it finishes, see [How a task runs](https://docs.meshy.ai/api/v2/tasks.md#how-a-task-runs). --- # Asset retention Source: https://docs.meshy.ai/api/v2/asset-retention # Asset retention Find out how long Meshy keeps the files your API tasks produce, when their download URLs stop working, and how to keep your own copy. --- Meshy keeps the models you generate through the API for at most **3 days**. After that, Meshy deletes them from its servers. If you aren't an Enterprise customer and need a model for longer, download it and store your own copy. Enterprise customers can keep their models indefinitely. Models you make through the [remote MCP server](/api/remote-mcp) are an exception. They appear in the Meshy web app, and Meshy keeps them the way it keeps the models you make there. ## Download URLs are signed The URLs in a task's `output`, such as `model_urls`, `texture_urls`, and `thumbnail_url`, point at `assets.meshy.ai` and carry a signature (`?Expires=…&Signature=…`). A URL stops working at the task's `expires_at`, 3 days after the task finishes. Getting the task again returns the same URL with the same expiry. `expires_at` is `null` until the task succeeds. It's always `null` for Text to 3D tasks and on Enterprise accounts. For Text to 3D tasks on other accounts, `null` doesn't mean Meshy keeps the files. Meshy still deletes them 3 days after the task finishes. Because of this, follow these rules: - Download the files in `output` when the task reaches `SUCCEEDED`, and keep your own copy if you need the model for longer. - Don't store a download URL to send back to Meshy later as `model_url`, for example to [Analyze Printability](https://docs.meshy.ai/api/v2/analyze-printability.md), [Repair Printability](https://docs.meshy.ai/api/v2/repair-printability.md), or [Remesh](https://docs.meshy.ai/api/v2/remesh.md). After the signature expires, that request fails with `400` and the code `input_download_failed`. - While Meshy still keeps the source task, send its `id` as `input_task_id` instead. After that, a request that sends the ID fails with the code `input_task_expired`, and `GET /openapi/v2/tasks/{id}` returns `404` with the code `task_not_found`. Send your own stored copy instead. --- # Webhooks Source: https://docs.meshy.ai/api/v2/webhooks # Webhooks Get a `POST` request from Meshy when one of your API tasks makes progress or finishes, instead of polling for it. > **Note:** Moving from v1? A webhook keeps its v1 payload until you switch it. See [Switch a webhook to v2](#switch-a-webhook-to-v2). --- ## Set up a webhook To add a webhook, open the [Webhooks page](https://www.meshy.ai/developers/webhooks) in the [Developer Platform](/api/developer-platform) and click **Create Webhook**. 1. In **Payload URL**, enter the URL that receives the deliveries. Meshy delivers only over `https://`, and the URL's host must resolve to a public IPv4 address. 2. Leave **Payload version** on v2. See [Payload versions](#payload-versions). 3. Keep a copy of the **Webhook Secret** that the dialog fills in. Every delivery carries it, so your server can check that a request came from Meshy. 4. Check your server with **Send test** before you save. See [Test a webhook](#test-a-webhook). 5. Keep **Active** on, and click **Confirm**. Each account can have 5 active webhooks, and 10 in total. Every active webhook receives the deliveries of the API tasks that run as the Meshy user who signs in to the Webhooks page. A team API key runs as the team owner, so the team owner signs in to see, test, and switch the team's webhooks. --- ## Payload versions Each webhook has a payload version, v1 or v2. It sets the body of the webhook's deliveries: - v2: the v2 [task object](https://docs.meshy.ai/api/v2/tasks.md#the-task-object), the same object `GET /openapi/v2/tasks/{id}` returns, for every task type. - v1: the v1 task object of the endpoint that created the task. See the [v1 Webhooks page](/api/webhooks#sample-response). The version belongs to the webhook, not to the API version that created the task. A task you create on v1 reaches a v2 webhook as the v2 task object. A task you create on v2 reaches a v1 webhook as the v1 body. Moving your API calls to v2 doesn't change your webhooks. Creative Lab endpoints aren't part of API v2. Their deliveries keep their v1 body and the `v1` header, even on a v2 webhook. --- ## Deliveries Meshy sends a delivery while a task is `IN_PROGRESS`, and another when the task reaches a final status. A task can reach its final status without an `IN_PROGRESS` delivery. Each delivery is a `POST` to your Payload URL with a JSON body and these headers: | Header | Value | | --- | --- | | `Meshy-Webhook-Version` | `v2` when the body is the v2 task object, `v1` when it's the v1 body | | `X-MESHY-API-WEBHOOK-SECRET-KEY` | The webhook's secret | | `X-MESHY-API-WEBHOOK-USER-ID` | The ID of the Meshy user who owns the webhook | | `Content-Type` | `application/json` | | `User-Agent` | `MeshyAPIWebhook/1.0.0` | Read the body by the `Meshy-Webhook-Version` header, not by the webhook's version. The header names the format of that one delivery, and a Creative Lab delivery on a v2 webhook is `v1`. A v2 delivery's body is the task object as `GET /openapi/v2/tasks/{id}` returns it, except `progress`. A delivery sends `progress` as one of these values: - `50` while the task is `IN_PROGRESS` - `100` when the task succeeds - `0` when the task fails or is canceled To read the task's latest progress, [get the task](https://docs.meshy.ai/api/v2/tasks.md#get-a-task). **A v2 delivery** ```http POST /meshy-webhook HTTP/1.1 Content-Type: application/json Meshy-Webhook-Version: v2 User-Agent: MeshyAPIWebhook/1.0.0 X-MESHY-API-WEBHOOK-SECRET-KEY: ******************************** X-MESHY-API-WEBHOOK-USER-ID: *** { "id": "018a210d-8ba4-705c-b111-1f1776f7f578", "type": "image-to-3d", "status": "SUCCEEDED", "progress": 100, "created_at": 1791846275575, "started_at": 1791846275578, "finished_at": 1791846334536, "expires_at": 1792105534536, "preceding_tasks": 0, "consumed_credits": 30, "task_error": null, "input": { "image_url": "https://docs.meshy.ai/images/api/quick-start/source-photo.webp", "texture_model": "meshy-7" }, "output": { "model_urls": { "glb": "https://assets.meshy.ai/***/tasks/018a210d-8ba4-705c-b111-1f1776f7f578/output/model.glb?Expires=***" }, "thumbnail_url": "https://assets.meshy.ai/***/tasks/018a210d-8ba4-705c-b111-1f1776f7f578/output/preview.png?Expires=***", "thumbnail_urls": null, "texture_urls": [ { "base_color": "https://assets.meshy.ai/***/tasks/018a210d-8ba4-705c-b111-1f1776f7f578/output/texture_0.png?Expires=***", "metallic": null, "roughness": null, "normal": null, "metallic_roughness": null, "emission": null } ] } } ``` --- ## Handle a delivery To accept a delivery, respond with a status below 400, such as `200` or `202`. Meshy waits about 25 seconds for the response, so store the delivery and respond first. Do the slow work after that, such as downloading the model. A status of 400 or above, or no response, counts as a failed delivery. Meshy retries it with longer waits between attempts, up to 4 times for an `IN_PROGRESS` update and up to 9 times for a final status. If 20 updates in a row fail every attempt, Meshy can deactivate the webhook. To turn it back on, edit it on the Webhooks page and select **Active**. Write your code for these cases: - Deliveries can arrive out of order. An `IN_PROGRESS` delivery can arrive after the final one, so don't let it replace a final status. - The same update can arrive more than once. Handle each pair of `id` and `status` once. - Anyone who knows your URL can send it a request. Compare `X-MESHY-API-WEBHOOK-SECRET-KEY` with your copy of the secret, and reject a request that doesn't match. If a task's final delivery hasn't arrived after about twice the task's typical time, [get the task](https://docs.meshy.ai/api/v2/tasks.md#get-a-task). For typical times, see [Processing times](/api/task-lifecycle#processing-times). **Python** ```python import hmac import os from flask import Flask, request app = Flask(__name__) SECRET = os.environ["MESHY_WEBHOOK_SECRET"] @app.post("/meshy-webhook") def meshy_webhook(): sent = request.headers.get("X-MESHY-API-WEBHOOK-SECRET-KEY", "") if not hmac.compare_digest(sent, SECRET): return "", 401 task = request.get_json() # The same update can arrive twice. Handle each id and status once. if already_handled(task["id"], task["status"]): return "", 200 if request.headers.get("Meshy-Webhook-Version") == "v2": save_v2(task) # results under task["output"] else: save_v1(task) # Creative Lab, or a webhook on v1 return "", 200 ``` **JavaScript** ```javascript const crypto = require('crypto'); const express = require('express'); const app = express(); const SECRET = Buffer.from(process.env.MESHY_WEBHOOK_SECRET); function fromMeshy(req) { const sent = Buffer.from(req.get('X-MESHY-API-WEBHOOK-SECRET-KEY') ?? ''); return sent.length === SECRET.length && crypto.timingSafeEqual(sent, SECRET); } app.post('/meshy-webhook', express.json(), async (req, res) => { if (!fromMeshy(req)) return res.sendStatus(401); const task = req.body; // The same update can arrive twice. Handle each id and status once. if (await alreadyHandled(task.id, task.status)) return res.sendStatus(200); if (req.get('Meshy-Webhook-Version') === 'v2') { await saveV2(task); // results under task.output } else { await saveV1(task); // Creative Lab, or a webhook on v1 } res.sendStatus(200); }); ``` --- ## Test a webhook **Send test** on the [Webhooks page](https://www.meshy.ai/developers/webhooks) sends one of your tasks to a URL and shows you what your server answered. It works in the Create and Edit dialogs, before you save. 1. Click **Create Webhook**, or edit a webhook. 2. Enter the **Payload URL**, and set **Payload version** to the version you want to test. 3. Under **Test before saving**, pick a task and click **Send test**. The list shows your 10 newest finished API tasks created in the last 30 days. 4. Check the result. Any status below 400 counts as delivered. The response body is shown as your server returned it, up to the first 64 KiB. To see the exact request, open **What we sent**. A test has the same body and headers as a real delivery of that task, plus `Meshy-Webhook-Test: true`. Real deliveries never have this header. Your code handles a test the same way as a real delivery. So when this header is `true`, skip paid follow-up work, such as a Retexture you start after an Image to 3D task succeeds. A test doesn't count as a delivery, and it doesn't change your webhook. To close the dialog without saving, click **Cancel**. You can send up to 10 tests a minute. --- ## Test on your computer Meshy delivers only to a public `https://` URL, so it can't reach a server on your computer directly. To test code on your computer, forward a public URL to it with a webhook proxy. These steps use [smee.io](https://smee.io/), and any webhook proxy works the same way. 1. Open [smee.io](https://smee.io/) and click **Start a new channel**. Copy the **Webhook Proxy URL**. 2. Install the smee client: ```bash npm install --global smee-client ``` 3. Forward the channel to your server. Replace `WEBHOOK_PROXY_URL` with your Webhook Proxy URL, and the path and port with your server's: ```bash smee --url WEBHOOK_PROXY_URL --path /meshy-webhook --port 3000 ``` Keep it running while you test. To stop forwarding, press Ctrl+C. 4. Use the Webhook Proxy URL as the Payload URL in [Send test](#test-a-webhook), or in a webhook. --- ## Switch a webhook to v2 A webhook on v1 keeps receiving v1 deliveries until you switch it. To switch it without missing an update: 1. Update the code behind the webhook's URL so it accepts both versions. Branch on the `Meshy-Webhook-Version` header, as in [Handle a delivery](#handle-a-delivery). 2. Edit the webhook and set **Payload version** to v2. Check your code with [Send test](#test-a-webhook). The webhook stays on v1 until you save. 3. Click **Save**. From then on, the webhook receives v2 deliveries for every task except Creative Lab. To switch back, set Payload version to v1. Switching doesn't resend past deliveries. If your code missed any, read those tasks with `GET /openapi/v2/tasks/{id}`, or with their v1 routes for Creative Lab. For the full steps with screenshots, see [Move your webhooks to v2](/api/migrate-to-v2#step-4-move-your-webhooks-to-v2) in the migration guide. For how the v1 and v2 bodies differ, see [Webhook payloads](/api/migrate-to-v2/reference#webhook-payloads). --- # Metadata Source: https://docs.meshy.ai/api/v2/metadata # Metadata Tag each task with your own key-value pairs, such as the user or team it ran for, and read them back on its usage record. Only API keys of Studio and Enterprise teams can tag tasks. On other plans, Meshy ignores the header and never returns `400` for it. --- ## Tag a task To tag a task, send the `X-Meshy-Metadata` header with the request that creates it: ```http X-Meshy-Metadata: user=alex@example.com,team=fab ``` The header value follows the [W3C Baggage](https://www.w3.org/TR/baggage/) format, with at most 64 pairs and 8,192 bytes. A header that's malformed or over these limits returns `400` with the code `metadata_invalid`, and Meshy doesn't create the task. Creative Lab endpoints ignore the header and never return `400` for it. --- ## Read the tags Each record of the [Usage API](https://docs.meshy.ai/api/v2/usage.md#the-usage-record-object) has the task's tags in its `metadata` field, for example `{"user": "alex@example.com", "team": "fab"}`. It's `{}` for a task without tags. --- # Text to 3D API Source: https://docs.meshy.ai/api/v2/text-to-3d # Text to 3D API Turn a text prompt into a 3D model in one call. > **Note:** Text to 3D already runs on `/openapi/v2/text-to-3d`, so the path stays the same. Requests with `mode` (preview and refine) stop working on March 15, 2027, so make new models in one call. Two rules are new. Sending both `texture_prompt` and `texture_image_url` returns `400`, and a textured one-call request, which omits `mode`, needs `texture_model`. Read its tasks through [Tasks](https://docs.meshy.ai/api/v2/tasks.md) like every other task, and read the results from `output`. A webhook set to v2 delivers Text to 3D tasks in that shape. See [what changed for Text to 3D](/api/migrate-to-v2/reference#text-to-3d). --- ## POST /openapi/v2/text-to-3d -- Create a Text to 3D task Creates a Text to 3D 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 - `should_texture` · *boolean* · default: `true` Whether to texture the model. `true` returns a textured model, and `false` returns the mesh only. With `false`, Meshy ignores `texture_model` and the other texture parameters. To check the mesh before you texture it, send `false`, then texture the finished task with [Retexture](https://docs.meshy.ai/api/v2/retexture.md), using its `id` as `input_task_id`. If you also send `mode`, Meshy ignores this setting. - `mode` · *string* · **deprecated** The step of a two-step task, for integrations that already use preview and refine. Send `should_texture` instead. Available values: * `preview`: makes an untextured mesh * `refine`: textures the mesh of a preview task - `prompt` · *string* · **required** Required for one-call and preview tasks. Text that describes the model to generate, up to 800 characters. Longer text returns `400`. A refine uses its preview's prompt instead. - `preview_task_id` · *string* · **required** · **deprecated** Send `should_texture: true` instead, or texture an existing task with [Retexture](https://docs.meshy.ai/api/v2/retexture.md). Required for refine tasks. The ID of the preview task to texture. The task must be one of your preview tasks and have the status `SUCCEEDED`. - `ai_model` · *string* · default: `latest` The model that generates the 3D model. Standard models: * `latest`: Meshy 7.1 * `meshy-7.1` * `meshy-6` * `meshy-6-lite` * `meshy-standard-latest`: same as `latest` Smart Topology models build a clean triangle mesh at the face count you set with `target_polycount`: * `meshy-t2.5`: sharper detail for game assets * `meshy-t2` * `meshy-smart-topology-latest`: Meshy T2.5, the newest Smart Topology model. Results can change when a new one comes out. For results that stay the same, send `meshy-t2.5`. See [Models](https://docs.meshy.ai/api/v2/models.md#choose-by-project) for which model fits your project, such as a game character or a 3D print. On a refine, `ai_model` picks the texture model, because the mesh comes from the preview. Leave it out to texture with the model that matches the preview. For the values a refine takes, see [Legacy preview and refine](#preview-and-refine). - `model_type` · *string* · **deprecated** Leave it out. `ai_model` picks the model. - `geometry_resolution` · *string* · default: `standard` How much geometry detail to generate. Applies only to one-call and preview tasks. A refine with this parameter returns `400`. Available values: * `standard` * `2k`: adds the Ultra pass * `4k`: adds the Ultra pass, then a super-resolution pass `2k` and `4k` need `meshy-7.1` or `latest`. With other models, they return `400`. - `should_remesh` · *boolean* · default: `true (meshy-6-lite), false (other models)` Whether to remesh the model after generation. `false` keeps the mesh as generated. Applies only to one-call and preview tasks. Smart Topology models ignore this setting. **Only when `should_remesh` is set:** - `topology` · *string* · default: `triangle` The face type of the remeshed model, `triangle` or `quad`. Smart Topology models make triangles only, so `quad` with a Smart Topology model returns `400`. With `texture_model: "meshy-n1"`, `quad` returns `400`. - `decimation_mode` · *integer* Adaptive face count, by level. When you set it, Meshy ignores `target_polycount`. Available values: * `1`: ultra * `2`: high * `3`: medium * `4`: low - `target_polycount` · *integer* The number of faces to aim for. Applies only to one-call and preview tasks. The range and default depend on how the mesh is built: | Mesh | Range | Default | | --- | --- | --- | | Remeshed | `100` to `300000` | `30000` | | `meshy-t2.5` or `meshy-smart-topology-latest` | `100` to `30000` | `15000` | | `meshy-t2` | `100` to `15000` | `4000` | A value outside the range returns `400`. For a low-poly game asset, use a Smart Topology model instead of remeshing a standard model. See [Models](https://docs.meshy.ai/api/v2/models.md#choose-by-project). - `pose_mode` · *string* The pose for a character model, `a-pose` or `t-pose`. Leave it out for no pose. Applies only to one-call and preview tasks. **Only when `should_texture` is set:** - `texture_model` · *string* · **required** Required unless `should_texture` is `false`. The model that textures a one-call task. Every `ai_model` takes each of these values. Available values: * `meshy-7`: Meshy 7, with PBR maps, a text prompt, and textures up to 8K * `meshy-n1`: Meshy N1, a 2K base color texture from reference images only * `meshy-6-lite`: Meshy 6 Lite, a 2K texture With `meshy-6` or `meshy-6-lite`, `meshy-n1` needs `texture_image_url`, because those models make no reference image from the prompt. A textured request without `texture_model` returns `400`, and so does an option the texture model doesn't support. With `mode`, Meshy ignores `texture_model`. See [Texture models](https://docs.meshy.ai/api/v2/image-to-3d.md#texture-models). - `texture_prompt` · *string* Text that guides the texture, up to 800 characters. Longer text returns `400`. Send `texture_prompt` or `texture_image_url`, not both. Sending both returns `400`. With `meshy-n1`, sending it returns `400`. - `texture_image_url` · *string* Image that guides the texture, as a public URL or a data URI (`data:image/png;base64,...`). With `meshy-n1`, Meshy textures from this image as the front view. A one-call task with `texture_model: "meshy-n1"` and an `ai_model` of `meshy-6` or `meshy-6-lite` needs it. The image must be a JPG, JPEG, PNG, or WebP file of at most 20 MB, at least 32 pixels on each side, and at most 178,956,970 pixels (width × height). - `enable_pbr` · *boolean* · default: `false` Whether to also generate metallic, roughness, and normal maps. With `meshy-n1`, `true` returns `400`. - `texture_resolution` · *string* · default: `2k` Size of the base color texture. A preview with this parameter returns `400`. Available values: * `2k` * `4k` * `8k` `4k` and `8k` return `400` with `meshy-n1` or `meshy-6-lite`, whether `texture_model` picks it on a one-call task or `ai_model` picks it on a refine. - `remove_lighting` · *boolean* · default: `true` Whether to remove highlights and shadows from the base color texture. Only `meshy-6` uses this setting. Meshy 7 and Smart Topology models ignore it. With `meshy-6-lite`, sending it returns `400`. - `target_formats` · *string[]* · default: `["glb", "obj", "fbx", "stl", "usdz"]` The file formats to generate. Available values: * `glb` * `obj` * `fbx` * `stl` * `usdz` * `3mf` Text to 3D doesn't apply the 150 mm cap that other v2 endpoints use for print files. STL files keep the model's size, and Meshy scales a `3mf` file to 75 mm tall. - `alpha_thumbnail` · *boolean* · default: `false` Whether to also render a preview with a transparent background, returned in `output.alpha_thumbnail_url`. - `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`. - `moderation` · *boolean* · default: `false` Whether to screen these inputs for harmful content before generating: * `prompt` * `texture_prompt` * `texture_image_url` - `auto_size` · *boolean* · default: `false` Whether to estimate the object's real-world height and scale the model to it. **Only when `auto_size` is set:** - `origin_at` · *string* · default: `bottom` Where to place the model's origin, `bottom` or `center`. ### 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`. The response also has `result`, which repeats the `id` for clients written before v2. These headers help you follow the task: * `Retry-After`: how many seconds to wait before you first read the task * `Location`: `/openapi/v2/text-to-3d/{id}`, a [legacy route](#legacy-routes). Read the task through [Tasks](https://docs.meshy.ai/api/v2/tasks.md#get-a-task) instead. ### Failure modes - `400 - Bad Request` The request can't run. For example: * `prompt` is missing * A textured one-call task didn't send `texture_model` * A one-call task sent `texture_model: "meshy-n1"` with `meshy-6` or `meshy-6-lite` and no `texture_image_url` * The texture model doesn't support an option in the request, for example `enable_pbr: true` with `meshy-n1` * `preview_task_id` doesn't match one of your preview tasks with the status `SUCCEEDED`. The message says whether the task doesn't exist, isn't finished, or isn't a preview. * Both `texture_prompt` and `texture_image_url` were sent * `texture_resolution` was sent with a preview * `geometry_resolution` was sent with a refine, or with a model that can't run it * A one-call task asked for `meshy-7` (send `meshy-7.1` instead) * A one-call task sent a parameter Text to 3D doesn't define, such as a misspelled name. With `mode`, Meshy ignores it. 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` Content moderation blocked the prompt or an input image. Change the input, then retry. - `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 # One call: a textured model in one task curl https://api.meshy.ai/openapi/v2/text-to-3d \ -X POST \ -H "Authorization: Bearer ${MESHY_API_KEY}" \ -H 'Content-Type: application/json' \ -d '{ "prompt": "a small wooden treasure chest with iron bands", "should_texture": true, "texture_model": "meshy-7", "target_formats": ["glb", "fbx"] }' ``` ```javascript // One call: a textured model in one task const response = await fetch("https://api.meshy.ai/openapi/v2/text-to-3d", { method: "POST", headers: { Authorization: `Bearer ${process.env.MESHY_API_KEY}`, "Content-Type": "application/json", }, body: JSON.stringify({ prompt: "a small wooden treasure chest with iron bands", should_texture: true, texture_model: "meshy-7", target_formats: ["glb", "fbx"], }), }); const task = await response.json(); console.log(task.id, task.status); ``` ```python import os import requests # One call: a textured model in one task response = requests.post( "https://api.meshy.ai/openapi/v2/text-to-3d", headers={"Authorization": f"Bearer {os.environ['MESHY_API_KEY']}"}, json={ "prompt": "a small wooden treasure chest with iron bands", "should_texture": True, "texture_model": "meshy-7", "target_formats": ["glb", "fbx"], }, ) response.raise_for_status() task = response.json() print(task["id"], task["status"]) ``` **Response** ```json { "id": "018a210d-8ba4-705c-b111-1f1776f7f578", "type": "text-to-3d", "status": "PENDING", "progress": 0, "created_at": 1790640079880, "started_at": null, "finished_at": null, "expires_at": null, "preceding_tasks": 3, "consumed_credits": 30, "task_error": null, "input": { "prompt": "a small wooden treasure chest with iron bands", "should_texture": true, "texture_model": "meshy-7", "target_formats": ["glb", "fbx"] }, "output": null, "result": "018a210d-8ba4-705c-b111-1f1776f7f578" } ``` --- ## Get the result Read Text to 3D tasks the same way as every other v2 task, through the [Tasks](https://docs.meshy.ai/api/v2/tasks.md) routes. To list Text to 3D tasks, filter by `type`: * `text-to-3d`: all three kinds of Text to 3D task * `text-to-3d-preview`: preview tasks only * `text-to-3d-refine`: refine tasks only One-call tasks have no filter of their own. | 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=text-to-3d`](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) | --- ## Text to 3D 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. For Text to 3D, `expires_at` is always `null`. Meshy still deletes the task 3 days after it finishes, so download the files within that window. Enterprise accounts keep their tasks. See [Asset retention](https://docs.meshy.ai/api/v2/asset-retention.md). - `model_urls` · *object* Signed URLs to the generated files, keyed by format. There is one URL for each format in `target_formats`, or for each default format if you left it out. A textured `obj` also gets an `mtl` key, with the URL of its material file. - `thumbnail_url` · *string* Signed URL to a preview image of the model. - `alpha_thumbnail_url` · *string | null* Signed URL to the preview with a transparent background. `null` unless you sent `alpha_thumbnail: true`. - `texture_urls` · *array* 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 for a preview and for an untextured one-call task. **Succeeded one-call task** ```json { "id": "018a210d-8ba4-705c-b111-1f1776f7f578", "type": "text-to-3d", "status": "SUCCEEDED", "progress": 100, "created_at": 1790640079880, "started_at": 1790640079894, "finished_at": 1790640197052, "expires_at": null, "preceding_tasks": 0, "consumed_credits": 30, "task_error": null, "input": { "prompt": "a small wooden treasure chest with iron bands", "should_texture": true, "texture_model": "meshy-7", "target_formats": ["glb", "fbx"] }, "output": { "model_urls": { "glb": "https://assets.meshy.ai/***/output/model.glb?Expires=***", "fbx": "https://assets.meshy.ai/***/output/model.fbx?Expires=***" }, "thumbnail_url": "https://assets.meshy.ai/***/output/preview.png?Expires=***", "alpha_thumbnail_url": null, "texture_urls": [ { "base_color": "https://assets.meshy.ai/***/output/texture_0.png?Expires=***", "metallic": null, "roughness": null, "normal": null, "metallic_roughness": null, "emission": null } ] } } ``` --- ## Legacy preview and refine `mode` is deprecated and stops working on March 15, 2027. Before then, make the model in one call with `should_texture`, which costs the same as a preview plus a refine. 1. Create a preview with `"mode": "preview"`, your `prompt`, and the geometry parameters, such as `geometry_resolution` and `should_remesh`. The preview makes the untextured mesh. 2. Wait until the preview's status is `SUCCEEDED`. 3. Create a refine with `"mode": "refine"`, the preview's `id` as `preview_task_id`, and the texture parameters. The refine keeps the preview's prompt and mesh. Leave `ai_model` out to texture with the model that matches the preview, which is Meshy 7 for a Smart Topology preview. On a refine, `ai_model` names the texture model, and Meshy ignores `texture_model`: * `meshy-7`: Meshy 7 * `latest`: the newest texture model, now Meshy 7 * `meshy-6`: Meshy 6 * `meshy-6-lite`: Meshy 6 Lite * `meshy-n1`: Meshy N1, a 2K base color texture from a reference image only A Smart Topology preview (`meshy-t2`, `meshy-t2.5`) has no Meshy 6 Lite texturing: a refine of one with `meshy-6-lite` textures with Meshy 6, so with `enable_pbr: true` it also returns an emission map. A `meshy-6-lite` refine of a Meshy 6, Meshy 6 Lite or Meshy 7 preview returns none, and neither does a refine of a Smart Topology preview that doesn't set `ai_model`. To refine with Meshy N1, send `"ai_model": "meshy-n1"`. Meshy textures from `texture_image_url`, or from the reference image that a `meshy-7.1` or `latest` preview stores. Any other preview returns `400` unless you send `texture_image_url`. Meshy N1 makes a 2K base color texture only. Sending any of these with it returns `400`: * `texture_prompt` * `enable_pbr: true` * `remove_lighting: true` * a `texture_resolution` of `4k` or `8k` The preview can have at most 7,999,999 triangles. A preview remeshed to quads returns `400`. To texture a one-call task with Meshy N1, use [Retexture](https://docs.meshy.ai/api/v2/retexture.md). You can refine a preview more than once, for example with different texture prompts, until the preview is deleted. You can't refine a one-call task. Meshy deletes Text to 3D tasks 3 days after they finish, and Enterprise accounts keep theirs. A refine of a deleted preview returns `400`, with the code `input_task_expired` once the retention period has ended. See [Asset retention](https://docs.meshy.ai/api/v2/asset-retention.md). --- ## Legacy routes The Text to 3D read routes from before v2 stop working on March 15, 2027. Before then, move your reads to [Tasks](https://docs.meshy.ai/api/v2/tasks.md). | Route | Use instead | | --- | --- | | `GET /openapi/v2/text-to-3d/{id}` | [`GET /openapi/v2/tasks/{id}`](https://docs.meshy.ai/api/v2/tasks.md#get-a-task) | | `GET /openapi/v2/text-to-3d/{id}/stream` | [`GET /openapi/v2/tasks/{id}/stream`](https://docs.meshy.ai/api/v2/tasks.md#stream-a-task) | | `GET /openapi/v2/text-to-3d` | [`GET /openapi/v2/tasks?type=text-to-3d`](https://docs.meshy.ai/api/v2/tasks.md#list-tasks) | | `DELETE /openapi/v2/text-to-3d/{id}` | [`DELETE /openapi/v2/tasks/{id}`](https://docs.meshy.ai/api/v2/tasks.md#delete-a-task) | These routes return the fields of the [original Text to 3D task object](#the-text-to-3d-task-object), with `task_error` in its v2 form. They also return these fields, the same as Tasks: * `input` * `output` * `expires_at` The list route returns a plain array, with no `has_more`. The same routes under `/v2/text-to-3d`, without `/openapi`, are deprecated. Their responses have a `Deprecation` header, and a `Link` header that points to the `/openapi/v2/text-to-3d` route. ### The original Text to 3D task object The legacy routes return this object. `type` says whether the task is a preview, a refine, or a one-call task. - `id` · *string* The task ID. Treat it as an opaque string, and don't rely on its format. - `type` · *string* The task type: `text-to-3d-preview` for a preview, `text-to-3d-refine` for a refine, or `text-to-3d` for a one-call task. - `model_urls` · *object* Download URLs for the generated 3D model, one per file format. A format the task didn't generate has no key, rather than an empty string. - `glb` · *string* The GLB file. - `fbx` · *string* The FBX file. - `usdz` · *string* The USDZ file. - `obj` · *string* The OBJ file. - `mtl` · *string* The MTL file. - `stl` · *string* The STL file. - `3mf` · *string* The 3MF file. Present only when `target_formats` includes `3mf`. - `prompt` · *string* The `prompt` you sent to create the task, unmodified. - `texture_prompt` · *string* The text prompt you sent to guide the texturing in the refine stage. - `ultra_mode` · *boolean* · **deprecated** Read `geometry_resolution` instead. - `geometry_resolution` · *string* The Ultra tier the preview task ran, `2k` or `4k`. The field is absent for `standard`. - `texture_image_url` · *string* Download URL for the image you sent to guide the texturing. - `thumbnail_url` · *string* Download URL for a thumbnail image of the 3D model. - `alpha_thumbnail_url` · *string* Download URL for a version of `thumbnail_url` with a transparent background (RGBA). Present only when you created the task with `alpha_thumbnail: true` and Meshy rendered the transparent preview. - `progress` · *integer* How much of the task is done, as a percentage. It's `0` until the task starts and `100` when it succeeds. - `started_at` · *timestamp* Time the task started, in Unix milliseconds. It's `0` until the task starts. - `created_at` · *timestamp* Time the task was created, in Unix milliseconds. - `finished_at` · *timestamp* Time the task finished, in Unix milliseconds. It's `0` until the task finishes. - `status` · *string* The task's status. See [How a task runs](https://docs.meshy.ai/api/v2/tasks.md#how-a-task-runs). - `texture_urls` · *array* Download URLs for the generated texture maps, as an array of objects. It usually holds one object. Each object has these fields: - `base_color` · *string* The base color map. - `metallic` · *string* The metallic map. Absent when you created the task with `enable_pbr: false`. - `normal` · *string* The normal map. Absent when you created the task with `enable_pbr: false`. - `roughness` · *string* The roughness map. Absent when you created the task with `enable_pbr: false`. - `emission` · *string* The emission map. Absent in any of these cases: * You created the task with `enable_pbr: false`. * `ai_model` is `meshy-7`, `meshy-7.1`, or `latest`, or it is `meshy-6-lite` on any preview but `meshy-t2` and `meshy-t2.5`. * `texture_resolution` is `8k`. * The task refines a `meshy-t2` or `meshy-t2.5` preview without setting `ai_model`. - `preceding_tasks` · *integer* The number of tasks ahead of this one in the queue. The value is meaningful only while the task is `PENDING`. - `task_error` · *object* The error details when the task fails, in its v2 form. It's `null` unless the status is `FAILED`. See [Task errors](https://docs.meshy.ai/api/v2/errors.md#task-errors). - `consumed_credits` · *integer* The number of credits the task used. Present when the status is `PENDING`, `IN_PROGRESS`, or `SUCCEEDED`. It's `0` for a `FAILED` task, because Meshy refunds the credits when a task fails. **Example Text to 3D Task Object** ```json { "id": "018a210d-8ba4-705c-b111-1f1776f7f578", "type": "text-to-3d-preview", "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=***", "obj": "https://assets.meshy.ai/***/tasks/018a210d-8ba4-705c-b111-1f1776f7f578/output/model.obj?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=***" }, "prompt": "a monster mask", "texture_prompt": "green slimy skin with scales and warts", "texture_image_url": "", "thumbnail_url": "https://assets.meshy.ai/***/tasks/018a210d-8ba4-705c-b111-1f1776f7f578/output/preview.png?Expires=***", "progress": 100, "started_at": 1692771667037, "created_at": 1692771650657, "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", "emission": "https://assets.meshy.ai/***/tasks/018a210d-8ba4-705c-b111-1f1776f7f578/output/texture_0_emission.png?Expires=XXX" } ], "preceding_tasks": 0, "task_error": null, "consumed_credits": 20 } ``` --- # Image to 3D API Source: https://docs.meshy.ai/api/v2/image-to-3d # Image to 3D API Turn one image into a 3D model, textured or untextured, in the formats you choose. > **Note:** Moving from v1? The main changes for Image to 3D: > * `ai_model` is the only model setting. A request with `model_type` returns `400`. > * A textured model needs `texture_model`, the model that paints the mesh. > * `target_formats` defaults to GLB. > * Results are in `output`. > > See [what changed for Image to 3D](/api/migrate-to-v2/reference#image-to-3d). --- ## POST /openapi/v2/image-to-3d -- Create an Image to 3D task Creates an Image to 3D 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 - `image_url` · *string* · **required** Required unless you send `input_task_id`. The image to turn into a model, as a public URL or a data URI (`data:image/png;base64,...`). The image must be a JPG, JPEG, PNG, or WebP file of at most 20 MB, at least 32 pixels on each side, and at most 178,956,970 pixels (width × height). - `input_task_id` · *string* · **required** Required unless you send `image_url`. The ID of a Text to Image or Image to Image task to use as the input. The task must be one you created with the API, have the status `SUCCEEDED`, and have produced exactly one image. If you send both `image_url` and `input_task_id`, Meshy uses `input_task_id`. For a multi-view image task, use [Multi-Image to 3D](https://docs.meshy.ai/api/v2/multi-image-to-3d.md). - `ai_model` · *string* · default: `latest` The model that generates the 3D model. This is the only model setting. Standard models: * `latest`: Meshy 7.1 * `meshy-7.1` * `meshy-6` * `meshy-6-lite` * `meshy-standard-latest`: same as `latest` Smart Topology models build a clean triangle mesh at the face count you set with `target_polycount`: * `meshy-t2.5`: sharper detail for game assets * `meshy-t2` * `meshy-smart-topology-latest`: Meshy T2.5, the newest Smart Topology model. Results can change when a new one comes out. For results that stay the same, send `meshy-t2.5`. See [Models](https://docs.meshy.ai/api/v2/models.md#choose-by-project) for which model fits your project, such as a game character or a 3D print. - `geometry_resolution` · *string* · default: `standard` How much geometry detail to generate. Available values: * `standard` * `2k`: adds the Ultra pass * `4k`: adds the Ultra pass, then a super-resolution pass `2k` and `4k` need `meshy-7.1` or `latest`. With other models, they return `400`. - `should_texture` · *boolean* · default: `true` Whether to generate textures. `true` returns a textured model, and `false` returns an untextured mesh. With `false`, Meshy ignores `texture_model` and the other texture parameters. **Only when `should_texture` is set:** - `texture_model` · *string* · **required** Required unless `should_texture` is `false`. The model that textures the 3D model, in the same task. Every `ai_model` takes each of these values. Available values: * `meshy-7`: Meshy 7, with PBR maps, a text prompt, and textures up to 8K * `meshy-n1`: Meshy N1, a 2K base color texture from reference images only * `meshy-6-lite`: Meshy 6 Lite, a 2K texture A textured request without `texture_model` returns `400`, and so does an option the texture model doesn't support. The texture model doesn't change the credit cost. See [Texture models](#texture-models). - `enable_pbr` · *boolean* · default: `false` Whether to also generate metallic, roughness, and normal maps. With `texture_model: "meshy-n1"`, `true` returns `400`. - `texture_resolution` · *string* · default: `2k` Size of the base color texture. Available values: * `2k` * `4k` * `8k` `4k` and `8k` need `texture_model: "meshy-7"`. With `meshy-n1` or `meshy-6-lite`, they return `400`. - `texture_prompt` · *string* Text that guides the texture, up to 800 characters. Longer text returns `400`. Send `texture_prompt` or `texture_image_url`, not both. Sending both returns `400`. With `texture_model: "meshy-n1"`, sending it returns `400`. - `texture_image_url` · *string* Image that guides the texture, as a public URL or a data URI. It follows the same format and size rules as `image_url`. With `texture_model: "meshy-n1"`, Meshy textures from this image as the front view, or from the input image when you leave it out. - `target_formats` · *string[]* · default: `["glb"]` The file formats to generate. Meshy generates only the formats you list. Available values: * `glb` * `obj` * `fbx` * `stl` * `usdz` * `3mf` Meshy scales STL and 3MF files down to at most 150 mm on the longest side. - `should_remesh` · *boolean* · default: `true (meshy-6-lite), false (other models)` Whether to remesh the model after generation. `false` keeps the mesh as generated. Smart Topology models ignore this setting. **Only when `should_remesh` is set:** - `topology` · *string* · default: `triangle` The face type of the remeshed model, `triangle` or `quad`. Smart Topology models make triangles only, so `quad` with a Smart Topology model returns `400`. With `texture_model: "meshy-n1"`, `quad` returns `400` when the model is remeshed, which `meshy-6-lite` does by default. - `decimation_mode` · *integer* Adaptive face count, by level. When you set it, Meshy ignores `target_polycount`. Available values: * `1`: ultra * `2`: high * `3`: medium * `4`: low - `save_pre_remeshed_model` · *boolean* · default: `false` Whether to also return the GLB from before the remesh, in `output.model_urls.pre_remeshed_glb`. - `target_polycount` · *integer* The number of faces to aim for. The range and default depend on how the mesh is built: | Mesh | Range | Default | | --- | --- | --- | | Remeshed | `100` to `300000` | `30000` | | `meshy-t2.5` or `meshy-smart-topology-latest` | `100` to `30000` | `15000` | | `meshy-t2` | `100` to `15000` | `4000` | A value outside the range returns `400`. For a low-poly game asset, use a Smart Topology model instead of remeshing a standard model. See [Models](https://docs.meshy.ai/api/v2/models.md#choose-by-project). - `auto_polycount` · *boolean* Set it to `true` to have Meshy choose the face count from the input image, within `meshy-t2.5`'s range. It applies only to `meshy-t2.5` (or `meshy-smart-topology-latest`, which resolves to it). With any other `ai_model`, or together with `target_polycount`, the request returns `400` (`parameters_conflict`). If Meshy can't recommend a face count for the image, the task uses `meshy-t2.5`'s default; the request still succeeds. The task's `output.target_polycount` shows the face count the task used. Defaults to `false`. - `pose_mode` · *string* The pose for a character model, `a-pose` or `t-pose`. Leave it out for no pose. - `image_enhancement` · *boolean* · default: `true` Whether to clean up the input image before generating. `false` uses the image exactly as it is. `meshy-6-lite` and Smart Topology models ignore this setting. - `remove_lighting` · *boolean* · default: `true` Whether to remove highlights and shadows from the base color texture. The texture models that `texture_model` takes don't use this setting, so Meshy ignores it. - `moderation` · *boolean* · default: `false` Whether to screen these inputs for harmful content before generating: * The input image * `texture_image_url` * `texture_prompt` - `auto_size` · *boolean* · default: `false` Whether to estimate the object's real-world height and scale the model to it. **Only when `auto_size` is set:** - `origin_at` · *string* · default: `bottom` Where to place the model's origin, `bottom` or `center`. - `multi_view_thumbnails` · *boolean* · default: `false` Whether to also render front, right, back, and left previews, returned in `output.thumbnail_urls`. This adds about 5 seconds to the task. - `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 `image_url` nor `input_task_id` was sent * A textured request didn't send `texture_model` * Both `texture_prompt` and `texture_image_url` were sent * The image can't be downloaded, is over 20 MB, or is outside the pixel limits * `geometry_resolution` isn't available for the model * The texture model doesn't support an option in the request, for example `enable_pbr: true` or a `4k` texture with `meshy-n1` 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` Content moderation blocked the prompt or an input image. Change the input, then retry. - `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 # One image, textured with Meshy 7: a GLB curl https://api.meshy.ai/openapi/v2/image-to-3d \ -X POST \ -H "Authorization: Bearer ${MESHY_API_KEY}" \ -H 'Content-Type: application/json' \ -d '{ "image_url": "https://docs.meshy.ai/images/api/quick-start/source-photo.webp", "texture_model": "meshy-7" }' # Smart Topology at 8,000 faces, 4K textures, GLB and FBX curl https://api.meshy.ai/openapi/v2/image-to-3d \ -X POST \ -H "Authorization: Bearer ${MESHY_API_KEY}" \ -H 'Content-Type: application/json' \ -d '{ "image_url": "https://docs.meshy.ai/images/api/quick-start/source-photo.webp", "ai_model": "meshy-t2", "target_polycount": 8000, "texture_model": "meshy-7", "texture_resolution": "4k", "target_formats": ["glb", "fbx"] }' ``` ```javascript // One image, textured with Meshy 7: a GLB const response = await fetch("https://api.meshy.ai/openapi/v2/image-to-3d", { method: "POST", headers: { Authorization: `Bearer ${process.env.MESHY_API_KEY}`, "Content-Type": "application/json", }, body: JSON.stringify({ image_url: "https://docs.meshy.ai/images/api/quick-start/source-photo.webp", texture_model: "meshy-7", }), }); const task = await response.json(); console.log(task.id, task.status); ``` ```python import os import requests # One image, textured with Meshy 7: a GLB response = requests.post( "https://api.meshy.ai/openapi/v2/image-to-3d", headers={"Authorization": f"Bearer {os.environ['MESHY_API_KEY']}"}, json={ "image_url": "https://docs.meshy.ai/images/api/quick-start/source-photo.webp", "texture_model": "meshy-7", }, ) response.raise_for_status() task = response.json() print(task["id"], task["status"]) ``` **Response** ```json { "id": "018a210d-8ba4-705c-b111-1f1776f7f578", "type": "image-to-3d", "status": "PENDING", "progress": 0, "created_at": 1790640079880, "started_at": null, "finished_at": null, "expires_at": null, "preceding_tasks": 3, "consumed_credits": 30, "task_error": null, "input": { "image_url": "https://docs.meshy.ai/images/api/quick-start/source-photo.webp", "texture_model": "meshy-7" }, "output": null } ``` --- ## Texture models `ai_model` picks the model that builds the mesh, and `texture_model` picks the model that paints it. `texture_model` has no default, so every textured request sends it. To choose a pair for your project, see [Models](https://docs.meshy.ai/api/v2/models.md#choose-by-project). The following table shows the texture models that each `ai_model` takes on each endpoint. Any other pair returns `400`. | `ai_model` | Image to 3D | [Multi-Image to 3D](https://docs.meshy.ai/api/v2/multi-image-to-3d.md) | [Text to 3D](https://docs.meshy.ai/api/v2/text-to-3d.md) | | --- | --- | --- | --- | | `meshy-7.1`, `latest`, or `meshy-standard-latest` | `meshy-7`, `meshy-n1`, or `meshy-6-lite` | `meshy-7` or `meshy-n1` | `meshy-7`, `meshy-n1`, or `meshy-6-lite` | | `meshy-6` | `meshy-7`, `meshy-n1`, or `meshy-6-lite` | `meshy-7` or `meshy-n1` | `meshy-7`, `meshy-n1` with `texture_image_url`, or `meshy-6-lite` | | `meshy-6-lite` | `meshy-7`, `meshy-n1`, or `meshy-6-lite` | `meshy-7` or `meshy-n1` | `meshy-7`, `meshy-n1` with `texture_image_url`, or `meshy-6-lite` | | `meshy-t2.5`, `meshy-t2`, or `meshy-smart-topology-latest` | `meshy-7`, `meshy-n1`, or `meshy-6-lite` | None. Multi-Image to 3D has no Smart Topology models. | `meshy-7`, `meshy-n1`, or `meshy-6-lite` | [Retexture](https://docs.meshy.ai/api/v2/retexture.md) takes `meshy-7`, `meshy-n1`, or `meshy-6-lite` for any model. Each texture model supports a different set of options. The following table shows them. A request that asks a texture model for an option it doesn't support returns `400`. | Option | `meshy-7` | `meshy-n1` | `meshy-6-lite` | | --- | --- | --- | --- | | `texture_resolution` | `2k`, `4k`, or `8k` | `2k` | `2k` | | `enable_pbr: true` | Yes | No | Yes | | `texture_prompt` | Yes | No | Yes | | `texture_image_url` | Yes | Yes, as the front view | Yes | | Several reference images: `texture_image_urls` or `multiview_image_urls` | Yes | Yes | No | | `topology: "quad"` on a remeshed model | Yes | No | Yes | Meshy N1 textures models of up to 7,999,999 triangles. If the generated model is larger, the task fails, and Meshy refunds its credits. The texture model doesn't change the price. A textured task costs the mesh plus the texture at its resolution. See [Pricing](/api/pricing). --- ## Get the result Read Image to 3D tasks the same way as every other v2 task, through the [Tasks](https://docs.meshy.ai/api/v2/tasks.md) routes. To list only Image to 3D tasks, filter by `type=image-to-3d`. | 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=image-to-3d`](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) | --- ## Image to 3D 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 generated files, one per format in `target_formats`, keyed by format. Two more keys can appear: * `mtl`: the material file of a textured `obj` * `pre_remeshed_glb`: the GLB from before the remesh, when you sent `save_pre_remeshed_model: true` and the model was remeshed - `thumbnail_url` · *string* Signed URL to a PNG preview of the model, with a transparent background. - `thumbnail_urls` · *object | null* Signed URLs to the previews, keyed by view: * `front` * `right` * `back` * `left` `null` unless you sent `multi_view_thumbnails: true`. A view that failed to render is left out. - `texture_urls` · *array* 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 for an untextured model. - `target_polycount` · *integer* The face count a Smart Topology task (`meshy-t2` or `meshy-t2.5`) generated at: the `target_polycount` you sent, the one `auto_polycount` picked, or the model's default. Other tasks leave it out. **Succeeded Image to 3D task** ```json { "id": "018a210d-8ba4-705c-b111-1f1776f7f578", "type": "image-to-3d", "status": "SUCCEEDED", "progress": 100, "created_at": 1790640079880, "started_at": 1790640079892, "finished_at": 1790640153381, "expires_at": 1790899353381, "preceding_tasks": 0, "consumed_credits": 30, "task_error": null, "input": { "image_url": "https://docs.meshy.ai/images/api/quick-start/source-photo.webp", "texture_model": "meshy-7", "target_formats": ["glb", "fbx"] }, "output": { "model_urls": { "glb": "https://assets.meshy.ai/***/output/model.glb?Expires=***", "fbx": "https://assets.meshy.ai/***/output/model.fbx?Expires=***" }, "thumbnail_url": "https://assets.meshy.ai/***/output/preview.png?Expires=***", "thumbnail_urls": null, "texture_urls": [ { "base_color": "https://assets.meshy.ai/***/output/texture_0.png?Expires=***", "metallic": null, "roughness": null, "normal": null, "metallic_roughness": null, "emission": null } ] } } ``` --- # Multi-Image to 3D API Source: https://docs.meshy.ai/api/v2/multi-image-to-3d # Multi-Image to 3D API Turn one to four images of the same object, from different angles, into one 3D model. > **Note:** Moving from v1? The main changes for Multi-Image to 3D: > * `target_formats` defaults to GLB. > * A textured model needs `texture_model` set to `meshy-7` or `meshy-n1`. > * Sending both `texture_prompt` and `texture_image_url` returns `400`. > * Results are in `output`. > > See [what changed for Multi-Image to 3D](/api/migrate-to-v2/reference#image-to-3d). --- ## POST /openapi/v2/multi-image-to-3d -- Create a Multi-Image to 3D task Creates a Multi-Image to 3D 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 - `image_urls` · *string[]* · **required** Required unless you send `input_task_id`. One to four images of the same object, each as a public URL or a data URI (`data:image/png;base64,...`). Put the front view first. Meshy uses the first image as the front view. With `meshy-7.1` or `latest`, the order of the others doesn't matter. More than four images returns `400`. Each image must be a JPG, JPEG, PNG, or WebP file of at most 20 MB, at least 32 pixels on each side, and at most 178,956,970 pixels (width × height). - `input_task_id` · *string* · **required** Required unless you send `image_urls`. The ID of a Text to Image or Image to Image task to use as the input, including a multi-view one. The task must be one you created with the API and have the status `SUCCEEDED`. Meshy uses its images, one to four, as the input. If you send both `image_urls` and `input_task_id`, Meshy uses `input_task_id`. - `ai_model` · *string* · default: `latest` The model that generates the 3D model. Available values: * `latest`: Meshy 7.1 * `meshy-7.1` * `meshy-6` * `meshy-6-lite` * `meshy-standard-latest`: same as `latest` Smart Topology models aren't available for Multi-Image to 3D, and return `400`. See [Models](https://docs.meshy.ai/api/v2/models.md#choose-by-project) for which model fits your project, such as a real object or a 3D print. - `geometry_resolution` · *string* · default: `standard` How much geometry detail to generate. Available values: * `standard` * `2k`: adds the Ultra pass `2k` needs `meshy-7.1` or `latest`. With other models, it returns `400`. Multi-Image to 3D has no `4k`, so `4k` returns `400`. - `should_texture` · *boolean* · default: `true` Whether to generate textures. `true` returns a textured model, and `false` returns an untextured mesh. With `false`, Meshy ignores `texture_model` and the other texture parameters. **Only when `should_texture` is set:** - `texture_model` · *string* · **required** Required unless `should_texture` is `false`. The model that textures the 3D model, in the same task. Every `ai_model` takes each of these values. Available values: * `meshy-7`: Meshy 7, with PBR maps, a text prompt, and textures up to 8K * `meshy-n1`: Meshy N1, a 2K base color texture from reference images only Multi-Image to 3D takes only texture models that paint from several views, so any other value returns `400`. A textured request without `texture_model` returns `400`, and so does an option the texture model doesn't support. The texture model doesn't change the credit cost. See [Texture models](https://docs.meshy.ai/api/v2/image-to-3d.md#texture-models). - `enable_pbr` · *boolean* · default: `false` Whether to also generate metallic, roughness, and normal maps. With `texture_model: "meshy-n1"`, `true` returns `400`. - `texture_resolution` · *string* · default: `2k` Size of the base color texture. Available values: * `2k` * `4k` * `8k` `4k` and `8k` need `texture_model: "meshy-7"`. With `meshy-n1`, they return `400`. - `texture_prompt` · *string* Text that guides the texture, up to 800 characters. Longer text returns `400`. With `texture_model: "meshy-n1"`, sending it returns `400`. - `texture_image_url` · *string* One image that guides the texture, as a public URL or a data URI. It follows the same format and size rules as the images in `image_urls`. With `texture_model: "meshy-n1"`, Meshy textures from this image as the front view. - `texture_image_urls` · *string[]* One to four images of the object that guide the texture. They follow the same format and size rules as the images in `image_urls`, and they can differ from `image_urls`. Meshy uses the first image as the front view. The order of the other views (left, back, right) doesn't matter. An empty list, or more than four images, returns `400`. Send at most one of `texture_prompt`, `texture_image_url`, and `texture_image_urls`. Sending two or more returns `400`. - `target_formats` · *string[]* · default: `["glb"]` The file formats to generate. Meshy generates only the formats you list. Available values: * `glb` * `obj` * `fbx` * `stl` * `usdz` * `3mf` Meshy scales STL and 3MF files down to at most 150 mm on the longest side. - `should_remesh` · *boolean* · default: `true (meshy-6-lite), false (other models)` Whether to remesh the model after generation. `false` keeps the mesh as generated. **Only when `should_remesh` is set:** - `topology` · *string* · default: `triangle` The face type of the remeshed model, `triangle` or `quad`. With `texture_model: "meshy-n1"`, `quad` returns `400`. - `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. When you set it, Meshy ignores `target_polycount`. Available values: * `1`: ultra * `2`: high * `3`: medium * `4`: low - `save_pre_remeshed_model` · *boolean* · default: `false` Whether to also return the GLB from before the remesh, in `output.model_urls.pre_remeshed_glb`. - `pose_mode` · *string* The pose for a character model, `a-pose` or `t-pose`. Leave it out for no pose. - `image_enhancement` · *boolean* · default: `true` Whether to clean up the input images before generating. `false` uses the images exactly as they are. `meshy-6-lite` ignores this setting. - `remove_lighting` · *boolean* · default: `true` Whether to remove highlights and shadows from the base color texture. The texture models that `texture_model` takes don't use this setting, so Meshy ignores it. - `moderation` · *boolean* · default: `false` Whether to screen these inputs for harmful content before generating: * The input images * `texture_image_url` or `texture_image_urls` * `texture_prompt` - `auto_size` · *boolean* · default: `false` Whether to estimate the object's real-world height and scale the model to it. **Only when `auto_size` is set:** - `origin_at` · *string* · default: `bottom` Where to place the model's origin, `bottom` or `center`. - `multi_view_thumbnails` · *boolean* · default: `false` Whether to also render front, right, back, and left previews, returned in `output.thumbnail_urls`. This adds about 5 seconds to the task. - `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 `image_urls` nor `input_task_id` was sent * There are more than four images * A textured request didn't send `texture_model`, or sent `meshy-6-lite` * Two texture inputs were sent * An image can't be downloaded, is over 20 MB, or is outside the pixel limits * `geometry_resolution` isn't available for the model * The texture model doesn't support an option in the request, for example `enable_pbr: true` or a `4k` texture with `meshy-n1` * `ai_model` is a Smart Topology model 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` Content moderation blocked the prompt or an input image. Change the input, then retry. - `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 # Two views, textured with Meshy 7: a GLB curl https://api.meshy.ai/openapi/v2/multi-image-to-3d \ -X POST \ -H "Authorization: Bearer ${MESHY_API_KEY}" \ -H 'Content-Type: application/json' \ -d '{ "image_urls": [ "https://docs.meshy.ai/images/api/quick-start/source-photo.webp", "https://docs.meshy.ai/images/api/quick-start/source-photo.webp" ], "texture_model": "meshy-7" }' # Ultra geometry, PBR maps, GLB and USDZ curl https://api.meshy.ai/openapi/v2/multi-image-to-3d \ -X POST \ -H "Authorization: Bearer ${MESHY_API_KEY}" \ -H 'Content-Type: application/json' \ -d '{ "image_urls": [ "https://docs.meshy.ai/images/api/quick-start/source-photo.webp", "https://docs.meshy.ai/images/api/quick-start/source-photo.webp" ], "geometry_resolution": "2k", "texture_model": "meshy-7", "enable_pbr": true, "target_formats": ["glb", "usdz"] }' ``` ```javascript // Two views, textured with Meshy 7: a GLB const response = await fetch("https://api.meshy.ai/openapi/v2/multi-image-to-3d", { method: "POST", headers: { Authorization: `Bearer ${process.env.MESHY_API_KEY}`, "Content-Type": "application/json", }, body: JSON.stringify({ image_urls: [ "https://docs.meshy.ai/images/api/quick-start/source-photo.webp", "https://docs.meshy.ai/images/api/quick-start/source-photo.webp", ], texture_model: "meshy-7", }), }); const task = await response.json(); console.log(task.id, task.status); ``` ```python import os import requests # Two views, textured with Meshy 7: a GLB response = requests.post( "https://api.meshy.ai/openapi/v2/multi-image-to-3d", headers={"Authorization": f"Bearer {os.environ['MESHY_API_KEY']}"}, json={ "image_urls": [ "https://docs.meshy.ai/images/api/quick-start/source-photo.webp", "https://docs.meshy.ai/images/api/quick-start/source-photo.webp", ], "texture_model": "meshy-7", }, ) response.raise_for_status() task = response.json() print(task["id"], task["status"]) ``` **Response** ```json { "id": "018a210d-8ba4-705c-b111-1f1776f7f578", "type": "multi-image-to-3d", "status": "PENDING", "progress": 0, "created_at": 1790640079880, "started_at": null, "finished_at": null, "expires_at": null, "preceding_tasks": 3, "consumed_credits": 30, "task_error": null, "input": { "image_urls": [ "https://docs.meshy.ai/images/api/quick-start/source-photo.webp", "https://docs.meshy.ai/images/api/quick-start/source-photo.webp" ], "texture_model": "meshy-7" }, "output": null } ``` --- ## Get the result Read Multi-Image to 3D tasks the same way as every other v2 task, through the [Tasks](https://docs.meshy.ai/api/v2/tasks.md) routes. To list only Multi-Image to 3D tasks, filter by `type=multi-image-to-3d`. | 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=multi-image-to-3d`](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) | --- ## Multi-Image to 3D 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 generated files, one per format in `target_formats`, keyed by format. Two more keys can appear: * `mtl`: the material file of a textured `obj` * `pre_remeshed_glb`: the GLB from before the remesh, when you sent `save_pre_remeshed_model: true` and the model was remeshed - `thumbnail_url` · *string* Signed URL to a PNG preview of the model, with a transparent background. - `thumbnail_urls` · *object | null* Signed URLs to the previews, keyed by view: * `front` * `right` * `back` * `left` `null` unless you sent `multi_view_thumbnails: true`. A view that failed to render is left out. - `texture_urls` · *array* 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 for an untextured model. **Succeeded Multi-Image to 3D task** ```json { "id": "018a210d-8ba4-705c-b111-1f1776f7f578", "type": "multi-image-to-3d", "status": "SUCCEEDED", "progress": 100, "created_at": 1790640079880, "started_at": 1790640079893, "finished_at": 1790640183455, "expires_at": 1790899383455, "preceding_tasks": 0, "consumed_credits": 30, "task_error": null, "input": { "image_urls": [ "https://docs.meshy.ai/images/api/quick-start/source-photo.webp", "https://docs.meshy.ai/images/api/quick-start/source-photo.webp" ], "texture_model": "meshy-7" }, "output": { "model_urls": { "glb": "https://assets.meshy.ai/***/output/model.glb?Expires=***" }, "thumbnail_url": "https://assets.meshy.ai/***/output/preview.png?Expires=***", "thumbnail_urls": null, "texture_urls": [ { "base_color": "https://assets.meshy.ai/***/output/texture_0.png?Expires=***", "metallic": null, "roughness": null, "normal": null, "metallic_roughness": null, "emission": null } ] } } ``` --- # Remesh API Source: https://docs.meshy.ai/api/v2/remesh # 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: faces, the limit for files over 100 MB is `) * 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 "": 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": "", "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": "", "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 } ] } } ``` --- # Convert API Source: https://docs.meshy.ai/api/v2/convert # Convert API Convert a 3D model to other file formats, from a Meshy task or from your own model file. > **Note:** Moving from v1? The request is the same as on v1. The main changes for Convert: > * A `model_url` upload keeps its size in every format. > * STL and 3MF files follow the v2 [model size](/api/migrate-to-v2/reference#model-size) rules. > * Results are in `output`. > > See [what changed for Convert](/api/migrate-to-v2/reference#convert-and-resize). --- ## POST /openapi/v2/convert -- Create a Convert task Creates a Convert 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, Remesh, Resize, or Retexture task. The task must be one you created with the API and have the status `SUCCEEDED`. A task with quad topology, such as a Remesh task with `topology: quad`, keeps its quads in OBJ, FBX, and Blend files. STL, USDZ, 3MF, and GLB files have triangle faces. - `model_url` · *string* · **required** Required unless you send `input_task_id`. The model to convert, 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 converted model keeps the file's size. Meshy returns it as one centered mesh, without rigs or animations, so the model doesn't keep its position. See [Model size](/api/migrate-to-v2/reference#model-size). To keep a model's exact position, convert a Meshy task with `input_task_id`. - `target_formats` · *string[]* · **required** The file formats to generate. List at least one. A missing or empty list returns `400`. Available values: * `glb` * `obj` * `fbx` * `stl` * `usdz` * `blend` * `3mf` Every format keeps the size of the model you convert, except STL and 3MF files of a model Meshy generated. Meshy scales those down to at most 150 mm on the longest side. Uploaded models, and models you resized with `resize_height` or `resize_longest_side`, keep their own size in every format. A scaled-down STL file, and every 3MF file, has its origin at the bottom. See [Model size](/api/migrate-to-v2/reference#model-size). ### 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 * `target_formats` is missing or empty * 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: faces, the limit for files over 100 MB is `) * 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`) 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 convert. 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 # Convert a Meshy task 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": "018a210d-8ba4-705c-b111-1f1776f7f578", "target_formats": ["fbx", "usdz"] }' # Convert a model file to STL for printing curl https://api.meshy.ai/openapi/v2/convert \ -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", "target_formats": ["stl"] }' ``` ```javascript // Convert a model file to FBX and USDZ const response = await fetch("https://api.meshy.ai/openapi/v2/convert", { 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", target_formats: ["fbx", "usdz"], }), }); const task = await response.json(); console.log(task.id, task.status); ``` ```python import os import requests # Convert a model file to FBX and USDZ response = requests.post( "https://api.meshy.ai/openapi/v2/convert", headers={"Authorization": f"Bearer {os.environ['MESHY_API_KEY']}"}, json={ "model_url": "https://cdn.meshy.ai/model/example_model_2.glb", "target_formats": ["fbx", "usdz"], }, ) response.raise_for_status() task = response.json() print(task["id"], task["status"]) ``` **Response** ```json { "id": "0199a8f6-3d27-7c2e-9b41-6e0c5d2f8a13", "type": "convert", "status": "PENDING", "progress": 0, "created_at": 1790640079880, "started_at": null, "finished_at": null, "expires_at": null, "preceding_tasks": 1, "consumed_credits": 1, "task_error": null, "input": { "input_task_id": "018a210d-8ba4-705c-b111-1f1776f7f578", "target_formats": ["fbx", "usdz"] }, "output": null } ``` --- ## Get the result Read Convert tasks the same way as every other v2 task, through the [Tasks](https://docs.meshy.ai/api/v2/tasks.md) routes. To list only Convert tasks, filter by `type=convert`. | 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=convert`](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) | --- ## Convert 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 converted files, one per format in `target_formats`, keyed by format. A textured `obj` comes with an `mtl`. - `texture_urls` · *array* Signed URLs to the model's texture maps, in the same item shape as other tasks. For `input_task_id`, these are the texture maps of that task. The array is empty for `model_url`, and for a task without texture maps. Convert tasks have no preview image, so `output` has no `thumbnail_url`. **Succeeded Convert task** ```json { "id": "0199a8f6-3d27-7c2e-9b41-6e0c5d2f8a13", "type": "convert", "status": "SUCCEEDED", "progress": 100, "created_at": 1790640079880, "started_at": 1790640079884, "finished_at": 1790640091206, "expires_at": 1790899291206, "preceding_tasks": 0, "consumed_credits": 1, "task_error": null, "input": { "input_task_id": "018a210d-8ba4-705c-b111-1f1776f7f578", "target_formats": ["fbx", "usdz"] }, "output": { "model_urls": { "fbx": "https://assets.meshy.ai/***/output/model.fbx?Expires=***", "usdz": "https://assets.meshy.ai/***/output/model.usdz?Expires=***" }, "texture_urls": [] } } ``` --- # Resize API Source: https://docs.meshy.ai/api/v2/resize # Resize API Scale a 3D model to a real-world size, in meters, and set where its origin goes. > **Note:** Moving from v1? The request is the same as on v1, and results are in `output`. See [what changed for Resize](/api/migrate-to-v2/reference#convert-and-resize). --- ## POST /openapi/v2/resize -- Create a Resize task Creates a Resize 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, Remesh, or Retexture task. The task must be one you created with the API and have the status `SUCCEEDED`. Resize uses the task's GLB file and returns a GLB file. - `model_url` · *string* · **required** Required unless you send `input_task_id`. The model to resize, 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. Meshy returns the resized model in the same format as the file, except that a glTF file or a data URI comes back as GLB. To change the size, send one of these size parameters. More than one returns `400`. To move only the origin, send `origin_at` without a size parameter. A request with neither returns `400`. - `resize_height` · *number* · **required** Required unless you send `resize_longest_side`, `auto_size`, or only `origin_at`. The model's new height in meters, greater than 0. A negative value returns `400`. - `resize_longest_side` · *number* · **required** Required unless you send `resize_height`, `auto_size`, or only `origin_at`. The new length of the model's longest side in meters, greater than 0. A negative value returns `400`. The longest side is the largest of the model's bounding-box width, height, and depth, for example the arm span of a character in a T-pose. - `auto_size` · *boolean* · **required** Required unless you send `resize_height`, `resize_longest_side`, or only `origin_at`. Whether to estimate the object's real-world height and scale the model to it. Send `true`. `false` is the same as leaving it out. If Meshy can't estimate the height, the task still succeeds without resizing. A Meshy task keeps its size, and a `model_url` file comes back centered at a standard size. - `origin_at` · *string* · default: `bottom` Where to place the model's origin, `bottom` or `center`. Sent without a size parameter, `origin_at` moves only the origin, and the model keeps its size. A `model_url` file keeps its own size too. If Meshy can't read the file's size, the model comes back at a standard size, with STL and 3MF files at most 150 mm. The default `bottom` applies only when you send a size. ### 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 * Neither a size parameter nor `origin_at` was sent * More than one size parameter was sent * A size isn't greater than 0 * 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: faces, the limit for files over 100 MB is `) * 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`) 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 resize. 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 # Resize a Meshy task to 1.8 m tall, origin at the bottom 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": "018a210d-8ba4-705c-b111-1f1776f7f578", "resize_height": 1.8 }' # Fit a model file in 0.3 m on its longest side, origin at the center curl https://api.meshy.ai/openapi/v2/resize \ -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", "resize_longest_side": 0.3, "origin_at": "center" }' ``` ```javascript // Fit a model file in 0.3 m on its longest side, origin at the center const response = await fetch("https://api.meshy.ai/openapi/v2/resize", { 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", resize_longest_side: 0.3, origin_at: "center", }), }); const task = await response.json(); console.log(task.id, task.status); ``` ```python import os import requests # Fit a model file in 0.3 m on its longest side, origin at the center response = requests.post( "https://api.meshy.ai/openapi/v2/resize", headers={"Authorization": f"Bearer {os.environ['MESHY_API_KEY']}"}, json={ "model_url": "https://cdn.meshy.ai/model/example_model_2.glb", "resize_longest_side": 0.3, "origin_at": "center", }, ) response.raise_for_status() task = response.json() print(task["id"], task["status"]) ``` **Response** ```json { "id": "0199a8f6-3d27-7c2e-9b41-6e0c5d2f8a13", "type": "resize", "status": "PENDING", "progress": 0, "created_at": 1790640079880, "started_at": null, "finished_at": null, "expires_at": null, "preceding_tasks": 1, "consumed_credits": 1, "task_error": null, "input": { "input_task_id": "018a210d-8ba4-705c-b111-1f1776f7f578", "resize_height": 1.8 }, "output": null } ``` --- ## Convert the result To get the resized model in other formats, run a [Convert](https://docs.meshy.ai/api/v2/convert.md) task with the Resize task's `id` as `input_task_id`. The size of the converted files depends on how you resized the model: * After `resize_height` or `resize_longest_side`, Convert keeps the new size in every format. * After `auto_size`, Meshy scales STL and 3MF files down to at most 150 mm on the longest side. * After `origin_at` alone, the size follows the model you moved. A `model_url` file and a model you resized keep their size in every format. For a model Meshy generated, STL and 3MF files are scaled down to at most 150 mm. A task with quad topology, such as a Remesh task with `topology: quad`, stays quad. Resize resizes its quad model with the GLB file, and Convert returns it in OBJ, FBX, and Blend files. Other tasks that take a Resize task as `input_task_id` use the resized model. This includes an OBJ, FBX, or STL file you resized from `model_url`. --- ## Get the result Read Resize tasks the same way as every other v2 task, through the [Tasks](https://docs.meshy.ai/api/v2/tasks.md) routes. To list only Resize tasks, filter by `type=resize`. | 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=resize`](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) | --- ## Resize 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 URL to the resized model, keyed by its format. The key is `glb` for `input_task_id`. For `model_url`, the key is the format of the file, one of `glb`, `obj`, `fbx`, or `stl`. - `texture_urls` · *array* Signed URLs to the model's texture maps, in the same item shape as other tasks. For `input_task_id`, these are the texture maps of that task. The array is empty for `model_url`, and for a task without texture maps. Resize tasks have no preview image, so `output` has no `thumbnail_url`. **Succeeded Resize task** ```json { "id": "0199a8f6-3d27-7c2e-9b41-6e0c5d2f8a13", "type": "resize", "status": "SUCCEEDED", "progress": 100, "created_at": 1790640079880, "started_at": 1790640079884, "finished_at": 1790640088913, "expires_at": 1790899288913, "preceding_tasks": 0, "consumed_credits": 1, "task_error": null, "input": { "input_task_id": "018a210d-8ba4-705c-b111-1f1776f7f578", "resize_height": 1.8 }, "output": { "model_urls": { "glb": "https://assets.meshy.ai/***/output/model.glb?Expires=***" }, "texture_urls": [] } } ``` --- # UV Unwrap API Source: https://docs.meshy.ai/api/v2/uv-unwrap # UV Unwrap API Generate a fresh UV layout for a 3D model, ready to texture. > **Note:** Moving from v1? The request is the same, and results are in `output`. See [what changed for UV Unwrap](/api/migrate-to-v2/reference#other-endpoints). --- ## POST /openapi/v2/uv-unwrap -- Create a UV Unwrap task Creates a UV Unwrap 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). UV Unwrap works on meshes up to a maximum face count. A mesh with more faces returns `400`, and the message gives the limit. If Meshy can't check the face count before the task starts, the task fails instead. To lower the face count, run [Remesh](https://docs.meshy.ai/api/v2/remesh.md) first. ### Parameters - `input_task_id` · *string* · **required** Required unless you send `model_url`. The ID of a task that produced a 3D model to unwrap, for example a Text to 3D, Image to 3D, or Remesh task. The task must be one you created with the API and have the status `SUCCEEDED`. UV Unwrap reads the task's GLB. - `model_url` · *string* · **required** Required unless you send `input_task_id`. The model to unwrap, 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 a URL, or 100 MB as a data URI. A GLB over 100 MB must not use Draco compression. Another format, or a larger file, returns `400`. To unwrap another format, run [Convert](https://docs.meshy.ai/api/v2/convert.md) to GLB first, and send that task's `id` as `input_task_id`. ### 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 * `model_url` isn't a GLB file * The file can't be downloaded or is too large * A file over 100 MB has too many faces (`model has too many faces: faces, the limit for files over 100 MB is `) * A file over 100 MB has a header that can't be read, for example a Draco-compressed GLB (`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`) * The mesh has more faces than UV Unwrap allows. The message is `The input mesh has faces, exceeding the UV Unwrap maximum of . Run remesh first.` 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 unwrap. 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 # Unwrap a Meshy task, such as a Remesh result curl https://api.meshy.ai/openapi/v2/uv-unwrap \ -X POST \ -H "Authorization: Bearer ${MESHY_API_KEY}" \ -H 'Content-Type: application/json' \ -d '{ "input_task_id": "018a210d-8ba4-705c-b111-1f1776f7f578" }' ``` ```javascript // Unwrap a Meshy task, such as a Remesh result const response = await fetch("https://api.meshy.ai/openapi/v2/uv-unwrap", { method: "POST", headers: { Authorization: `Bearer ${process.env.MESHY_API_KEY}`, "Content-Type": "application/json", }, body: JSON.stringify({ input_task_id: "018a210d-8ba4-705c-b111-1f1776f7f578", }), }); const task = await response.json(); console.log(task.id, task.status); ``` ```python import os import requests # Unwrap a Meshy task, such as a Remesh result response = requests.post( "https://api.meshy.ai/openapi/v2/uv-unwrap", headers={"Authorization": f"Bearer {os.environ['MESHY_API_KEY']}"}, json={"input_task_id": "018a210d-8ba4-705c-b111-1f1776f7f578"}, ) response.raise_for_status() task = response.json() print(task["id"], task["status"]) ``` **Response** ```json { "id": "0199a8f6-3d27-7c2e-9b41-6e0c5d2f8a13", "type": "uv-unwrap", "status": "PENDING", "progress": 0, "created_at": 1790640079880, "started_at": null, "finished_at": null, "expires_at": null, "preceding_tasks": 1, "consumed_credits": 5, "task_error": null, "input": { "input_task_id": "018a210d-8ba4-705c-b111-1f1776f7f578" }, "output": null } ``` --- ## Get the result Read UV Unwrap tasks the same way as every other v2 task, through the [Tasks](https://docs.meshy.ai/api/v2/tasks.md) routes. To list only UV Unwrap tasks, filter by `type=uv-unwrap`. | 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=uv-unwrap`](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) | --- ## UV Unwrap 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 URL to the unwrapped model, under the `glb` key. - `thumbnail_url` · *string* Signed URL to a preview image of the unwrapped model. UV Unwrap output has no `texture_urls`. The unwrapped model has no textures. To texture it, run [Retexture](https://docs.meshy.ai/api/v2/retexture.md) with the UV Unwrap task's `id` as `input_task_id`. **Succeeded UV Unwrap task** ```json { "id": "0199a8f6-3d27-7c2e-9b41-6e0c5d2f8a13", "type": "uv-unwrap", "status": "SUCCEEDED", "progress": 100, "created_at": 1790640079880, "started_at": 1790640079886, "finished_at": 1790640131664, "expires_at": 1790899331664, "preceding_tasks": 0, "consumed_credits": 5, "task_error": null, "input": { "input_task_id": "018a210d-8ba4-705c-b111-1f1776f7f578" }, "output": { "model_urls": { "glb": "https://assets.meshy.ai/***/output/model.glb?Expires=***" }, "thumbnail_url": "https://assets.meshy.ai/***/output/preview.png?Expires=***" } } ``` --- # Retexture API Source: https://docs.meshy.ai/api/v2/retexture # Retexture API Generate new textures for an existing 3D model from a text prompt or a reference image. > **Note:** Moving from v1? The main changes for Retexture: > * `texture_model` replaces `ai_model`, and every request sends it. It takes `meshy-7`, `meshy-n1`, or `meshy-6-lite`. > * `texture_prompt` and `texture_image_url` replace `text_style_prompt` and `image_style_url`. A request with the old names returns `400`. > * `uv_mode` replaces `enable_original_uv`, and keeps usable UVs by default. > * `hd_texture` returns `400`. Send `"texture_resolution": "4k"` for 4K textures. > * Uploads, and models that get new UVs, keep their size. > * `target_formats` defaults to GLB. > * Results are in `output`. > > See [what changed for Retexture](/api/migrate-to-v2/reference#retexture). --- ## POST /openapi/v2/retexture -- Create a Retexture task Creates a Retexture 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 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 status `SUCCEEDED`. Meshy textures the task's GLB. With `meshy-n1`, the task's model can have at most 7,999,999 faces, counted as triangles (a quad counts as 2). - `model_url` · *string* · **required** Required unless you send `input_task_id`. The model to texture, 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. With `meshy-n1`, the model can have at most 7,999,999 faces, counted as triangles (a quad counts as 2), whatever its file size. The result keeps the file's size. Meshy returns it as one centered mesh, without rigs or animations, so the model doesn't keep its position. See [Model size](/api/migrate-to-v2/reference#model-size). Send one of these three texture inputs. Sending none, or more than one, returns `400`. - `texture_prompt` · *string* · **required** Required unless you send `texture_image_url` or `multiview_image_urls`. Text that describes the new texture, up to 800 characters. Longer text returns `400`. With `meshy-n1`, sending it returns `400`. - `texture_image_url` · *string* · **required** Required unless you send `texture_prompt` or `multiview_image_urls`. An image whose style the texture follows, as a public URL or a data URI (`data:image/png;base64,...`). The texture might not fit well when the object in the image has a very different shape from the model. With `meshy-n1`, Meshy treats the image as the front view. The image must be a JPG, JPEG, PNG, or WebP file of at most 20 MB, and at least 32 pixels on each side. - `multiview_image_urls` · *string[]* · **required** Required unless you send `texture_prompt` or `texture_image_url`. One to four reference images of the same object. The first image is the main (front) view. The order of the other views (left, back, right) doesn't matter. Each image follows the same format and size rules as `texture_image_url`. An empty array, or more than four images, returns `400`. `multiview_image_urls` needs `texture_model` of `meshy-7` or `meshy-n1`. With `meshy-6-lite`, it returns `400`. - `texture_model` · *string* · **required** The model that generates the texture. Available values: * `meshy-7`: Meshy 7, with PBR maps, a text prompt, and textures up to 8K * `meshy-n1`: Meshy N1, a 2K base color texture from reference images only. No text prompt, no PBR maps, no 4K or 8K. Up to 7,999,999 faces. * `meshy-6-lite`: Meshy 6 Lite, a 2K texture A request without `texture_model` returns `400`, and so does any other value. The texture model doesn't change the credit cost. See [Texture models](https://docs.meshy.ai/api/v2/image-to-3d.md#texture-models). - `uv_mode` · *string* · default: `auto` How to handle the model's UV layout. Available values: * `auto`: keep the model's UVs when they're usable, and generate new ones otherwise. * `preserve`: keep the model's UVs. If they all fit in a box smaller than 5% of the UV square, the task fails with [`model_insufficient_uv`](https://docs.meshy.ai/api/v2/errors.md#model-insufficient-uv). To get new UVs instead, use `auto` or `regenerate`. * `regenerate`: always generate new UVs. A model with no UVs gets new ones in every mode. With `input_task_id` and kept UVs, the mesh keeps its size and position. Otherwise, the mesh keeps its size, and Meshy centers it. - `enable_pbr` · *boolean* · default: `false` Whether to also generate metallic, roughness, and normal maps. `false` generates only the base color texture. With `meshy-n1`, `true` returns `400`. - `texture_resolution` · *string* · default: `2k` Size of the base color texture. Available values: * `2k` * `4k` * `8k` With `meshy-6-lite` or `meshy-n1`, `4k` and `8k` return `400`. - `remove_lighting` · *boolean* · default: `true` Whether to remove highlights and shadows from the base color texture. The texture models that `texture_model` takes don't use this setting, so Meshy ignores it. - `target_formats` · *string[]* · default: `["glb"]` The file formats to generate. Meshy generates only the formats you list. Available values: * `glb` * `obj` * `fbx` * `stl` * `usdz` * `3mf` 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_height` or `resize_longest_side`, 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 * No texture input, or more than one, was sent * A parameter Retexture doesn't define was sent, such as the v1 name `text_style_prompt` * `texture_model` is missing or isn't a supported value * `multiview_image_urls` was sent without `texture_model` of `meshy-7` or `meshy-n1` * `meshy-n1` was sent with `texture_prompt`, `enable_pbr: true`, or a `texture_resolution` of `4k` or `8k` * With `meshy-n1`, the 3D model has more than 7,999,999 triangles. Reduce the triangle count, or use another `texture_model`. * With `meshy-n1`, the `model_url` file is too complex for Meshy to count its triangles. Reduce the triangle count, then send the file again. * With `meshy-n1`, counting the triangles of the `model_url` file took too long. Retry, or reduce the model's size. * The input task hasn't succeeded * The model or image can't be downloaded or is too large * A model file over 100 MB has too many faces (`model has too many faces: faces, the limit for files over 100 MB is `) * 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, for example 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`) * `texture_resolution` isn't available for the model With `meshy-n1`, a model that Meshy can't check before the task starts, such as an STL file, isn't refused here. If it has more than 7,999,999 triangles, the task fails, and Meshy refunds its credits. 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` One of these applies: * Content moderation blocked the prompt or an input image. Change the input, then retry. * `input_task_id` is a bas-relief model, which this endpoint can't retexture. 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 # Retexture a model file from a text prompt: a textured GLB curl https://api.meshy.ai/openapi/v2/retexture \ -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", "texture_model": "meshy-7", "texture_prompt": "weathered bronze with green patina" }' # Retexture a Meshy task from a reference image, keep its UVs, add PBR maps and an FBX curl https://api.meshy.ai/openapi/v2/retexture \ -X POST \ -H "Authorization: Bearer ${MESHY_API_KEY}" \ -H 'Content-Type: application/json' \ -d '{ "input_task_id": "018a210d-8ba4-705c-b111-1f1776f7f578", "texture_model": "meshy-7", "texture_image_url": "https://docs.meshy.ai/images/api/quick-start/source-photo.webp", "uv_mode": "preserve", "enable_pbr": true, "target_formats": ["glb", "fbx"] }' # Retexture a model file with Meshy N1 from front and back views: a base color texture only curl https://api.meshy.ai/openapi/v2/retexture \ -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", "texture_model": "meshy-n1", "multiview_image_urls": [ "", "" ] }' ``` ```javascript // Retexture a model file from a text prompt: a textured GLB const response = await fetch("https://api.meshy.ai/openapi/v2/retexture", { 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", texture_model: "meshy-7", texture_prompt: "weathered bronze with green patina", }), }); const task = await response.json(); console.log(task.id, task.status); ``` ```python import os import requests # Retexture a model file from a text prompt: a textured GLB response = requests.post( "https://api.meshy.ai/openapi/v2/retexture", headers={"Authorization": f"Bearer {os.environ['MESHY_API_KEY']}"}, json={ "model_url": "https://cdn.meshy.ai/model/example_model_2.glb", "texture_model": "meshy-7", "texture_prompt": "weathered bronze with green patina", }, ) response.raise_for_status() task = response.json() print(task["id"], task["status"]) ``` **Response** ```json { "id": "018a210d-8ba4-705c-b111-1f1776f7f578", "type": "retexture", "status": "PENDING", "progress": 0, "created_at": 1790640079880, "started_at": null, "finished_at": null, "expires_at": null, "preceding_tasks": 3, "consumed_credits": 10, "task_error": null, "input": { "model_url": "https://cdn.meshy.ai/model/example_model_2.glb", "texture_model": "meshy-7", "texture_prompt": "weathered bronze with green patina" }, "output": null } ``` --- ## Get the result Read Retexture tasks the same way as every other v2 task, through the [Tasks](https://docs.meshy.ai/api/v2/tasks.md) routes. To list only Retexture tasks, filter by `type=retexture`. | 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=retexture`](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) | --- ## Retexture 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 generated files, one per format in `target_formats`, keyed by format. 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 retextured model, with a transparent background. - `texture_urls` · *array* 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`. **Succeeded Retexture task** ```json { "id": "018a210d-8ba4-705c-b111-1f1776f7f578", "type": "retexture", "status": "SUCCEEDED", "progress": 100, "created_at": 1790640079880, "started_at": 1790640079892, "finished_at": 1790640141381, "expires_at": 1790899341381, "preceding_tasks": 0, "consumed_credits": 10, "task_error": null, "input": { "model_url": "https://cdn.meshy.ai/model/example_model_2.glb", "texture_model": "meshy-7", "texture_prompt": "weathered bronze with green patina" }, "output": { "model_urls": { "glb": "https://assets.meshy.ai/***/output/model.glb?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": null, "roughness": null, "normal": null, "metallic_roughness": null, "emission": null } ] } } ``` --- # Rigging API Source: https://docs.meshy.ai/api/v2/rigging # Rigging API Add a skeleton to a humanoid (biped) character or a four-legged (quadruped) animal so you can animate it. Every Rigging task also returns a walking and a running animation of the character. > **Note:** Moving from v1? The main changes for Rigging: > * `skeleton_template` defaults to `mixamo`. > * The request has no `texture_image_url`, and a request with it returns `400`. Meshy uses the textures embedded in the `model_url` file, or the input task's textures. > * Results are in `output` instead of `result`. > * A file that wasn't produced is `null` instead of `""`. > > See [what changed for the other endpoints](/api/migrate-to-v2/reference#other-endpoints). --- ## POST /openapi/v2/rigging -- Create a Rigging task Creates a Rigging 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). To animate the rigged character, send the Rigging task's `id` as `rig_task_id` to [Animation](https://docs.meshy.ai/api/v2/animation.md). To find out before you rig whether Meshy can rig the model, see [Rigging Check](https://docs.meshy.ai/api/v2/rigging-check.md). ### Parameters - `input_task_id` · *string* · **required** Required unless you send `model_url`. The ID of the task whose model to rig. The task must be one you created with the API, have the status `SUCCEEDED`, and have produced a 3D model with a preview image. For example, send a Text to 3D, Image to 3D, Remesh, or Retexture task. A task that hasn't succeeded returns `400`. A task without a preview image returns `404`, for example a Convert task, or a Resize task without `auto_size`. The model can have at most 380,000 triangles (a quad counts as 2), and a model with more returns `400`. Models generated without a remesh often have more. To stay under the limit, generate the model with `should_remesh: true`, or run [Remesh](https://docs.meshy.ai/api/v2/remesh.md) on it first with a `target_polycount` of `300000` or less, or `150000` or less with `topology: quad`. See [Generate and rig a character](#generate-and-rig-a-character). - `model_url` · *string* · **required** Required unless you send `input_task_id`. The character to rig, as a GLB file. Send a public URL whose path ends in `.glb`, or a data URI of a GLB file. Sending both `input_task_id` and `model_url` returns `400`. Meshy rigs the character with the textures embedded in the file. To rig a textured character, embed its textures in the GLB. The character must face the +Z axis, the glTF forward direction. A character that faces another axis can get a wrong skeleton even when the task succeeds, or fail with `422`. The file can be up to 400 MB from a URL, or up to 100 MB as a data URI. A larger file returns `400`. The model can have at most 380,000 triangles (a quad counts as 2), and a model with more returns `400`. To stay under the limit, run [Remesh](https://docs.meshy.ai/api/v2/remesh.md) on it first with a `target_polycount` of `300000` or less, or `150000` or less with `topology: quad`. A file over 100 MB can have at most 10,000,000 faces, and a file with more returns `400`. Meshy counts faces as triangles, and a mesh that the file draws more than once counts once for each copy. A file over 100 MB can't use Draco compression. A Draco-compressed file over 100 MB returns `400`. - `animation_type` · *string* · default: `biped` The kind of character to rig. Any other value returns `400`. Available values: * `biped`: a humanoid character * `quadruped`: a four-legged animal. See [Rig a four-legged animal](#rig-a-four-legged-animal). - `height_meters` · *number* The model's height in meters. Meshy scales the rigged model to this height. Without it, or with `0`, the model keeps its own size. A negative value returns `400`. - `skeleton_template` · *string* · default: `mixamo` The skeleton for the rigged character, which sets its bone names and hierarchy. Pick the one your engine or tool expects. Available values: * `meshyrig`: Meshy's own skeleton * `mixamo`: Mixamo * `ue5_mannequin`: Unreal Engine 5 Mannequin * `max_biped`: 3ds Max Biped * `unity_humanoid`: Unity Humanoid * `maya_human_ik`: Maya HumanIK * `blender_rigify_basic_human`: Blender Rigify basic human * `cc5_hd_neutral_base`: Character Creator 5 HD neutral base * `daz_genesis9`: DAZ Genesis 9 Any other value returns `400`. Works only with a biped rig. The files are in meters. If Meshy can't rig a model on that skeleton, the task fails. The basic animations' clips are named `Walking` and `Running`, as in a download from the Meshy web app. The GLB and FBX files include tip bones at the head, hands, and toes, which carry no skin weight. A few bones, such as `headfront`, keep their original names. [Animation](https://docs.meshy.ai/api/v2/animation.md) tasks made from this rig use the same skeleton. - `include_fingers` · *boolean* · default: `false` Whether to add finger bones to the character's hands. With `meshyrig`, the finger bones use Mixamo names, such as `LeftHandThumb1`. With `true`, these requests return an error, and Meshy doesn't charge for them: * A quadruped rig, or an `input_task_id` whose model has quad topology, returns `400`. * If Meshy can't rig the character's hands with fingers, the task fails. Retry it, or set `include_fingers` to `false`. Meshy finds the fingers automatically and works best on hands with clearly separated fingers. On hands modeled as one shape, such as mittens, gloves, or stylized hands, the rig can have fewer finger bones and animate the hand as one piece. The rest of the skeleton is the same either way. The skeleton might also include extra bones, for example for hair or clothing. Finger bones don't change the credit cost. ### 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 * `input_task_id` doesn't match any of your tasks (`input_task_id does not match any of your tasks`) * The task in `input_task_id` hasn't succeeded. The code is `input_task_not_ready`. Wait until its status is `SUCCEEDED`, then retry. * The model has more than 380,000 triangles (a quad counts as 2) * `model_url` isn't a GLB file, can't be downloaded, or is too large * A `model_url` file over 100 MB has too many faces (`failed to process model for rigging: model has too many faces: faces, the limit for files over 100 MB is `) * A `model_url` file over 100 MB has a header that can't be read, for example a Draco-compressed GLB (`failed to process model for rigging: invalid model file content`) * A `model_url` file over 100 MB has a header too complex to check (`failed to process model for rigging: model header is too complex to check for files over 100 MB`) * `animation_type` isn't `biped` or `quadruped` * `skeleton_template` isn't one of the available values * `skeleton_template`, or `include_fingers` set to `true`, was sent with `animation_type` `quadruped`. The code is `parameters_conflict`. * `include_fingers` is `true` and the `input_task_id` model has quad topology. The code is `input_task_unsupported`. 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 rig. The message is `This model type does not support this operation`. Send a different model. - `404 - Not Found` Meshy can't rig the task in `input_task_id`. The error code says why: * `input_task_unsupported`: the task has no preview image, for example a Convert task, or a Resize task without `auto_size`. Rig the task it came from, or send the model as `model_url`. * `input_task_expired`: the task's files were deleted. Create the task again, then send that task's `id`. - `422 - Unprocessable Entity` Meshy couldn't rig the model. One of these applies: * Meshy found no humanoid character in the model. The code is `model_not_riggable`. With `animation_type: "biped"` (the default), send one humanoid character in a T-pose or A-pose, facing the +Z axis. If the model is a four-legged animal, set `animation_type` to `quadruped`. * The input task's model file isn't a valid GLB. Rig a different task. * Meshy couldn't finish analyzing a `model_url` model. The code is `service_unavailable`, and the request is safe to retry. * Meshy can't rig this model automatically. Rigging works best on a single humanoid character in a T-pose or A-pose, facing the +Z axis. Meshy doesn't charge for the request. - `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. - `503 - Service Unavailable` Meshy couldn't finish analyzing the model's pose. The code is `service_unavailable`. Retry the request. **cURL** ```bash # Rig a character from a Meshy task, scaled to 1.8 m tall curl https://api.meshy.ai/openapi/v2/rigging \ -X POST \ -H "Authorization: Bearer ${MESHY_API_KEY}" \ -H 'Content-Type: application/json' \ -d '{ "input_task_id": "018a210d-8ba4-705c-b111-1f1776f7f578", "height_meters": 1.8 }' ``` ```javascript // Rig a character from a Meshy task, scaled to 1.8 m tall const response = await fetch("https://api.meshy.ai/openapi/v2/rigging", { method: "POST", headers: { Authorization: `Bearer ${process.env.MESHY_API_KEY}`, "Content-Type": "application/json", }, body: JSON.stringify({ input_task_id: "018a210d-8ba4-705c-b111-1f1776f7f578", height_meters: 1.8, }), }); if (!response.ok) throw new Error(await response.text()); const task = await response.json(); console.log(task.id, task.status); ``` ```python import os import requests # Rig a character from a Meshy task, scaled to 1.8 m tall response = requests.post( "https://api.meshy.ai/openapi/v2/rigging", headers={"Authorization": f"Bearer {os.environ['MESHY_API_KEY']}"}, json={ "input_task_id": "018a210d-8ba4-705c-b111-1f1776f7f578", "height_meters": 1.8, }, ) response.raise_for_status() task = response.json() print(task["id"], task["status"]) ``` **Response** ```json { "id": "0199a8f6-3d27-7c2e-9b41-6e0c5d2f8a13", "type": "rig", "status": "PENDING", "progress": 0, "created_at": 1790640079880, "started_at": null, "finished_at": null, "expires_at": null, "preceding_tasks": 1, "consumed_credits": 5, "task_error": null, "input": { "input_task_id": "018a210d-8ba4-705c-b111-1f1776f7f578", "height_meters": 1.8 }, "output": null } ``` --- ## Rig a four-legged animal To rig a four-legged animal, send `animation_type` set to `quadruped`. A quadruped rig differs from a biped rig in these ways: * `basic_animations` has a walking and a running animation of the animal. If Meshy can't make one of them, its URLs are `null`, and the task still succeeds. `walking_armature_glb_url` and `running_armature_glb_url` are the rig's skeleton, with no animation. * Sending `skeleton_template`, or `include_fingers` set to `true`, returns `400`. * If Meshy can't rig the model as a four-legged animal, the task fails. A quadruped rig costs the same as a biped rig. See [Pricing](/api/pricing). To animate the rigged animal, apply library animations whose `rig_type` is `quadruped`, as `action_id` or `action_ids`. See [Animation](https://docs.meshy.ai/api/v2/animation.md#create-an-animation-task). **cURL** ```bash # Rig a four-legged animal curl https://api.meshy.ai/openapi/v2/rigging \ -X POST \ -H "Authorization: Bearer ${MESHY_API_KEY}" \ -H 'Content-Type: application/json' \ -d '{ "input_task_id": "018a210d-8ba4-705c-b111-1f1776f7f578", "animation_type": "quadruped" }' ``` ```javascript // Rig a four-legged animal const response = await fetch("https://api.meshy.ai/openapi/v2/rigging", { method: "POST", headers: { Authorization: `Bearer ${process.env.MESHY_API_KEY}`, "Content-Type": "application/json", }, body: JSON.stringify({ input_task_id: "018a210d-8ba4-705c-b111-1f1776f7f578", animation_type: "quadruped", }), }); if (!response.ok) throw new Error(await response.text()); const task = await response.json(); console.log(task.id, task.status); ``` ```python import os import requests # Rig a four-legged animal response = requests.post( "https://api.meshy.ai/openapi/v2/rigging", headers={"Authorization": f"Bearer {os.environ['MESHY_API_KEY']}"}, json={ "input_task_id": "018a210d-8ba4-705c-b111-1f1776f7f578", "animation_type": "quadruped", }, ) response.raise_for_status() task = response.json() print(task["id"], task["status"]) ``` --- ## Generate and rig a character To rig a character you generate, create an [Image to 3D](https://docs.meshy.ai/api/v2/image-to-3d.md) task for a character in a T-pose, remeshed to stay under the face limit. When the task succeeds, send its `id` as `input_task_id`. The main Image to 3D settings for rigging: * `pose_mode: "t-pose"` generates the character standing in a T-pose. A T-pose or A-pose gives the rig clear arms and legs to work with. * `should_remesh: true` with `target_polycount: 30000` keeps the model well under 380,000 triangles. Meshy charges for each task separately. See [Pricing](/api/pricing). **cURL** ```bash # 1. Generate a character in a T-pose, remeshed to about 30,000 faces curl https://api.meshy.ai/openapi/v2/image-to-3d \ -X POST \ -H "Authorization: Bearer ${MESHY_API_KEY}" \ -H 'Content-Type: application/json' \ -d '{ "image_url": "https://docs.meshy.ai/images/api/quick-start/source-photo.webp", "texture_model": "meshy-7", "pose_mode": "t-pose", "should_remesh": true, "target_polycount": 30000 }' # 2. When the Image to 3D task succeeds, rig it curl https://api.meshy.ai/openapi/v2/rigging \ -X POST \ -H "Authorization: Bearer ${MESHY_API_KEY}" \ -H 'Content-Type: application/json' \ -d '{ "input_task_id": "", "height_meters": 1.8 }' ``` ```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. Generate a character in a T-pose, 2. rig it at 1.8 m tall const character = await wait(await create("image-to-3d", { image_url: "https://docs.meshy.ai/images/api/quick-start/source-photo.webp", texture_model: "meshy-7", pose_mode: "t-pose", should_remesh: true, target_polycount: 30000, })); const rig = await wait(await create("rigging", { input_task_id: character.id, height_meters: 1.8, })); console.log(rig.id, rig.output.rigged_character_glb_url); ``` ```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. Generate a character in a T-pose, 2. rig it at 1.8 m tall character = wait(create("image-to-3d", { "image_url": "https://docs.meshy.ai/images/api/quick-start/source-photo.webp", "texture_model": "meshy-7", "pose_mode": "t-pose", "should_remesh": True, "target_polycount": 30000, })) rig = wait(create("rigging", {"input_task_id": character["id"], "height_meters": 1.8})) print(rig["id"], rig["output"]["rigged_character_glb_url"]) ``` --- ## Get the result Read Rigging tasks the same way as every other v2 task, through the [Tasks](https://docs.meshy.ai/api/v2/tasks.md) routes. To list only Rigging tasks, filter by `type=rig`. | 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=rig`](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) | --- ## Rigging 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`. [Animation](https://docs.meshy.ai/api/v2/animation.md) uses the Rigging task's files, so create your Animation tasks before the Rigging task's `expires_at`. After that, Animation returns `404`. - `rigged_character_glb_url` · *string | null* Signed URL to the rigged character as a GLB file. `null` if the file wasn't produced. - `rigged_character_fbx_url` · *string | null* Signed URL to the rigged character as an FBX file. `null` if the file wasn't produced. - `basic_animations` · *object* Signed URLs to a walking and a running animation of the character, which Meshy makes for every rig. A URL is `null` if that file wasn't produced. * `walking_glb_url`: the walking animation with the character's mesh, as a GLB file * `walking_fbx_url`: the walking animation with the character's mesh, as an FBX file * `walking_armature_glb_url`: the walking animation with the skeleton only, as a GLB file * `running_glb_url`: the running animation with the character's mesh, as a GLB file * `running_fbx_url`: the running animation with the character's mesh, as an FBX file * `running_armature_glb_url`: the running animation with the skeleton only, as a GLB file Rigging tasks have no preview image or texture URLs in `output`. **Succeeded Rigging task** ```json { "id": "0199a8f6-3d27-7c2e-9b41-6e0c5d2f8a13", "type": "rig", "status": "SUCCEEDED", "progress": 100, "created_at": 1790640079880, "started_at": 1790640079889, "finished_at": 1790640089520, "expires_at": 1790899289520, "preceding_tasks": 0, "consumed_credits": 5, "task_error": null, "input": { "input_task_id": "018a210d-8ba4-705c-b111-1f1776f7f578", "height_meters": 1.8 }, "output": { "rigged_character_glb_url": "https://assets.meshy.ai/***/output/Character_output.glb?Expires=***", "rigged_character_fbx_url": "https://assets.meshy.ai/***/output/Character_output.fbx?Expires=***", "basic_animations": { "walking_glb_url": "https://assets.meshy.ai/***/output/Animation_Walking_withSkin.glb?Expires=***", "walking_fbx_url": "https://assets.meshy.ai/***/output/Animation_Walking_withSkin.fbx?Expires=***", "walking_armature_glb_url": "https://assets.meshy.ai/***/output/Animation_Walking_withSkin_armature.glb?Expires=***", "running_glb_url": "https://assets.meshy.ai/***/output/Animation_Running_withSkin.glb?Expires=***", "running_fbx_url": "https://assets.meshy.ai/***/output/Animation_Running_withSkin.fbx?Expires=***", "running_armature_glb_url": "https://assets.meshy.ai/***/output/Animation_Running_withSkin_armature.glb?Expires=***" } } } ``` --- # Rigging Check API Source: https://docs.meshy.ai/api/v2/rigging-check # Rigging Check API Find out before you rig whether Meshy can rig and animate a model, and which `animation_type` it fits. To rig the model, see [Rigging](https://docs.meshy.ai/api/v2/rigging.md). > **Note:** Moving from v1? The request is the same. The main changes for Rigging Check: > * The create response is the [task object](https://docs.meshy.ai/api/v2/tasks.md#the-task-object) instead of an object with the task ID in `result`. > * Read the task through [Tasks](https://docs.meshy.ai/api/v2/tasks.md) instead of `GET /openapi/v1/rigging/check/:id`. > * The answer is in `output` instead of `result`. > > See [what changed for the other endpoints](/api/migrate-to-v2/reference#other-endpoints). --- ## POST /openapi/v2/rigging/check -- Create a Rigging Check task Creates a Rigging Check task and returns the [task object](https://docs.meshy.ai/api/v2/tasks.md#the-task-object). The task checks whether Meshy can rig and animate the model of one of your tasks, and which `animation_type` it fits. It runs in the background. To read its result, see [Get the result](#get-the-result). The check is optional. You can [create a Rigging task](https://docs.meshy.ai/api/v2/rigging.md#create-a-rigging-task) without it, and its answer doesn't change what Rigging does. It helps you skip models that Rigging doesn't support, such as a car or a bird. The check looks at the task's preview image. `riggable` is `true` when the model meets all of these rules: * It has one character. * The character is a humanoid (biped) or a four-legged animal (quadruped). * It stands, and a four-legged animal stands on all four legs. * Its arms and legs are clear of the body and of each other. * It doesn't stand on a base or pedestal. * It faces the front. * It's within the face limit of [Rigging](https://docs.meshy.ai/api/v2/rigging.md#create-a-rigging-task). ### Parameters - `input_task_id` · *string* · **required** The `id` of the task whose model you want to check. It must be one of your API tasks that has `SUCCEEDED` and has a preview image, for example a Text to 3D, Image to 3D, Remesh, or Retexture task. ### Returns `202 Accepted` with the [task object](https://docs.meshy.ai/api/v2/tasks.md#the-task-object), with your request in `input`. 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, when the task hasn't finished ### Failure modes - `400 - Bad Request` The request can't run. For example: * `input_task_id` wasn't sent. The code is `parameter_missing`. * `input_task_id` doesn't match any of your tasks. The code is `input_task_not_found`. * The task in `input_task_id` wasn't created through the API. The code is `input_task_unsupported`. * The task in `input_task_id` hasn't succeeded. The code is `input_task_not_ready`. Wait until its status is `SUCCEEDED`, then retry. * The request has a parameter the check doesn't take, such as `model_url`. The code is `parameter_unknown`. The error message says which problem it found. Fix the request, then send it again. 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 Meshy can't check. The code is `input_task_unsupported`. Send a different model. - `404 - Not Found` Meshy can't check the task in `input_task_id`. The error code says why: * `input_task_unsupported`: the task has no preview image, for example a Convert, Resize, or Text to Image task. Check the task it came from. * `input_task_expired`: the task's files were deleted. Create the task again, then send that task's `id`. - `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. A task that Meshy created can still fail. Its `status` becomes `FAILED`, Meshy refunds the credit, and `task_error` says why: * `task_error.code` is `moderation_blocked`, and `type` is `invalid_input`: the model's preview image might not comply with Meshy's platform rules. Send a different model. * `task_error.type` is `service_unavailable`, and `code` is `null`: Meshy couldn't check the model. Create the task again. See [Errors](https://docs.meshy.ai/api/v2/errors.md#task-errors). **cURL** ```bash # Check whether a model can be rigged curl https://api.meshy.ai/openapi/v2/rigging/check \ -X POST \ -H "Authorization: Bearer ${MESHY_API_KEY}" \ -H 'Content-Type: application/json' \ -d '{ "input_task_id": "018a210d-8ba4-705c-b111-1f1776f7f578" }' ``` ```javascript // Check whether a model can be rigged const response = await fetch("https://api.meshy.ai/openapi/v2/rigging/check", { method: "POST", headers: { Authorization: `Bearer ${process.env.MESHY_API_KEY}`, "Content-Type": "application/json", }, body: JSON.stringify({ input_task_id: "018a210d-8ba4-705c-b111-1f1776f7f578", }), }); if (!response.ok) throw new Error(await response.text()); const task = await response.json(); console.log(task.id, task.status, "poll GET /openapi/v2/tasks/{id}"); ``` ```python import os import requests # Check whether a model can be rigged response = requests.post( "https://api.meshy.ai/openapi/v2/rigging/check", headers={"Authorization": f"Bearer {os.environ['MESHY_API_KEY']}"}, json={"input_task_id": "018a210d-8ba4-705c-b111-1f1776f7f578"}, ) response.raise_for_status() task = response.json() print(task["id"], task["status"], "poll GET /openapi/v2/tasks/{id}") ``` **Response** ```json { "id": "0193c1a2-5b7e-7d4f-9a3c-8e2f1b6d4c70", "type": "rig-check", "status": "PENDING", "progress": 0, "created_at": 1790640079880, "started_at": null, "finished_at": null, "expires_at": null, "preceding_tasks": 1, "consumed_credits": 1, "task_error": null, "input": { "input_task_id": "018a210d-8ba4-705c-b111-1f1776f7f578" }, "output": null } ``` --- ## Get the result Read Rigging Check tasks the same way as every other v2 task, through the [Tasks](https://docs.meshy.ai/api/v2/tasks.md) routes. To list only Rigging Check tasks, filter by `type=rig-check`. | 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=rig-check`](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) | --- ## Rigging Check 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. `output` has no file URLs. - `riggable` · *boolean* Whether the model meets all of the rules on this page. When it's `false`, `reasons` says why. - `animation_type` · *string* The kind of character the model is, even when `riggable` is `false`. Available values: * `biped`: a humanoid character. Send it as `animation_type` when you create a Rigging task. * `quadruped`: a four-legged animal. Send it as `animation_type` when you create a Rigging task. * `other`: anything else, such as a bird, an octopus, or a prop. Rigging doesn't support it. - `animatable` · *boolean* Whether [Animation](https://docs.meshy.ai/api/v2/animation.md) can animate the model after you rig it. It's never `true` when `riggable` is `false`. - `reasons` · *array* Why `riggable` or `animatable` is `false`, in a fixed order. It's an empty array when both are `true`. - `code` · *string* What's wrong with the model, for your code to act on. Meshy may add codes, so treat a code you don't recognize as a reason the model doesn't fit. Available values: * `not_a_character`: the model isn't a person or a creature, for example a vehicle or a prop. * `unsupported_body_type`: the creature is neither a humanoid nor a four-legged animal, for example a bird, a snake, or an octopus. * `multiple_subjects`: the model has more than one character. * `has_base`: the character stands on a base or pedestal. * `not_standing`: the character sits, lies, kneels, or crouches, or a four-legged animal isn't on all four legs. * `limbs_not_separated`: the arms or legs touch the body or each other. * `facing_away`: the character faces away from the front. * `too_many_faces`: the model is over the face limit of [Rigging](https://docs.meshy.ai/api/v2/rigging.md#create-a-rigging-task). Run [Remesh](https://docs.meshy.ai/api/v2/remesh.md) on it first. - `message` · *string* The same reason as a sentence for a person, with how to fix the model. For `too_many_faces`, it gives the model's triangle count and the Remesh settings to use. The wording can change, so branch on `code`, not on `message`. **Succeeded Rigging Check task** ```json { "id": "0193c1a2-5b7e-7d4f-9a3c-8e2f1b6d4c70", "type": "rig-check", "status": "SUCCEEDED", "progress": 100, "created_at": 1790640079880, "started_at": 1790640080112, "finished_at": 1790640086935, "expires_at": 1790899286935, "preceding_tasks": 0, "consumed_credits": 1, "task_error": null, "input": { "input_task_id": "018a210d-8ba4-705c-b111-1f1776f7f578" }, "output": { "riggable": false, "animation_type": "biped", "animatable": false, "reasons": [ { "code": "limbs_not_separated", "message": "The arms or legs touch the body or each other. Generate it in a T-pose or A-pose with the limbs clear of the body." } ] } } ``` --- # Animation API Source: https://docs.meshy.ai/api/v2/animation # Animation API Make a rigged character move. Apply one animation from the Meshy library, join several library animations into one file, or play a clip from Text to Motion. > **Note:** Moving from v1? The main changes for Animation: > * The request is the same. > * Results are in `output` instead of `result`. > * A file that wasn't produced is `null` instead of `""`. > * The animation library is at `GET /openapi/v2/animations/library`, and returns the same list. > > See [what changed for the other endpoints](/api/migrate-to-v2/reference#other-endpoints). --- ## POST /openapi/v2/animations -- Create an Animation task Creates an Animation 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). Meshy charges for each animation in a task, so a task with `action_ids` costs more than one with `action_id` or `motion_task_id`. See [Pricing](/api/pricing). ### Parameters - `rig_task_id` · *string* · **required** The ID of the [Rigging](https://docs.meshy.ai/api/v2/rigging.md) task whose character to animate. The task must be one of yours and have the status `SUCCEEDED`. A Rigging task that hasn't succeeded returns `400` with the code `input_task_not_ready`, and the message gives its status. A task of another type returns `400` with the code `input_task_unsupported`. Send exactly one of `action_id`, `action_ids`, and `motion_task_id`. Sending more than one returns `400`. Sending none returns `400` with the message `action_id is required`. - `action_id` · *integer* · **required** Required unless you send `action_ids` or `motion_task_id`. The `action_id` of one library animation to apply. To find IDs, use [List animations](#list-animations) or the [Animation Library](/api/animation-library) page. The animation's `rig_type` must match the rig, or the request returns `400`. Any `quadruped` animation works on any quadruped rig, whatever animal its `category` names. Meshy names the clip in the file by the animation's `key`, for example `Big_Wave_Hello`, as in a download from the Meshy web app. In a clip name, each character other than a letter, a digit, or `_` becomes `_`. A key that starts with a digit gets a `_` in front, for example `_360_Power_Spin_Jump`. A few library animations don't work with some two-legged rigs. They return `400` with the message `This animation is no longer available`. - `action_ids` · *integer[]* · **required** Required unless you send `action_id` or `motion_task_id`. The `action_id` values of up to 10 library animations to join into one file, with no repeats. More than 10 IDs, or a repeated ID, returns `400`. A list with one ID works like `action_id`. Meshy joins the animations in the order you send them. It names each clip in the file by the animation's `key`, the same way as for `action_id`. An animation whose `rig_type` doesn't match the rig returns `400`. - `motion_task_id` · *string* · **required** Required unless you send `action_id` or `action_ids`. The ID of the [Text to Motion](https://docs.meshy.ai/api/v2/text-to-motion.md) task whose clip to play on the character. The task must be one of yours and have the status `SUCCEEDED`, and the rig must be a `biped`. Use the Text to Motion task within 3 days after it finishes. After that, Meshy deletes its clip, like other task files, and this parameter returns `404`. Enterprise accounts keep their files. Meshy names the clip in the file by the Text to Motion task's `id`, as in a download from the Meshy web app. Each `-` becomes `_`, and an ID that starts with a digit gets a `_` in front. For example, the clip of task `018a210d-1c22-7e0f-9d3a-4a5b6c7d8e9f` is named `_018a210d_1c22_7e0f_9d3a_4a5b6c7d8e9f`. - `post_process` · *object* One extra file to make from the animation's FBX file, returned in the matching `output` field. Leave it out for no extra file. It has these fields: * `operation_type`: the file to make. Without it, Meshy makes no extra file. * `change_fps`: an FBX file at another frame rate * `fbx2usdz`: a USDZ file * `extract_armature`: an FBX file with the skeleton only * `fps`: the frame rate for `change_fps`, one of `24`, `25`, `30`, or `60`. The default is `30`. Any other `operation_type` or `fps` value returns `400`. With `motion_task_id`, the clip can come back as a GLB file only. In that case, a `post_process` operation fails the task, and Meshy refunds its credits. ### 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: * More than one of `action_id`, `action_ids`, and `motion_task_id` was sent * An `action_id` isn't in the library * `action_ids` has a repeat or more than 10 IDs * The Rigging task hasn't succeeded * The Text to Motion task hasn't succeeded (`Motion task has not succeeded`) * `motion_task_id` was sent with a rig that isn't a `biped` * An animation's `rig_type` doesn't match the rig 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` The `rig_task_id` task is a bas-relief model, which this endpoint can't animate. The message is `This model type does not support this operation`. Rig a different model. - `404 - Not Found` Meshy can't find a task or file the request needs. One of these applies: * `rig_task_id` doesn't match any of your tasks (`rig_task_id does not match any of your tasks`). Check the ID. * `motion_task_id` doesn't match any of your Text to Motion tasks (`Motion task not found`). Check the ID. * Meshy deleted the Text to Motion clip (the message starts with `Motion clip has expired`). Create another Text to Motion task. * The Rigging task's files were deleted after its `expires_at` (code `input_task_expired`). Rig the character again. - `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 # Apply one library animation (28: Big Wave Hello) curl https://api.meshy.ai/openapi/v2/animations \ -X POST \ -H "Authorization: Bearer ${MESHY_API_KEY}" \ -H 'Content-Type: application/json' \ -d '{ "rig_task_id": "018a210d-8ba4-705c-b111-1f1776f7f578", "action_id": 28 }' # Join two animations into one file, plus a 60 fps FBX curl https://api.meshy.ai/openapi/v2/animations \ -X POST \ -H "Authorization: Bearer ${MESHY_API_KEY}" \ -H 'Content-Type: application/json' \ -d '{ "rig_task_id": "018a210d-8ba4-705c-b111-1f1776f7f578", "action_ids": [0, 28], "post_process": { "operation_type": "change_fps", "fps": 60 } }' # Play a Text to Motion clip on the character curl https://api.meshy.ai/openapi/v2/animations \ -X POST \ -H "Authorization: Bearer ${MESHY_API_KEY}" \ -H 'Content-Type: application/json' \ -d '{ "rig_task_id": "018a210d-8ba4-705c-b111-1f1776f7f578", "motion_task_id": "018a210d-1c22-7e0f-9d3a-4a5b6c7d8e9f" }' ``` ```javascript // Apply one library animation (28: Big Wave Hello) const response = await fetch("https://api.meshy.ai/openapi/v2/animations", { method: "POST", headers: { Authorization: `Bearer ${process.env.MESHY_API_KEY}`, "Content-Type": "application/json", }, body: JSON.stringify({ rig_task_id: "018a210d-8ba4-705c-b111-1f1776f7f578", action_id: 28, }), }); if (!response.ok) throw new Error(await response.text()); const task = await response.json(); console.log(task.id, task.status); ``` ```python import os import requests # Apply one library animation (28: Big Wave Hello) response = requests.post( "https://api.meshy.ai/openapi/v2/animations", headers={"Authorization": f"Bearer {os.environ['MESHY_API_KEY']}"}, json={ "rig_task_id": "018a210d-8ba4-705c-b111-1f1776f7f578", "action_id": 28, }, ) response.raise_for_status() task = response.json() print(task["id"], task["status"]) ``` **Response** ```json { "id": "0199a8f6-3d27-7c2e-9b41-6e0c5d2f8a13", "type": "animate", "status": "PENDING", "progress": 0, "created_at": 1790640079880, "started_at": null, "finished_at": null, "expires_at": null, "preceding_tasks": 1, "consumed_credits": 3, "task_error": null, "input": { "rig_task_id": "018a210d-8ba4-705c-b111-1f1776f7f578", "action_id": 28 }, "output": null } ``` --- ## GET /openapi/v2/animations/library -- List animations Returns the animations in the library, with the `action_id` to send when you create a task. This request costs no credits. The following filters combine. Leave them all out to get the whole library. ### Parameters - `search` · *string* Text to search for. Meshy returns the animations whose `name` or `key` contains this text, ignoring case. - `category` · *string* The category to list. For example: * `DailyActions` * `WalkAndRun` * `Fighting` * `BodyMovements` * `Dancing` A `quadruped` animation's category is an animal, for example `dog` or `horse`. An unknown category returns an empty list. - `sub_category` · *string* The subcategory to list, for example `Walking` or `Interacting`. You can send it without `category`. - `action_ids` · *string* The animations to list, as up to 200 comma-separated IDs, for example `28,92`. More than 200 IDs returns `400`. ### Returns An array of animations, ordered by `action_id`. The response has the whole list, with no pages. - `action_id` · *integer* The ID to send as `action_id` or in `action_ids`. - `name` · *string* The animation's display name. - `key` · *string* The animation's key. - `category` · *string* The animation's category. For a `quadruped` animation, it's an animal, for example `dog` or `horse`. - `sub_category` · *string* The animation's subcategory. - `preview_url` · *string* URL to an animated GIF preview of the animation. - `rig_type` · *string* The kind of rig the animation plays on, `biped` or `quadruped`. It matches the `animation_type` of the [Rigging](https://docs.meshy.ai/api/v2/rigging.md#create-a-rigging-task) task. A rig takes only animations of its own type. ### Failure modes - `400 - Bad Request` `action_ids` has more than 200 IDs, or an item that isn't an integer. The error message says which problem it found. Fix the list, then send the request again. 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. - `429 - Too Many Requests` You sent too many requests. Wait the number of seconds in `Retry-After`, then retry. **cURL** ```bash # Find waving animations curl "https://api.meshy.ai/openapi/v2/animations/library?search=wave" \ -H "Authorization: Bearer ${MESHY_API_KEY}" ``` ```javascript // Find waving animations const response = await fetch( "https://api.meshy.ai/openapi/v2/animations/library?search=wave", { headers: { Authorization: `Bearer ${process.env.MESHY_API_KEY}` } }, ); if (!response.ok) throw new Error(await response.text()); const animations = await response.json(); console.log(animations.map((a) => `${a.action_id} ${a.name}`)); ``` ```python import os import requests # Find waving animations response = requests.get( "https://api.meshy.ai/openapi/v2/animations/library", headers={"Authorization": f"Bearer {os.environ['MESHY_API_KEY']}"}, params={"search": "wave"}, ) response.raise_for_status() for animation in response.json(): print(animation["action_id"], animation["name"]) ``` **Response (shortened)** ```json [ { "action_id": 28, "name": "Big Wave Hello", "key": "Big_Wave_Hello", "category": "DailyActions", "sub_category": "Interacting", "preview_url": "https://cdn.meshy.ai/webapp-assets/feature-demo/animation/preview/biped/Big_Wave_Hello.gif", "rig_type": "biped" }, { "action_id": 290, "name": "Wave One Hand", "key": "Wave_One_Hand", "category": "DailyActions", "sub_category": "Interacting", "preview_url": "https://cdn.meshy.ai/webapp-assets/feature-demo/animation/preview/biped/Wave_One_Hand.gif", "rig_type": "biped" } ] ``` --- ## Get the result Read Animation tasks the same way as every other v2 task, through the [Tasks](https://docs.meshy.ai/api/v2/tasks.md) routes. To list only Animation tasks, filter by `type=animate`. | 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=animate`](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) | --- ## Animation 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`. - `animation_glb_url` · *string | null* Signed URL to the animated character as a GLB file. With `action_ids`, the file has every clip. - `animation_fbx_url` · *string | null* Signed URL to the animated character as an FBX file. It can be `null` for a `motion_task_id` clip that came back as a GLB file only. - `processed_animation_fps_fbx_url` · *string | null* Signed URL to the FBX file at the frame rate you asked for. `null` unless you sent `"operation_type": "change_fps"`. - `processed_usdz_url` · *string | null* Signed URL to the animation as a USDZ file. `null` unless you sent `"operation_type": "fbx2usdz"`. - `processed_armature_fbx_url` · *string | null* Signed URL to the skeleton and its animation without the mesh, as an FBX file. `null` unless you sent `"operation_type": "extract_armature"`. **Succeeded Animation task** ```json { "id": "0199a8f6-3d27-7c2e-9b41-6e0c5d2f8a13", "type": "animate", "status": "SUCCEEDED", "progress": 100, "created_at": 1790640079880, "started_at": 1790640079888, "finished_at": 1790640084741, "expires_at": 1790899284741, "preceding_tasks": 0, "consumed_credits": 3, "task_error": null, "input": { "rig_task_id": "018a210d-8ba4-705c-b111-1f1776f7f578", "action_id": 28 }, "output": { "animation_glb_url": "https://assets.meshy.ai/***/output/Animation_Big_Wave_Hello_withSkin.glb?Expires=***", "animation_fbx_url": "https://assets.meshy.ai/***/output/Animation_Big_Wave_Hello_withSkin.fbx?Expires=***", "processed_usdz_url": null, "processed_armature_fbx_url": null, "processed_animation_fps_fbx_url": null } } ``` --- # Text to Motion API Source: https://docs.meshy.ai/api/v2/text-to-motion # Text to Motion API Generate a character animation from a text prompt, then play it on any two-legged character you rigged with the [Rigging API](https://docs.meshy.ai/api/v2/rigging.md). > **Note:** Moving from v1? The main changes for Text to Motion: > * The request is the same. > * Results are in `output` instead of `result`. > * `output` is `null` until the task succeeds. > > See [what changed for the other endpoints](/api/migrate-to-v2/reference#other-endpoints). --- ## POST /openapi/v2/text-to-motion -- Create a Text to Motion task Creates a Text to Motion 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). To play the motion on a character, see [Apply the motion to a character](#apply-the-motion-to-a-character). ### Parameters - `prompt` · *string* · **required** Text that describes the motion to generate, up to 400 characters. For example, `A person waves with the right hand, then takes a bow`. Longer text returns `400`. You can write the prompt in other languages. - `duration` · *number* · **required** The clip length in seconds, from `2` to `10` in steps of `0.5`, for example `3` or `4.5`. Any other value returns `400`. - `mode` · *string* · default: `prime` The motion model, which also sets the clip's file format. Available values: * `prime`: returns an FBX clip * `swift`: returns a BVH clip Any other value returns `400`. The two modes cost different amounts. See [Pricing](/api/pricing). ### 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: * `prompt` is missing, blank (`prompt must not be empty`), or longer than 400 characters * `duration` is missing, outside 2 to 10 seconds, or not a multiple of 0.5 (`duration must be between 2 and 10 seconds in 0.5 second steps`) 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` Content moderation blocked the prompt. The message is `explicit content` or `prohibited content`. Change the prompt, then send the request again. - `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 # Generate a 3-second motion curl https://api.meshy.ai/openapi/v2/text-to-motion \ -X POST \ -H "Authorization: Bearer ${MESHY_API_KEY}" \ -H 'Content-Type: application/json' \ -d '{ "prompt": "A person waves with the right hand, then takes a bow", "duration": 3 }' # Generate a 2.5-second BVH clip with swift curl https://api.meshy.ai/openapi/v2/text-to-motion \ -X POST \ -H "Authorization: Bearer ${MESHY_API_KEY}" \ -H 'Content-Type: application/json' \ -d '{ "prompt": "A person jumps twice in place", "duration": 2.5, "mode": "swift" }' ``` ```javascript // Generate a 3-second motion const response = await fetch("https://api.meshy.ai/openapi/v2/text-to-motion", { method: "POST", headers: { Authorization: `Bearer ${process.env.MESHY_API_KEY}`, "Content-Type": "application/json", }, body: JSON.stringify({ prompt: "A person waves with the right hand, then takes a bow", duration: 3, }), }); if (!response.ok) throw new Error(await response.text()); const task = await response.json(); console.log(task.id, task.status); ``` ```python import os import requests # Generate a 3-second motion response = requests.post( "https://api.meshy.ai/openapi/v2/text-to-motion", headers={"Authorization": f"Bearer {os.environ['MESHY_API_KEY']}"}, json={ "prompt": "A person waves with the right hand, then takes a bow", "duration": 3, }, ) response.raise_for_status() task = response.json() print(task["id"], task["status"]) ``` **Response** ```json { "id": "0199a8f6-3d27-7c2e-9b41-6e0c5d2f8a13", "type": "text-to-motion", "status": "PENDING", "progress": 0, "created_at": 1790640079880, "started_at": null, "finished_at": null, "expires_at": null, "preceding_tasks": 1, "consumed_credits": 10, "task_error": null, "input": { "prompt": "A person waves with the right hand, then takes a bow", "duration": 3 }, "output": null } ``` --- ## Apply the motion to a character The clip in `output.motion_url` has the motion on its own, with no character. To play it on your character, wait until the Text to Motion task's status is `SUCCEEDED`. Then create an [Animation](https://docs.meshy.ai/api/v2/animation.md) task with these parameters: * `motion_task_id`: the Text to Motion task's `id` * `rig_task_id`: the `id` of a [Rigging](https://docs.meshy.ai/api/v2/rigging.md) task Create the Animation task within 3 days after the Text to Motion task finishes. After that, Meshy deletes the clip, like other task files, and Animation returns `404`. Enterprise accounts keep their files. Meshy charges for each task separately. See [Pricing](/api/pricing). **cURL** ```bash # 1. Generate a 3-second motion curl https://api.meshy.ai/openapi/v2/text-to-motion \ -X POST \ -H "Authorization: Bearer ${MESHY_API_KEY}" \ -H 'Content-Type: application/json' \ -d '{ "prompt": "A person waves with the right hand, then takes a bow", "duration": 3 }' # 2. When it succeeds, play it on a rigged character curl https://api.meshy.ai/openapi/v2/animations \ -X POST \ -H "Authorization: Bearer ${MESHY_API_KEY}" \ -H 'Content-Type: application/json' \ -d '{ "rig_task_id": "018a210d-8ba4-705c-b111-1f1776f7f578", "motion_task_id": "" }' ``` ```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. Generate a motion, 2. play it on a rigged character const motion = await wait(await create("text-to-motion", { prompt: "A person waves with the right hand, then takes a bow", duration: 3, })); const animation = await wait(await create("animations", { rig_task_id: "018a210d-8ba4-705c-b111-1f1776f7f578", motion_task_id: motion.id, })); console.log(animation.output.animation_glb_url); ``` ```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. Generate a motion, 2. play it on a rigged character motion = wait(create("text-to-motion", { "prompt": "A person waves with the right hand, then takes a bow", "duration": 3, })) animation = wait(create("animations", { "rig_task_id": "018a210d-8ba4-705c-b111-1f1776f7f578", "motion_task_id": motion["id"], })) print(animation["output"]["animation_glb_url"]) ``` --- ## Get the result Read Text to Motion tasks the same way as every other v2 task, through the [Tasks](https://docs.meshy.ai/api/v2/tasks.md) routes. To list only Text to Motion tasks, filter by `type=text-to-motion`. | 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=text-to-motion`](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) | --- ## Text to Motion 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 URL in `output` stops working at `expires_at`. - `motion_url` · *string | null* Signed URL to the motion clip, an FBX file for `prime` or a BVH file for `swift`. - `motion_format` · *string* The clip's file format, `fbx` or `bvh`. - `duration_ms` · *integer* The clip length you asked for, in milliseconds. - `mode` · *string* The `mode` Meshy used to make the clip, `prime` or `swift`. **Succeeded Text to Motion task** ```json { "id": "0199a8f6-3d27-7c2e-9b41-6e0c5d2f8a13", "type": "text-to-motion", "status": "SUCCEEDED", "progress": 100, "created_at": 1790640079880, "started_at": 1790640079886, "finished_at": 1790640092812, "expires_at": 1790899292812, "preceding_tasks": 0, "consumed_credits": 10, "task_error": null, "input": { "prompt": "A person waves with the right hand, then takes a bow", "duration": 3 }, "output": { "motion_url": "https://assets.meshy.ai/***/output/clip.fbx?Expires=***", "motion_format": "fbx", "duration_ms": 3000, "mode": "prime" } } ``` --- # Text to Image API Source: https://docs.meshy.ai/api/v2/text-to-image # Text to Image API Generate an image from a text prompt. By default, Meshy removes the background, so the image is ready to use as the input for Image to 3D. > **Note:** Moving from v1? The main changes for Text to Image: > * `remove_background` is replaced by `background`. The default is `transparent`, so Meshy removes the background unless you send `background: "opaque"`. A request with `remove_background` returns `400`. > * The images are in `output.image_urls`. > * The `ai_model` and `prompt` you sent are in `input`. > > See [what changed for Text to Image](/api/migrate-to-v2/reference#image-generation). This endpoint makes **images**. To make a 3D model of what's in an image, use [Image to 3D](https://docs.meshy.ai/api/v2/image-to-3d.md). To make an object you can hold or print from a photo, for example a keychain or a figure, use the [Creative Lab APIs](/api/creative-lab-keychain). --- ## POST /openapi/v2/text-to-image -- Create a Text to Image task Creates a Text to Image 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 - `ai_model` · *string* · **required** The model that generates the image. Prices differ by model. See [Pricing](/api/pricing). Available values: * `nano-banana` * `nano-banana-2` * `nano-banana-2-lite` * `nano-banana-2-1`: costs 4 credits per request * `nano-banana-pro`: needs a Pro plan or higher. On a lower plan, it returns `402`. * `gpt-image-2`: OpenAI GPT Image 2 * `gpt-image-2-5-flare`: OpenAI GPT Image 2.5 (Flare) * `gpt-image-2-5-sunburst`: OpenAI GPT Image 2.5 (Sunburst) * `gpt-image-2-6-flare`: OpenAI GPT Image 2.6 (Flare) * `gpt-image-2-6-sunburst`: OpenAI GPT Image 2.6 (Sunburst) - `prompt` · *string* · **required** Text that describes the image to generate. - `aspect_ratio` · *string* · default: `1:1` The shape of the image. Available values: * `1:1` * `16:9` * `9:16` * `4:3` * `3:4` * `3:2`: GPT Image models only * `2:3`: GPT Image models only With a `nano-banana` model, `3:2` and `2:3` return `400`. You can't send `aspect_ratio` with `generate_multi_view: true`. Sending both returns `400`. - `background` · *string* · default: `transparent` The background of the image. Available values: * `transparent`: Meshy removes the background and returns a transparent PNG. * `opaque`: Meshy returns the image with the background it was generated with. With `generate_multi_view: true`, every view has a transparent background. Sending `opaque` with it returns `400`. - `generate_multi_view` · *boolean* · default: `false` Whether to generate the subject from the front, the side, and the back. `true` returns each view as a separate image with a transparent background in `output.image_urls`, and `false` returns one image. - `pose_mode` · *string* The pose for a standing character, `a-pose` or `t-pose`. Leave it out for no pose. With a `nano-banana` model, a posed image is always `3:4`, whatever you send as `aspect_ratio`. The GPT Image models keep your `aspect_ratio`. With `nano-banana` or `nano-banana-pro`, a pose needs a Pro plan or higher. On a lower plan, the request returns `402`. ### 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: * `ai_model` or `prompt` is missing * `ai_model` isn't a supported model * `aspect_ratio` was sent with `generate_multi_view: true` (`aspect_ratio cannot be set when generate_multi_view is true`) * `background: "opaque"` was sent with `generate_multi_view: true` (`background cannot be opaque when generate_multi_view is true`) * `3:2` or `2:3` was sent for a `nano-banana` model 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. * The request uses `nano-banana-pro`, or `pose_mode` with `nano-banana`, on a plan below Pro. Check your credits and plan, then retry. - `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 # Generate one image from a prompt curl https://api.meshy.ai/openapi/v2/text-to-image \ -X POST \ -H "Authorization: Bearer ${MESHY_API_KEY}" \ -H 'Content-Type: application/json' \ -d '{ "ai_model": "nano-banana", "prompt": "a small brass robot, full body" }' # Generate front, side, and back views of a character curl https://api.meshy.ai/openapi/v2/text-to-image \ -X POST \ -H "Authorization: Bearer ${MESHY_API_KEY}" \ -H 'Content-Type: application/json' \ -d '{ "ai_model": "nano-banana", "prompt": "a cartoon knight in silver armor", "generate_multi_view": true }' ``` ```javascript // Generate one image from a prompt const response = await fetch("https://api.meshy.ai/openapi/v2/text-to-image", { method: "POST", headers: { Authorization: `Bearer ${process.env.MESHY_API_KEY}`, "Content-Type": "application/json", }, body: JSON.stringify({ ai_model: "nano-banana", prompt: "a small brass robot, full body", }), }); if (!response.ok) throw new Error(await response.text()); const task = await response.json(); console.log(task.id, task.status); ``` ```python import os import requests # Generate one image from a prompt response = requests.post( "https://api.meshy.ai/openapi/v2/text-to-image", headers={"Authorization": f"Bearer {os.environ['MESHY_API_KEY']}"}, json={ "ai_model": "nano-banana", "prompt": "a small brass robot, full body", }, ) response.raise_for_status() task = response.json() print(task["id"], task["status"]) ``` **Response** ```json { "id": "0199a8f6-3d27-7c2e-9b41-6e0c5d2f8a13", "type": "text-to-image", "status": "PENDING", "progress": 0, "created_at": 1790640079880, "started_at": null, "finished_at": null, "expires_at": null, "preceding_tasks": 1, "consumed_credits": 3, "task_error": null, "input": { "ai_model": "nano-banana", "prompt": "a small brass robot, full body" }, "output": null } ``` --- ## Get the result Read Text to Image tasks the same way as every other v2 task, through the [Tasks](https://docs.meshy.ai/api/v2/tasks.md) routes. To list only Text to Image tasks, filter by `type=text-to-image`. The filter includes multi-view tasks. | 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=text-to-image`](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) | --- ## Text to Image output When the task succeeds, `output` holds this field. 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`. - `image_urls` · *string[]* Signed URLs to the generated PNG images: * A single image: one URL. With `background: "transparent"`, Meshy removes the image's background. If it can't, the task still succeeds, and the image keeps its background. * With `generate_multi_view: true`: one URL per view, usually three, each with a transparent background. If Meshy can't separate every view, it returns fewer, and the task still succeeds. If the model provider's safety check declines the prompt, the task fails. Its `task_error` has the type `invalid_input` and the code `provider_content_refused`. Change the prompt, then create another task. See [Errors](https://docs.meshy.ai/api/v2/errors.md#invalid-input). **Succeeded Text to Image task** ```json { "id": "0199a8f6-3d27-7c2e-9b41-6e0c5d2f8a13", "type": "text-to-image", "status": "SUCCEEDED", "progress": 100, "created_at": 1790640079880, "started_at": 1790640079886, "finished_at": 1790640088941, "expires_at": 1790899288941, "preceding_tasks": 0, "consumed_credits": 3, "task_error": null, "input": { "ai_model": "nano-banana", "prompt": "a small brass robot, full body" }, "output": { "image_urls": [ "https://assets.meshy.ai/***/uploads/image_0199a8f6-3d27-7c2e-9b41-6e0c5d2f8a13_0.png?Expires=***" ] } } ``` --- # Image to Image API Source: https://docs.meshy.ai/api/v2/image-to-image # Image to Image API Generate a new image from one to five reference images and a prompt, for example the same character in a new style. By default, Meshy removes the background, so the image is ready to use as the input for Image to 3D. > **Note:** Moving from v1? The main changes for Image to Image: > * `remove_background` is replaced by `background`. The default is `transparent`, so Meshy removes the background unless you send `background: "opaque"`. A request with `remove_background` returns `400`. > * The images are in `output.image_urls`. > * The `ai_model` and `prompt` you sent are in `input`. > > See [what changed for Image to Image](/api/migrate-to-v2/reference#image-generation). This endpoint makes **images**. To make a 3D model of what's in an image, use [Image to 3D](https://docs.meshy.ai/api/v2/image-to-3d.md). To make an object you can hold or print from a photo, for example a keychain or a figure, use the [Creative Lab APIs](/api/creative-lab-keychain). --- ## POST /openapi/v2/image-to-image -- Create an Image to Image task Creates an Image to Image 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 - `reference_image_urls` · *string[]* · **required** Required unless you send `input_task_id`. One to five images to work from, each a public URL or a data URI (`data:image/png;base64,...`). An empty array, or more than five images, returns `400`. Each image must be a JPG, JPEG, PNG, or WebP file of at most 20 MB, and at least 32 pixels on each side. - `input_task_id` · *string* · **required** Required unless you send `reference_image_urls`. The ID of a Text to Image or Image to Image task whose images to use as the references. The task must be one you created with the API and have the status `SUCCEEDED`. If you send both `reference_image_urls` and `input_task_id`, Meshy uses `input_task_id`. Meshy uses every image the task produced. That's one image, or up to three for a multi-view task. - `ai_model` · *string* · **required** The model that generates the image. Prices differ by model. See [Pricing](/api/pricing). Available values: * `nano-banana` * `nano-banana-2` * `nano-banana-2-lite` * `nano-banana-2-1`: costs 4 credits per request * `nano-banana-pro`: needs a Pro plan or higher. On a lower plan, it returns `402`. * `gpt-image-2`: OpenAI GPT Image 2 * `gpt-image-2-5-flare`: OpenAI GPT Image 2.5 (Flare) * `gpt-image-2-5-sunburst`: OpenAI GPT Image 2.5 (Sunburst) * `gpt-image-2-6-flare`: OpenAI GPT Image 2.6 (Flare) * `gpt-image-2-6-sunburst`: OpenAI GPT Image 2.6 (Sunburst) - `prompt` · *string* · **required** Text that describes what to make from the reference images, for example `turn it into a clay figurine`. - `aspect_ratio` · *string* · default: `1:1` The shape of the image. Available values: * `1:1` * `16:9` * `9:16` * `4:3` * `3:4` * `3:2`: GPT Image models only * `2:3`: GPT Image models only With a `nano-banana` model, `3:2` and `2:3` return `400`. You can't send `aspect_ratio` with `generate_multi_view: true`. Sending both returns `400`. The result doesn't follow the shape of the reference images. To match them, set `aspect_ratio` to their shape. - `background` · *string* · default: `transparent` The background of the image. Available values: * `transparent`: Meshy removes the background and returns a transparent PNG. * `opaque`: Meshy returns the image with the background it was generated with. With `generate_multi_view: true`, every view has a transparent background. Sending `opaque` with it returns `400`. - `generate_multi_view` · *boolean* · default: `false` Whether to generate the subject from the front, the side, and the back. `true` returns each view as a separate image with a transparent background in `output.image_urls`, and `false` returns one image. ### 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: * `ai_model` or `prompt` is missing * Neither `reference_image_urls` nor `input_task_id` was sent * A reference image can't be downloaded or isn't a supported image. The code is `input_download_failed` or `input_file_invalid`, and the message names the image, for example `reference_image_urls[1]`, and says why. * The input task hasn't succeeded, or isn't a Text to Image or Image to Image task * `ai_model` isn't a supported model * `aspect_ratio` was sent with `generate_multi_view: true` (`aspect_ratio cannot be set when generate_multi_view is true`) * `background: "opaque"` was sent with `generate_multi_view: true` (`background cannot be opaque when generate_multi_view is true`) * `3:2` or `2:3` was sent for a `nano-banana` model 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. * The request uses `nano-banana-pro` on a plan below Pro. Check your credits and plan, then retry. - `404 - Not Found` `input_task_id` doesn't match any of your tasks. The message is `input_task_id does not match any of your tasks`. A task you deleted also returns `404`. For a task past its [retention period](https://docs.meshy.ai/api/v2/asset-retention.md), the code is `input_task_expired`. Create the input task again, and send the new task's `id`. - `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 # Restyle a reference image curl https://api.meshy.ai/openapi/v2/image-to-image \ -X POST \ -H "Authorization: Bearer ${MESHY_API_KEY}" \ -H 'Content-Type: application/json' \ -d '{ "ai_model": "nano-banana", "prompt": "turn it into a clay figurine", "reference_image_urls": ["https://docs.meshy.ai/images/api/quick-start/source-photo.webp"] }' # Edit the images of an earlier Text to Image task curl https://api.meshy.ai/openapi/v2/image-to-image \ -X POST \ -H "Authorization: Bearer ${MESHY_API_KEY}" \ -H 'Content-Type: application/json' \ -d '{ "ai_model": "nano-banana", "prompt": "make the robot gold", "input_task_id": "018a210d-8ba4-705c-b111-1f1776f7f578" }' ``` ```javascript // Restyle a reference image const response = await fetch("https://api.meshy.ai/openapi/v2/image-to-image", { method: "POST", headers: { Authorization: `Bearer ${process.env.MESHY_API_KEY}`, "Content-Type": "application/json", }, body: JSON.stringify({ ai_model: "nano-banana", prompt: "turn it into a clay figurine", reference_image_urls: [ "https://docs.meshy.ai/images/api/quick-start/source-photo.webp", ], }), }); if (!response.ok) throw new Error(await response.text()); const task = await response.json(); console.log(task.id, task.status); ``` ```python import os import requests # Restyle a reference image response = requests.post( "https://api.meshy.ai/openapi/v2/image-to-image", headers={"Authorization": f"Bearer {os.environ['MESHY_API_KEY']}"}, json={ "ai_model": "nano-banana", "prompt": "turn it into a clay figurine", "reference_image_urls": [ "https://docs.meshy.ai/images/api/quick-start/source-photo.webp", ], }, ) response.raise_for_status() task = response.json() print(task["id"], task["status"]) ``` **Response** ```json { "id": "0199a8f6-3d27-7c2e-9b41-6e0c5d2f8a13", "type": "image-to-image", "status": "PENDING", "progress": 0, "created_at": 1790640079880, "started_at": null, "finished_at": null, "expires_at": null, "preceding_tasks": 1, "consumed_credits": 3, "task_error": null, "input": { "ai_model": "nano-banana", "prompt": "turn it into a clay figurine", "reference_image_urls": ["https://docs.meshy.ai/images/api/quick-start/source-photo.webp"] }, "output": null } ``` --- ## Get the result Read Image to Image tasks the same way as every other v2 task, through the [Tasks](https://docs.meshy.ai/api/v2/tasks.md) routes. To list only Image to Image tasks, filter by `type=image-to-image`. The filter includes multi-view tasks. | 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=image-to-image`](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) | --- ## Image to Image output When the task succeeds, `output` holds this field. 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`. - `image_urls` · *string[]* Signed URLs to the generated PNG images: * A single image: one URL. With `background: "transparent"`, Meshy removes the image's background. If it can't, the task still succeeds, and the image keeps its background. * With `generate_multi_view: true`: one URL per view, usually three, each with a transparent background. If Meshy can't separate every view, it returns fewer, and the task still succeeds. If the model provider's safety check declines the prompt or a reference image, the task fails. Its `task_error` has the type `invalid_input` and the code `provider_content_refused`. Change the prompt or the reference images, then create another task. See [Errors](https://docs.meshy.ai/api/v2/errors.md#invalid-input). **Succeeded Image to Image task** ```json { "id": "0199a8f6-3d27-7c2e-9b41-6e0c5d2f8a13", "type": "image-to-image", "status": "SUCCEEDED", "progress": 100, "created_at": 1790640079880, "started_at": 1790640079886, "finished_at": 1790640091374, "expires_at": 1790899291374, "preceding_tasks": 0, "consumed_credits": 3, "task_error": null, "input": { "ai_model": "nano-banana", "prompt": "turn it into a clay figurine", "reference_image_urls": ["https://docs.meshy.ai/images/api/quick-start/source-photo.webp"] }, "output": { "image_urls": [ "https://assets.meshy.ai/***/uploads/image_0199a8f6-3d27-7c2e-9b41-6e0c5d2f8a13_0.png?Expires=***" ] } } ``` --- # Multi-Color Print API Source: https://docs.meshy.ai/api/v2/multi-color-print # Multi-Color Print API Turn a textured 3D model into a multi-color 3MF file. Meshy reduces the model's colors to a filament palette and adds a slicer preset for your printer brand. > **Note:** Moving from v1? The request is the same. The main changes for Multi-Color Print: > * The 3MF file follows the v2 [model size](/api/migrate-to-v2/reference#model-size) rules. > * The 3MF URL is in `output.model_urls` instead of the top-level `model_urls`. > * The empty fields v1 returned are gone. > > See [what changed for the other endpoints](/api/migrate-to-v2/reference#other-endpoints). --- ## POST /openapi/v2/print/multi-color -- Create a Multi-Color Print task Creates a Multi-Color Print 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). The model must have color. The `realistic` style needs a base color texture, and the `cartoon` style also accepts vertex colors. Meshy checks most models when you create the task, and a model without the color that `style` needs returns `400`. Some models can only be checked while the task runs, for example an FBX upload, and the task fails instead. To add color, texture the model first, for example with [Retexture](https://docs.meshy.ai/api/v2/retexture.md). The 3MF file has its origin at the bottom. For a model Meshy generated, Meshy scales the file down to at most 150 mm on the longest side. Uploaded and resized models keep their own size. See [Model size](/api/migrate-to-v2/reference#model-size). ### Parameters - `input_task_id` · *string* · **required** Required unless you send `model_url`. The ID of a task that produced a 3D model, for example Text to 3D, Image to 3D, Retexture, or Remesh. The task must be one you created with the API, and have the status `SUCCEEDED`. Multi-Color Print reads the task's GLB file, which can have at most 8,000,000 faces. A model with more faces returns `400`. In that case, run a [Remesh](https://docs.meshy.ai/api/v2/remesh.md) task on it first, and send the Remesh task's `id` instead. - `model_url` · *string* · **required** Required unless you send `input_task_id`. The model to print, as a public URL or a data URI (`data:model/gltf-binary;base64,...`). Sending both `input_task_id` and `model_url` returns `400`. A URL must point to a GLB or FBX file of at most 400 MB. A data URI must hold a GLB file of at most 100 MB. A larger file returns `400`. A file over 100 MB can have at most 8,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. Over 100 MB, an FBX file must be binary FBX 7.1 or newer, and a GLB file must not use Draco compression. A file that breaks these rules returns `400`. - `max_colors` · *integer* · default: `4` The maximum number of colors in the printed model, from `1` to `16`. A negative value or one over `16` returns `400`. To use the default, leave it out rather than sending `0`. - `style` · *string* · default: `realistic` How Meshy places colors on the model. Available values: * `realistic`: samples the texture for fine detail, and makes a larger file. The model needs a single base color texture, with UVs on every part. * `cartoon`: makes flat, uniform color regions, and a smaller file. It also works with vertex colors. - `max_depth` · *integer* · default: `4` How finely Meshy samples the texture onto the mesh, from `3` to `6`. Any other value returns `400`, except `0`, which is the same as leaving it out. Higher values keep finer color detail, and make a larger file. Only the `realistic` style uses this setting. - `printer_brand` · *string* · default: `bambu` The printer brand whose slicer preset Meshy saves in the 3MF file, so the file opens with a matching printer, filament, and process profile. The preset uses the brand's default printer, with a 0.4 mm nozzle. Available values: * `bambu` * `anycubic` * `creality` * `elegoo` * `flashforge` * `prusa` * `qidi` * `snapmaker` * `ankermake` 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 (code `parameter_missing`). * Both `input_task_id` and `model_url` were sent (code `parameters_conflict`). * The input task hasn't succeeded, or wasn't created with the API. * The input task's model has more than 8,000,000 faces. Run a Remesh task on it, then send the Remesh task's `id` instead. * `model_url` isn't a GLB or FBX file, can't be downloaded, or is too large. * A `model_url` file over 100 MB has too many faces (`model has too many faces: faces, the limit for files over 100 MB is `). Reduce the face count, then send the file again. * An FBX file over 100 MB is ASCII (`ASCII FBX files over 100 MB are not supported; use binary FBX or GLB`). Send it as binary FBX or GLB. * A file over 100 MB has a header Meshy can't read, such as a Draco-compressed GLB, 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`). * The model lacks the color the chosen `style` needs, for example `The input model has no color information ...` or `style=realistic requires ...`. Texture the model first. If the model has vertex colors, you can also switch to the `cartoon` style. 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 print. 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. The message is `input_task_id does not match any of your tasks`. Check the ID, and use an API key from the account that created the task. A task of yours past its [retention period](https://docs.meshy.ai/api/v2/asset-retention.md) returns the code `input_task_expired` instead. - `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 # Make a 3MF with up to 6 colors from a textured model file curl https://api.meshy.ai/openapi/v2/print/multi-color \ -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", "max_colors": 6 }' # Make a cartoon-style 3MF from a Meshy task, for a Prusa printer curl https://api.meshy.ai/openapi/v2/print/multi-color \ -X POST \ -H "Authorization: Bearer ${MESHY_API_KEY}" \ -H 'Content-Type: application/json' \ -d '{ "input_task_id": "018a210d-8ba4-705c-b111-1f1776f7f578", "style": "cartoon", "printer_brand": "prusa" }' ``` ```javascript // Make a 3MF with up to 6 colors from a textured model file const response = await fetch("https://api.meshy.ai/openapi/v2/print/multi-color", { 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", max_colors: 6, }), }); if (!response.ok) throw new Error(await response.text()); const task = await response.json(); console.log(task.id, task.status); ``` ```python import os import requests # Make a 3MF with up to 6 colors from a textured model file response = requests.post( "https://api.meshy.ai/openapi/v2/print/multi-color", headers={"Authorization": f"Bearer {os.environ['MESHY_API_KEY']}"}, json={ "model_url": "https://cdn.meshy.ai/model/example_model_2.glb", "max_colors": 6, }, ) response.raise_for_status() task = response.json() print(task["id"], task["status"]) ``` **Response** ```json { "id": "0199a8f6-3d27-7c2e-9b41-6e0c5d2f8a13", "type": "print-multi-color", "status": "PENDING", "progress": 0, "created_at": 1790640079880, "started_at": null, "finished_at": null, "expires_at": null, "preceding_tasks": 1, "consumed_credits": 10, "task_error": null, "input": { "model_url": "https://cdn.meshy.ai/model/example_model_2.glb", "max_colors": 6 }, "output": null } ``` --- ## Get the result Read Multi-Color Print tasks the same way as every other v2 task, through the [Tasks](https://docs.meshy.ai/api/v2/tasks.md) routes. To list only Multi-Color Print tasks, filter by `type=print-multi-color`. | 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=print-multi-color`](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) | --- ## Multi-Color Print output When the task succeeds, `output` holds this field. 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 URL to the multi-color model, as one file with the key `3mf`. Multi-Color Print tasks have no preview image, so `output` has no `thumbnail_url`. Meshy can check some models for color only while the task runs, for example an FBX upload. If such a model lacks the color that `style` needs, the task fails with `task_error.code` set to `model_missing_texture`. Texture the model first. If the model has vertex colors, you can also switch to the `cartoon` style. See [Errors](https://docs.meshy.ai/api/v2/errors.md#model-missing-texture). **Succeeded Multi-Color Print task** ```json { "id": "0199a8f6-3d27-7c2e-9b41-6e0c5d2f8a13", "type": "print-multi-color", "status": "SUCCEEDED", "progress": 100, "created_at": 1790640079880, "started_at": 1790640079887, "finished_at": 1790640131532, "expires_at": 1790899331532, "preceding_tasks": 0, "consumed_credits": 10, "task_error": null, "input": { "model_url": "https://cdn.meshy.ai/model/example_model_2.glb", "max_colors": 6 }, "output": { "model_urls": { "3mf": "https://assets.meshy.ai/***/output/model.3mf?Expires=***" } } } ``` --- # Analyze Printability API Source: https://docs.meshy.ai/api/v2/analyze-printability # Analyze Printability API Check a 3D model for problems that stop it from printing, such as holes, non-manifold edges, degenerate faces, and walls too thin for your printer. Analysis is free. > **Note:** Moving from v1? The request is the same, and analysis is still free. The main changes for Analyze Printability: > * v2 checks wall thickness by default, for an FDM print 150 mm tall, so `printability` always has `intended_print` and `thin_walls`. > * `printability` is in `output`. > * There is no `_version` field. > * `metrics` and `evaluated_at` are always present. > * If Meshy already has the result, the create response is already `SUCCEEDED`. Check `status` before you poll. > > See [what changed for the other endpoints](/api/migrate-to-v2/reference#other-endpoints). --- ## POST /openapi/v2/print/analyze -- Create an Analyze Printability task Creates an Analyze Printability 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). Analysis is free and works on every plan. The analysis doesn't change the model. To fix what it finds, use [Repair Printability](https://docs.meshy.ai/api/v2/repair-printability.md). If this task analyzed a task or a GLB or OBJ file, you can send its `id` to Repair Printability as `input_task_id`. The repair then uses the printer type and print size of this analysis. When Meshy already has the result for an `input_task_id`, the create response is already `SUCCEEDED`, with the result in `output` and no `Retry-After` header. Meshy still sends the webhook. This happens only when Meshy already checked the same model at the same printer type and print size, for example in the web app's Print Check. Check `status` on every create response before you poll. ### Parameters - `input_task_id` · *string* · **required** Required unless you send `model_url`. The ID of the task whose model to analyze. The task must have the status `SUCCEEDED`, and be one of yours or in a workspace you belong to. The model must come from Meshy 6 or a newer Meshy model, including Smart Topology. These tasks work: * Text to 3D * Image to 3D * Multi-Image to 3D * Retexture * Remesh of one of the preceding tasks * Repair Printability A task without a Meshy model behind it returns `404`, for example Convert, Resize, Multi-Color Print, or a Remesh of an uploaded file. - `model_url` · *string* · **required** Required unless you send `input_task_id`. The model to analyze, as a public URL or a data URI (`data:model/gltf-binary;base64,...`). Sending both `input_task_id` and `model_url` returns `400`. A URL must point to a GLB, STL, OBJ, FBX, or glTF file of at most 400 MB. A data URI must hold a GLB or glTF file of at most 100 MB. A larger file returns `400`. A GLB, glTF, FBX, or OBJ file over 100 MB 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. Over 100 MB, an FBX file must be binary FBX 7.1 or newer, and a GLB or glTF file must not use Draco compression. A file that breaks these rules returns `400`. A Meshy download URL, from the `output` of one of your tasks, is signed and stops working at that task's `expires_at`. Reading the task again doesn't renew it. For a model you made with Meshy, send `input_task_id` instead, which works for as long as Meshy keeps the task's files (see [Asset retention](https://docs.meshy.ai/api/v2/asset-retention.md)). To use the model after that, download it before `expires_at` and send your own copy. Meshy also checks for walls too thin to print. To judge the walls at your own print, send a printer type, a print size, or both. Without them, Meshy uses `fdm` and a default print size that depends on the format. The size tells Meshy how big you plan to print the model. Meshy doesn't scale the model to it. - `printer_type` · *string* · default: `fdm` The printer you plan to use. It sets the thinnest wall that prints. Available values: * `fdm`: 1.0 mm * `sla`: 0.8 mm * `full_color`: 2.0 mm Any other value returns `400`. - `intended_print_height_mm` · *number* The height of the print, in millimeters, from `1` to `1000`. A value outside this range returns `400`. Send this or `intended_print_longest_side_mm`, not both. Sending both returns `400`. For `model_url`, only a GLB file has a known up direction. A height with another format returns `400`, so send `intended_print_longest_side_mm` instead. Meshy also checks the print's longest side. It uses the model's proportions to calculate that length at the specified height, and the result must be from 1 to 1,000 mm. If the model is wider or deeper than it is tall, a height near 1,000 mm can fail even though the height itself is within range. To make the print's longest side close to 1,000 mm, use `intended_print_longest_side_mm` instead. If Meshy can't convert the height for the model, send `intended_print_longest_side_mm` instead. For an `input_task_id` model whose size Meshy already knows, the request returns `400`. For a GLB `model_url`, or a model whose size Meshy doesn't know yet, Meshy converts the height while the task runs. If that fails, the task fails with `task_error.type` set to `invalid_input`. - `intended_print_longest_side_mm` · *number* The length of the print's longest side, in millimeters, from `1` to `1000`. A value outside this range returns `400`. It works with every input format. If you send no size, Meshy uses this print size: * 150 mm tall, for a task or a GLB file * 150 mm on the longest side, for an OBJ, FBX, or glTF file * The STL file's own size, read in millimeters. If Meshy can't read it, or it's outside 1 to 1,000 mm, Meshy uses 150 mm on the longest side. If Meshy can't work out a 150 mm tall print for a model, it uses 150 mm on the longest side. This happens when Meshy can't measure the model, or when 150 mm tall would make its longest side over 1,000 mm. Meshy rounds sizes to whole millimeters. ### Returns `202 Accepted` with the [task object](https://docs.meshy.ai/api/v2/tasks.md#the-task-object), with your request in `input` and `consumed_credits` set to `0`. In most cases, the task starts as `PENDING`, with `output` set to `null`. When Meshy already has the result, the task is already `SUCCEEDED`, with the result in `output`. 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), whatever the status * `Retry-After`: how many seconds to wait before you first read the task. A task that's already `SUCCEEDED` has no `Retry-After`. ### Failure modes - `400 - Bad Request` The request can't run. For example: * Neither `input_task_id` nor `model_url` was sent (`Either input_task_id or model_url must be provided`). * Both `input_task_id` and `model_url` were sent (`Send either "input_task_id" or "model_url", not both.`). * The input task hasn't succeeded (code `input_task_not_ready`). Wait for it to succeed, then retry. * `model_url` has an unsupported extension or is too large. * `model_url` can't be downloaded (code `input_download_failed`), most often because it's a Meshy download URL past its `expires_at`. Reading the task again returns the same URL, so send `input_task_id` while Meshy keeps the task's files, or your own copy of the file. * A `model_url` file over 100 MB has too many faces (`model has too many faces: faces, the limit for files over 100 MB is `). Reduce the face count, then send the file again. * An FBX file over 100 MB is ASCII (`ASCII FBX files over 100 MB are not supported; use binary FBX or GLB`). Send it as binary FBX or GLB. * A file over 100 MB has a header Meshy can't 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`). * Both print sizes were sent. * `printer_type` isn't `fdm`, `sla`, or `full_color`. * A height was sent with a `model_url` that isn't a GLB file. * Meshy can't convert the height for an `input_task_id` model whose size it already knows. Send `intended_print_longest_side_mm` 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. - `403 - Forbidden` `input_task_id` is a bas-relief model, which this endpoint can't analyze. The message is `This model type does not support this operation`. Send a different model. - `404 - Not Found` One of these applies: * `input_task_id` doesn't match any of your tasks, or any task in a workspace you belong to. The message is `input_task_id does not match any of your tasks`. Check the ID, and use an API key from the account that created the task, or one in the task's workspace. * Meshy can't analyze this kind of task. The message is `Printability not available for this model`. See `input_task_id` for the tasks that work. A task of yours past its [retention period](https://docs.meshy.ai/api/v2/asset-retention.md) returns the code `input_task_expired` instead. - `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 # Check a model file for an FDM print 150 mm tall curl https://api.meshy.ai/openapi/v2/print/analyze \ -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" }' # Check a Meshy task as an 80 mm tall FDM print curl https://api.meshy.ai/openapi/v2/print/analyze \ -X POST \ -H "Authorization: Bearer ${MESHY_API_KEY}" \ -H 'Content-Type: application/json' \ -d '{ "input_task_id": "018a210d-8ba4-705c-b111-1f1776f7f578", "printer_type": "fdm", "intended_print_height_mm": 80 }' ``` ```javascript // Check a Meshy task for an FDM print 150 mm tall; it might already be done const response = await fetch("https://api.meshy.ai/openapi/v2/print/analyze", { method: "POST", headers: { Authorization: `Bearer ${process.env.MESHY_API_KEY}`, "Content-Type": "application/json", }, body: JSON.stringify({ input_task_id: "018a210d-8ba4-705c-b111-1f1776f7f578", }), }); if (!response.ok) throw new Error(await response.text()); const task = await response.json(); if (task.status === "SUCCEEDED") { console.log(task.output.printability.status); } else { console.log(task.id, task.status, "poll GET /openapi/v2/tasks/{id}"); } ``` ```python import os import requests # Check a Meshy task for an FDM print 150 mm tall; it might already be done response = requests.post( "https://api.meshy.ai/openapi/v2/print/analyze", headers={"Authorization": f"Bearer {os.environ['MESHY_API_KEY']}"}, json={"input_task_id": "018a210d-8ba4-705c-b111-1f1776f7f578"}, ) response.raise_for_status() task = response.json() if task["status"] == "SUCCEEDED": print(task["output"]["printability"]["status"]) else: print(task["id"], task["status"], "poll GET /openapi/v2/tasks/{id}") ``` **Response** ```json { "id": "0199a8f6-3d27-7c2e-9b41-6e0c5d2f8a13", "type": "print-analyze", "status": "PENDING", "progress": 0, "created_at": 1790640079880, "started_at": null, "finished_at": null, "expires_at": null, "preceding_tasks": 1, "consumed_credits": 0, "task_error": null, "input": { "model_url": "https://cdn.meshy.ai/model/example_model_2.glb" }, "output": null } ``` --- ## Get the result Read Analyze Printability tasks the same way as every other v2 task, through the [Tasks](https://docs.meshy.ai/api/v2/tasks.md) routes. To list only Analyze Printability tasks, filter by `type=print-analyze`. | 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=print-analyze`](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) | --- ## Analyze Printability output When the task succeeds, `output` holds this field. The rest of the [task object](https://docs.meshy.ai/api/v2/tasks.md#the-task-object) is the same for every task type. `output` has no file URLs. To print a repaired model, use the files of the [Repair Printability](https://docs.meshy.ai/api/v2/repair-printability.md) task. - `printability` · *object* The result of the analysis, with these fields: * `status`: the overall verdict. It's the worse of the mesh checks and `thin_walls.status`. * `healthy` * `warning` * `error` * `unknown`: Meshy couldn't evaluate the model * `error_count`: how many checks failed * `warning_count`: how many checks warned * `issue_count`: the sum of `error_count` and `warning_count` * `metrics`: the measurements, or `null` if Meshy couldn't compute them * `is_watertight`: `true` if the mesh is watertight * `volume`: the volume, in the model's own units cubed * `non_manifold_edges`: the number of non-manifold edges * `degenerate_faces`: the number of degenerate faces * `holes`: the number of holes * `intended_print`: the print Meshy checked * `printer_type` * `height_mm`: `null` when the print is sized by its longest side * `longest_side_mm` * `wall_thickness_mm`: the thinnest wall that prints * `dimensions_mm`: the print's `[width, depth, height]` in millimeters. `null` unless the model is a GLB. * `thin_walls`: the thin-wall check * `thin_area_ratio`: the share of the surface thinner than `wall_thickness_mm`, from `0` to `1`. `null` if Meshy couldn't measure it. * `has_thin_walls`: `true` if any spot is thinner than `wall_thickness_mm`. Even a sharp corner on a model that prints fine counts, so check `status` instead. `null` if Meshy couldn't measure it. * `status`: `healthy` up to `0.05`, `error` above it, and `unknown` if Meshy couldn't measure it * `evaluated_at`: when Meshy evaluated the model, in Unix milliseconds. `null` if that wasn't recorded. For a result Meshy already had, it's the time of that earlier evaluation. A task created on v1 without a printer type or print size has no `intended_print` or `thin_walls`. These checks count toward `error_count` and `warning_count`: | Check | Warning | Error | | --- | --- | --- | | Holes | 1 to 8 | More than 8 | | Not watertight | 8 holes or fewer | More than 8 holes | | Non-manifold edges | 1 to 50 | More than 50 | | Degenerate faces | 1 or more | | | Volume | | 0 or less | | Thin walls | | More than 5% of the surface | **Succeeded Analyze Printability task, for an 80 mm tall FDM print** ```json { "id": "0199a8f6-3d27-7c2e-9b41-6e0c5d2f8a13", "type": "print-analyze", "status": "SUCCEEDED", "progress": 100, "created_at": 1790640079880, "started_at": 1790640079884, "finished_at": 1790640085401, "expires_at": 1790899285401, "preceding_tasks": 0, "consumed_credits": 0, "task_error": null, "input": { "input_task_id": "018a210d-8ba4-705c-b111-1f1776f7f578", "printer_type": "fdm", "intended_print_height_mm": 80 }, "output": { "printability": { "status": "warning", "issue_count": 3, "error_count": 0, "warning_count": 3, "metrics": { "is_watertight": false, "volume": 0.1715, "non_manifold_edges": 6, "degenerate_faces": 4682, "holes": 0 }, "intended_print": { "printer_type": "fdm", "height_mm": 80, "longest_side_mm": 80, "wall_thickness_mm": 1, "dimensions_mm": [38.39, 17.32, 80] }, "thin_walls": { "thin_area_ratio": 0.0139, "has_thin_walls": true, "status": "healthy" }, "evaluated_at": 1790640085228 } } } ``` --- # Repair Printability API Source: https://docs.meshy.ai/api/v2/repair-printability # Repair Printability API Repair a 3D model for printing. Meshy closes holes, fixes broken geometry, and thickens walls too thin for your printer. > **Note:** Moving from v1? The request is the same, except that `alpha_thumbnail` returns `400`. The main changes for Repair Printability: > * v2 checks wall thickness by default, for an FDM print 150 mm tall. > * These fields are in `output`: > * `model_urls` > * `thumbnail_url` > * `print_repair_report` > * There is no `texture_urls` field. > * `intended_print` stays at the top level, and every task you create on v2 has it. > > See [what changed for the other endpoints](/api/migrate-to-v2/reference#other-endpoints). --- ## POST /openapi/v2/print/repair -- Create a Repair Printability task Creates a Repair Printability 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). To see what needs fixing first, run [Analyze Printability](https://docs.meshy.ai/api/v2/analyze-printability.md), which is free. If the analysis read a task, or a GLB or OBJ file, you can then send its `id` here as `input_task_id`. ### Parameters - `input_task_id` · *string* · **required** Required unless you send `model_url`. The ID of a task with a GLB model, for example Text to 3D, Image to 3D, Remesh, or Retexture. The task must be one you created with the API, and have the status `SUCCEEDED`. An [Analyze Printability](https://docs.meshy.ai/api/v2/analyze-printability.md) task also works, if it analyzed a task or a GLB or OBJ file. The repair then uses the printer type and print size of that analysis. To use a different printer type or size, send your own. If the analysis checked no print size, the repair uses the default one. - `model_url` · *string* · **required** Required unless you send `input_task_id`. The model to repair, as a public URL or a data URI (`data:model/gltf-binary;base64,...`). Sending both `input_task_id` and `model_url` returns `400`. A URL must point to a GLB, STL, OBJ, FBX, or glTF file of at most 400 MB. A data URI must hold a GLB or glTF file of at most 100 MB. A larger file returns `400`. A GLB, glTF, FBX, or OBJ file over 100 MB 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. Over 100 MB, an FBX file must be binary FBX 7.1 or newer, and a GLB or glTF file must not use Draco compression. A file that breaks these rules returns `400`. A Meshy download URL, from the `output` of one of your tasks, is signed and stops working at that task's `expires_at`. Reading the task again doesn't renew it. For a model you made with Meshy, send `input_task_id` instead, which works for as long as Meshy keeps the task's files (see [Asset retention](https://docs.meshy.ai/api/v2/asset-retention.md)). To use the model after that, download it before `expires_at` and send your own copy. Meshy also checks for walls too thin to print. When more than 5% of the surface is thinner than the printer's thinnest wall, Meshy thickens the walls. Otherwise, it repairs only the geometry. A repair takes about 20 seconds, or about 100 seconds when Meshy thickens the walls. A model with thickened walls has about 1,000,000 faces. To judge the walls at your own print, send a printer type, a print size, or both. Without them, Meshy uses `fdm` and a default print size that depends on the format. The size tells Meshy how big you plan to print the model. Meshy doesn't scale the model to it. To scale the repaired model, send its task `id` as `input_task_id` to [Resize](https://docs.meshy.ai/api/v2/resize.md), which takes sizes in meters, so 100 mm is `0.1`. - `printer_type` · *string* · default: `fdm` The printer you plan to use. It sets the thinnest wall that prints. Available values: * `fdm`: 1.0 mm * `sla`: 0.8 mm * `full_color`: 2.0 mm Any other value returns `400`. - `intended_print_height_mm` · *number* The height of the print, in millimeters, from `1` to `1000`. A value outside this range returns `400`. Send this or `intended_print_longest_side_mm`, not both. Sending both returns `400`. For `model_url`, only a GLB file has a known up direction. A height with another format returns `400`, so send `intended_print_longest_side_mm` instead. Meshy also checks the print's longest side. It uses the model's proportions to calculate that length at the specified height, and the result must be from 1 to 1,000 mm. If the model is wider or deeper than it is tall, a height near 1,000 mm can fail even though the height itself is within range. To make the print's longest side close to 1,000 mm, use `intended_print_longest_side_mm` instead. If Meshy can't convert the height for the model, send `intended_print_longest_side_mm` instead. For most `input_task_id` models, the request returns `400`, for example when the height puts the model's longest side outside 1 to 1,000 mm. For a GLB `model_url`, or a very large input model, Meshy converts the height while the task runs. If that fails, the task fails with `task_error.type` set to `invalid_input`, and Meshy refunds its credits. - `intended_print_longest_side_mm` · *number* The length of the print's longest side, in millimeters, from `1` to `1000`. A value outside this range returns `400`. It works with every input format. - `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`. If you send no size, Meshy uses this print size: * 150 mm tall, for a task or a GLB file * 150 mm on the longest side, for an OBJ, FBX, or glTF file * The STL file's own size, read in millimeters. If Meshy can't read it, or it's outside 1 to 1,000 mm, Meshy uses 150 mm on the longest side. If Meshy can't work out a 150 mm tall print for a model, it uses 150 mm on the longest side. This happens when Meshy can't measure the model, or when 150 mm tall would make its longest side over 1,000 mm. Meshy rounds sizes to whole millimeters. ### 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`. The top-level `intended_print` is already there. See [Repair Printability output](#repair-printability-output). 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 (`Either input_task_id or model_url is required`). * Both `input_task_id` and `model_url` were sent (`Send either "input_task_id" or "model_url", not both.`). * The input task hasn't succeeded, or has no GLB model. The code `input_task_expired` means its model was deleted. * `model_url` has an unsupported extension or is too large. * `model_url` can't be downloaded (code `input_download_failed`), most often because it's a Meshy download URL past its `expires_at`. Reading the task again returns the same URL, so send `input_task_id` while Meshy keeps the task's files, or your own copy of the file. * A `model_url` file over 100 MB has too many faces (`model has too many faces: faces, the limit for files over 100 MB is `). Reduce the face count, then send the file again. * An FBX file over 100 MB is ASCII (`ASCII FBX files over 100 MB are not supported; use binary FBX or GLB`). Send it as binary FBX or GLB. * A file over 100 MB has a header Meshy can't 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`). * Both print sizes were sent. * `printer_type` isn't `fdm`, `sla`, or `full_color`. * A height was sent with a `model_url` that isn't a GLB file. * A height puts the input task's longest side outside 1 to 1,000 mm. Send `intended_print_longest_side_mm` 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 repair. 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. The message is `input_task_id does not match any of your tasks`. Check the ID, and use an API key from the account that created the task. A task of yours past its [retention period](https://docs.meshy.ai/api/v2/asset-retention.md) returns the code `input_task_expired` instead. - `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 # Repair a model file for an FDM print 150 mm tall curl https://api.meshy.ai/openapi/v2/print/repair \ -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" }' # Repair a Meshy task for a 60 mm resin print curl https://api.meshy.ai/openapi/v2/print/repair \ -X POST \ -H "Authorization: Bearer ${MESHY_API_KEY}" \ -H 'Content-Type: application/json' \ -d '{ "input_task_id": "018a210d-8ba4-705c-b111-1f1776f7f578", "printer_type": "sla", "intended_print_longest_side_mm": 60 }' ``` ```javascript // Repair a model file for an FDM print 150 mm tall const response = await fetch("https://api.meshy.ai/openapi/v2/print/repair", { 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", }), }); if (!response.ok) throw new Error(await response.text()); const task = await response.json(); console.log(task.id, task.status); ``` ```python import os import requests # Repair a model file for an FDM print 150 mm tall response = requests.post( "https://api.meshy.ai/openapi/v2/print/repair", headers={"Authorization": f"Bearer {os.environ['MESHY_API_KEY']}"}, json={"model_url": "https://cdn.meshy.ai/model/example_model_2.glb"}, ) response.raise_for_status() task = response.json() print(task["id"], task["status"]) ``` **Response** ```json { "id": "0199a8f6-3d27-7c2e-9b41-6e0c5d2f8a13", "type": "print-repair", "status": "PENDING", "progress": 0, "created_at": 1790640079880, "started_at": null, "finished_at": null, "expires_at": null, "preceding_tasks": 1, "consumed_credits": 10, "task_error": null, "input": { "model_url": "https://cdn.meshy.ai/model/example_model_2.glb" }, "output": null, "intended_print": { "printer_type": "fdm", "height_mm": 150, "longest_side_mm": null, "wall_thickness_mm": 1, "dimensions_mm": null } } ``` --- ## Get the result Read Repair Printability tasks the same way as every other v2 task, through the [Tasks](https://docs.meshy.ai/api/v2/tasks.md) routes. To list only Repair Printability tasks, filter by `type=print-repair`. | 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=print-repair`](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) | --- ## Repair Printability 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 URL to the repaired model, as one file in the input's format. The key is `glb` for an `input_task_id`, or the format of the `model_url` file, for example `stl`. The model keeps its size. Repair removes the model's textures, because it rebuilds the geometry. To add textures back, send this task's `id` to [Retexture](https://docs.meshy.ai/api/v2/retexture.md) as `input_task_id`. - `thumbnail_url` · *string* Signed URL to a PNG preview of the repaired model, without textures and with a transparent background. - `print_repair_report` · *object | null* What the thin-wall check found and did, with these fields: * `route`: which repair ran * `thin_wall`: more than 5% of the surface was too thin, so Meshy thickened the walls * `topology`: Meshy repaired only the geometry * `topology_unmeasured`: Meshy couldn't measure the thin walls * `applied`: `false` when thickening changed nothing. Only on the `thin_wall` route. * `faces_before`: the face count before thickening. Only on the `thin_wall` route. * `faces_after`: the face count after thickening, which can be much higher. Only on the `thin_wall` route. * `thin_area_ratio_before`: the share of the surface thinner than the wall limit before the repair, from `0` to `1`. Left out if Meshy couldn't measure it. * `thin_area_ratio_after`: the same share after the repair. Left out if Meshy couldn't measure it. `null` for a task created on v1 without a printer type or print size. The task object also has `intended_print` at the top level, from the create response on. A task created on v1 without a printer type or print size doesn't have it. It has these fields: * `printer_type` * `height_mm`: `null` when the print is sized by its longest side * `longest_side_mm`: when you size by height, it can be `null` until Meshy measures the model * `wall_thickness_mm`: the thinnest wall that prints * `dimensions_mm`: the print's `[width, depth, height]` in millimeters, after Meshy measures it. `null` for formats other than GLB. **Succeeded Repair Printability task, for a 60 mm resin print** ```json { "id": "0199a8f6-3d27-7c2e-9b41-6e0c5d2f8a13", "type": "print-repair", "status": "SUCCEEDED", "progress": 100, "created_at": 1790640079880, "started_at": 1790640079884, "finished_at": 1790640141527, "expires_at": 1790899341527, "preceding_tasks": 0, "consumed_credits": 10, "task_error": null, "input": { "input_task_id": "018a210d-8ba4-705c-b111-1f1776f7f578", "printer_type": "sla", "intended_print_longest_side_mm": 60 }, "output": { "model_urls": { "glb": "https://assets.meshy.ai/***/output/model.glb?Expires=***" }, "thumbnail_url": "https://assets.meshy.ai/***/output/preview.png?Expires=***", "print_repair_report": { "route": "thin_wall", "applied": true, "faces_before": 30708, "faces_after": 1000000, "thin_area_ratio_before": 0.0781, "thin_area_ratio_after": 0 } }, "intended_print": { "printer_type": "sla", "height_mm": null, "longest_side_mm": 60, "wall_thickness_mm": 0.8, "dimensions_mm": [60, 12.68, 58.12] } } ``` --- # Auto Split API Source: https://docs.meshy.ai/api/v2/auto-split # Auto Split API Cut a generated model into parts you can print separately. Meshy chooses the cuts, or cuts along the parts or colors you name, and can add connectors so the printed parts fit back together. > **Note:** Moving from v1? The request is the same. The main changes for Auto Split: > * `model_urls`, `thumbnail_url`, and `part_count` are in `output`. > * `prompt_ignored` stays at the top level. > > See [what changed for the other endpoints](/api/migrate-to-v2/reference#other-endpoints). --- ## POST /openapi/v2/print/split -- Create an Auto Split task Creates an Auto Split 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). With `by_parts` or `by_color`, Meshy reads your prompt before it answers. The create request then usually takes a few seconds longer, and can take up to about a minute. Set your HTTP timeout to allow for that. ### Parameters - `input_task_id` · *string* · **required** The ID of the task whose model to split. The task must be one of yours, and have the status `SUCCEEDED`. These tasks work: * [Image to 3D](https://docs.meshy.ai/api/v2/image-to-3d.md) * [Multi-Image to 3D](https://docs.meshy.ai/api/v2/multi-image-to-3d.md) * [Text to 3D](https://docs.meshy.ai/api/v2/text-to-3d.md), a preview, refine, or one-call task * A [Retexture](https://docs.meshy.ai/api/v2/retexture.md), [Remesh](https://docs.meshy.ai/api/v2/remesh.md), [Convert](https://docs.meshy.ai/api/v2/convert.md), or [Resize](https://docs.meshy.ai/api/v2/resize.md) task of one of the preceding tasks The model must be generated with Meshy 6 or Meshy 7, including `meshy-6-lite`. Smart Topology models return `400`. A Retexture, Remesh, Convert, or Resize task made from an uploaded model also returns `400`. The model can have at most 8,000,000 faces. A model with more faces returns `400`. In that case, run a Remesh task on it first, and send the Remesh task's `id` instead. You can split a textured model. To keep its texture on the parts, send `keep_texture: true`. - `mode` · *string* · default: `auto` How to divide the model. Available values: * `auto`: Meshy chooses the cuts. * `by_parts`: cuts into the parts you name in `prompt`, for example head, torso, and legs. * `by_color`: cuts along the color regions you name in `prompt`. Meshy finds the regions in the image the model was generated from, so the input must come from Image to 3D or Multi-Image to 3D. For Multi-Image to 3D, Meshy uses the first image. Other inputs return `400`. **Only when `mode` is set:** - `prompt` · *string* · **required** Required for `by_parts` and `by_color`. The parts to split the model into, in any language, up to 600 characters. Longer text returns `400`, even when `mode` is `auto`. Name 1 to 10 parts, for example `head, torso, left arm, right arm, legs`. If the parts you name don't cover the whole model, the rest of it becomes one more part. For example, `the head` splits the head off the rest of the model. That extra part counts toward the limit of 10. A prompt that names more than 10 parts, or asks for no split, returns `400`. If Meshy can't find any part in the prompt, it splits the model into the parts it finds in the model's reference image instead. The mode stays the same. Meshy still charges the task, and sets `prompt_ignored: true`. The reference image is your input image. For Text to 3D, it's the image Meshy generated for the model, when there is one. If there is no reference image, or Meshy finds fewer than 2 parts in it, the request returns `400` with the message `Could not understand the split description`. Meshy doesn't charge for a request that returns `400`. - `target_formats` · *string[]* · default: `["glb"]` The file formats to generate. Meshy always returns a GLB file, plus the other formats you list. Available values: * `glb` * `obj` * `fbx` * `stl` * `usdz` * `blend` * `3mf` Any other value returns `400`. In a 3MF file, each part is its own object, ready for a slicer. An STL file can't hold separate objects, so Meshy fuses the parts into one solid. With `keep_texture: true`, GLB, FBX, USDZ, and Blend files hold the texture, and an OBJ file comes with its `.mtl` file. STL and 3MF files hold geometry only. Meshy scales an STL or 3MF file down to at most 150 mm on the longest side. A smaller model keeps its size. - `layout` · *string* · default: `assembled` How Meshy arranges the parts, in every file and in the preview. Available values: * `assembled`: the parts stay where they were in the model. * `on_plate`: Meshy lays the parts flat and spreads them out on a build plate, ready to slice. In this layout, an OBJ file is Z-up, in millimeters, and also scaled down to at most 150 mm on its longest side. - `keep_texture` · *boolean* · default: `false` Whether to keep the input model's texture on the parts. `true` gives every part the input's texture, and `output.texture_urls` lists the maps. `false` gives each part a flat color. With `true`, the task takes about twice as long, and the credit cost doesn't change. An untextured input splits the same way as with `false`. If Meshy can't keep the texture, the task fails with the error code `textured_split_refused`. See [Errors](https://docs.meshy.ai/api/v2/errors.md#textured-split-refused). - `connectors` · *boolean* · default: `false` Whether to add mortise-and-tenon connectors at each cut, so the printed parts fit together. `false` splits the model without connectors. If Meshy can't place the connectors, the split still succeeds without them. The response doesn't say whether Meshy placed them. **Only when `connectors` is set:** - `connector_type` · *string* · default: `cube` The connector's shape, `cube` or `cylinder`. - `connector_size` · *number* · default: `0.5` The connector's size, as a fraction of the widest circle that fits in the cut face, from `0.1` to `0.8`. A value outside this range returns `400`, even when `connectors` is `false`. - `connector_height` · *number* · default: `0.1` How far the connector sticks out of the cut, in the units of the GLB file, from `0.1` to `0.8`. A value outside this range returns `400`, even when `connectors` is `false`. ### 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`. If Meshy split the model into the parts it found instead of the ones in your prompt, the task also has `prompt_ignored: true`. 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: * `input_task_id` is missing. * The input task hasn't succeeded, or isn't a supported type (`Input task mode does not support splitting; ...`). * The model wasn't generated with Meshy 6 or Meshy 7 (`Auto Split requires a model generated with Meshy 6 or Meshy 7`). * `prompt` is missing for `by_parts` or `by_color`. * `by_color` was sent for a model that wasn't made from an image. Send `by_parts` or `auto` instead. * The prompt names no usable split, for example it asks for one piece or names more than 10 parts. Name the parts to split into, up to 10. 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` One of these applies: * Content moderation blocked the prompt. The message is `explicit content` or `prohibited content`. Change the prompt, then retry. * `input_task_id` is a bas-relief model, which this endpoint can't split. 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. The message is `input_task_id does not match any of your tasks`. Check the ID, and use an API key from the account that created the task. A task of yours past its [retention period](https://docs.meshy.ai/api/v2/asset-retention.md) returns the code `input_task_expired` instead. - `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. * You sent more than 12 prompts in a minute with `by_parts` or `by_color`. This limit is per user, and splits you make in the Meshy web app count toward it. Wait a moment, then retry. - `503 - Service Unavailable` Meshy is too busy to read the prompt. The message is `Prompt parsing is busy right now; retry shortly`. Retry later, or send `mode: "auto"`. Meshy doesn't charge for this response. **cURL** ```bash # Let Meshy choose the cuts curl https://api.meshy.ai/openapi/v2/print/split \ -X POST \ -H "Authorization: Bearer ${MESHY_API_KEY}" \ -H 'Content-Type: application/json' \ -d '{ "input_task_id": "018a210d-8ba4-705c-b111-1f1776f7f578" }' # Split into named parts that keep the texture, laid out on a plate with connectors, plus a 3MF curl https://api.meshy.ai/openapi/v2/print/split \ -X POST \ -H "Authorization: Bearer ${MESHY_API_KEY}" \ -H 'Content-Type: application/json' \ -d '{ "input_task_id": "018a210d-8ba4-705c-b111-1f1776f7f578", "mode": "by_parts", "prompt": "head, torso, arms, legs", "target_formats": ["3mf"], "layout": "on_plate", "keep_texture": true, "connectors": true }' ``` ```javascript // Let Meshy choose the cuts const response = await fetch("https://api.meshy.ai/openapi/v2/print/split", { method: "POST", headers: { Authorization: `Bearer ${process.env.MESHY_API_KEY}`, "Content-Type": "application/json", }, body: JSON.stringify({ input_task_id: "018a210d-8ba4-705c-b111-1f1776f7f578", }), }); if (!response.ok) throw new Error(await response.text()); const task = await response.json(); console.log(task.id, task.status); ``` ```python import os import requests # Let Meshy choose the cuts response = requests.post( "https://api.meshy.ai/openapi/v2/print/split", headers={"Authorization": f"Bearer {os.environ['MESHY_API_KEY']}"}, json={"input_task_id": "018a210d-8ba4-705c-b111-1f1776f7f578"}, ) response.raise_for_status() task = response.json() print(task["id"], task["status"]) ``` **Response** ```json { "id": "0199a8f6-3d27-7c2e-9b41-6e0c5d2f8a13", "type": "print-split", "status": "PENDING", "progress": 0, "created_at": 1790640079880, "started_at": null, "finished_at": null, "expires_at": null, "preceding_tasks": 1, "consumed_credits": 10, "task_error": null, "input": { "input_task_id": "018a210d-8ba4-705c-b111-1f1776f7f578" }, "output": null } ``` --- ## Get the result Read Auto Split tasks the same way as every other v2 task, through the [Tasks](https://docs.meshy.ai/api/v2/tasks.md) routes. To list only Auto Split tasks, filter by `type=print-split`. | 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=print-split`](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) | --- ## Auto Split 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 split model, keyed by format. There is always a `glb` key, plus one key for each other format in `target_formats`. An `obj` with a texture also gets an `mtl` key, with the URL of its material file. - `thumbnail_url` · *string | null* Signed URL to a preview in the `layout` you asked for. It shows the texture when the parts keep one, and gives each part its own color otherwise. - `texture_urls` · *array* The texture maps that all the parts share, as one item with a signed URL for each of these maps: * `base_color` * `metallic` * `roughness` * `normal` A map the input doesn't have is `null`. Present only when `keep_texture` is `true` and the input model is textured. Otherwise, each part has a flat color, and the field is absent. - `part_count` · *integer | null* The number of parts Meshy split the model into. With `by_parts` or `by_color`, this can differ from the number of parts you named, because one name can become several parts, or none. The task object can also have `prompt_ignored: true` at the top level, from the create response on. Meshy adds it when it split the model into the parts it found instead of the ones in your prompt, and leaves it out otherwise. If a safety check declines the input model, the task fails with `task_error.type` set to `invalid_input` and `task_error.code` set to `provider_content_refused`. Send a different model. See [Errors](https://docs.meshy.ai/api/v2/errors.md#invalid-input). With `keep_texture: true`, if Meshy can't keep the texture, the task fails with `task_error.code` set to `textured_split_refused`. See [Errors](https://docs.meshy.ai/api/v2/errors.md#textured-split-refused). **Succeeded Auto Split task** ```json { "id": "0199a8f6-3d27-7c2e-9b41-6e0c5d2f8a13", "type": "print-split", "status": "SUCCEEDED", "progress": 100, "created_at": 1790640079880, "started_at": 1790640079887, "finished_at": 1790640152916, "expires_at": 1790899352916, "preceding_tasks": 0, "consumed_credits": 10, "task_error": null, "input": { "input_task_id": "018a210d-8ba4-705c-b111-1f1776f7f578", "keep_texture": true }, "output": { "model_urls": { "glb": "https://assets.meshy.ai/***/output/model.glb?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": "https://assets.meshy.ai/***/output/texture_0_normal.png?Expires=***" } ], "part_count": 6 } } ``` --- # Relief API Source: https://docs.meshy.ai/api/v2/relief # Relief API Turn one photo into a bas-relief 3D model and a 16-bit depth map, for 3D printing, laser engraving, and CNC carving. > **Note:** Moving from v1? The request is the same, except that `target_formats` defaults to `["glb"]`. To keep the STL file, send `"target_formats": ["glb", "stl"]`. `model_urls`, `texture_urls`, `depth_map_url`, and `thumbnail_url` are in `output`, where an empty `depth_map_url` or `thumbnail_url` is `null`. > > See [what changed for the other endpoints](/api/migrate-to-v2/reference#other-endpoints). --- ## POST /openapi/v2/relief -- Create a Relief task Creates a Relief task and returns the [task object](https://docs.meshy.ai/api/v2/tasks.md#the-task-object). When it succeeds, the task produces the model in the formats in `target_formats`, a 16-bit grayscale depth map, and a preview image. To get only the depth map, set `should_generate_model` to `false`. The task runs in the background. To read its result, see [Get the result](#get-the-result). A Relief task can't be the input of another endpoint, such as Remesh, Convert, or Auto Split. Those requests return `403`. ### Parameters - `image_url` · *string* · **required** The photo to turn into a relief, as a public URL or a data URI (`data:image/png;base64,...`). The image must be a JPG, JPEG, PNG, or WebP file of at most 20 MB, and at least 32 × 32 pixels. Its longer side can be at most about 16 times its shorter side. Any other image returns `400`. Meshy fills transparent areas with black before it builds the relief. - `variant` · *string* · default: `low` The relief style. It shapes the depth map and sets the default `carving_depth_mm`. Available values: * `high`: deeper carving, for 3D-printed pieces. * `low`: shallow carving, for laser engraving, CNC carving, and thin plaques. Sending `null` or `""` is the same as leaving it out. Any other value returns `400`. - `should_generate_model` · *boolean* · default: `true` Whether to build the relief model. Set it to `false` for a depth-map-only task, with no model and no preview image. Meshy still checks the size, carving, base, bend, resolution, format, and color parameters, but doesn't use them. It doesn't change the credit cost. - `size_mm` · *number* · default: `60` The length of the photo's longer side on the model, measured flat before any bend, from `20` to `250` millimeters. With `remove_base`, the model can be smaller. - `carving_mode` · *string* · default: `emboss` Whether the subject stands out from the plate or is cut into it. Available values: * `emboss`: the nearer parts of the photo stand out. * `engrave`: the depth is inverted, so the nearer parts are cut in. The depth map is the same in both modes. - `carving_depth_mm` · *number* · default: `6 (high), 3 (low)` How deep the relief is carved, from `0` to `60` millimeters. With `remove_base` set to `true`, `0` leaves an empty model. The task still succeeds and costs 20 credits, and its model files have no geometry. - `remove_base` · *boolean* · default: `false` Whether to cut away the background and build no base plate. When it's `true`, `removal_threshold` sets what counts as background. Meshy checks `removal_threshold` either way. **Only when `remove_base` is set:** - `removal_threshold` · *number* · default: `0.01` The depth below which Meshy cuts the background away, from `0.01` to `1`, where the depth map runs from `0` to `1`. A high value can cut away the whole relief and leave an empty model, which still succeeds and is charged. - `base_thickness_mm` · *number* · default: `1, or 0 with remove_base` The thickness of the base plate, from `0.1` to `10` millimeters. When `remove_base` is `true`, leave it out or send `0`. - `bend_mode` · *string* · default: `off` Whether to bend the relief, and which way. When it isn't `off`, `bend_axis` and `bend_angle` shape the bend. Meshy checks them either way. Available values: * `off`: a flat relief. * `convex`: the front bulges outward. * `concave`: the front curves inward. **Only when `bend_mode` is set:** - `bend_axis` · *string* · default: `xz` Which edges the bend curls. Available values: * `xz`: the left and right edges. * `yz`: the top and bottom edges. - `bend_angle` · *number* · default: `60` The arc the bend spans, from `0` to `360` degrees. Below `1`, the relief stays flat. - `mesh_resolution` · *integer* · default: `1024` The number of mesh points along the photo's longer side, from `512` to `2048`. A higher value keeps finer detail and makes larger files. At the default `1024`, the GLB file is about 40 to 50 MB and the STL file about 80 to 105 MB. A square photo gives the larger sizes. At `2048`, they are about 150 MB and 300 MB. A bend makes them larger: the STL file can reach about 800 MB at `2048`. - `target_formats` · *string[]* · default: `["glb"]` The file formats to generate. Meshy generates and returns only the formats you list, which can shorten the task. Available values: * `glb` * `obj` * `fbx` * `stl` * `usdz` * `3mf` STL and 3MF files keep the relief's real size. - `color_mapping` · *boolean* · default: `false` Whether to color the model with the photo. The GLB, OBJ, FBX, and USDZ files carry color. STL and 3MF files stay white. The task returns the texture in `texture_urls`. It doesn't change the credit cost. ### 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`. A Relief task costs 20 credits, refunded if it fails. For what a delete refunds, see [Delete a task](https://docs.meshy.ai/api/v2/tasks.md#delete-a-task). 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: * `image_url` is missing. * A parameter has the wrong type, is outside its range, or isn't one of its available values. For example, `variant` isn't `high` or `low`, `mesh_resolution` isn't an integer from `512` to `2048`, or `target_formats` lists an unknown format. * `base_thickness_mm` isn't `0` with `remove_base` set to `true`, or is below `0.1` without it. * The image can't be downloaded. * The image isn't a JPG, JPEG, PNG, or WebP file, is over 20 MB, is smaller than 32 × 32 pixels, has too many pixels, or can't be read. * The image's longer side is more than about 16 times its shorter side. The error message says which problem it found. Meshy doesn't charge for a request that returns `400`. 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` Content moderation blocked the image. Send a different image. See [Errors](https://docs.meshy.ai/api/v2/errors.md#moderation-blocked). - `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. If a safety check declines the image while the task runs, the task fails with `task_error.type` set to `invalid_input` and `task_error.code` set to `provider_content_refused`. Meshy refunds the task's credits. Send a different image. See [Errors](https://docs.meshy.ai/api/v2/errors.md#invalid-input). **cURL** ```bash # A low relief, 60 mm on its longer side curl https://api.meshy.ai/openapi/v2/relief \ -X POST \ -H "Authorization: Bearer ${MESHY_API_KEY}" \ -H 'Content-Type: application/json' \ -d '{ "image_url": "https://docs.meshy.ai/images/api/quick-start/source-photo.webp" }' # A deep, curved, colored 120 mm relief as GLB, OBJ, and STL files curl https://api.meshy.ai/openapi/v2/relief \ -X POST \ -H "Authorization: Bearer ${MESHY_API_KEY}" \ -H 'Content-Type: application/json' \ -d '{ "image_url": "https://docs.meshy.ai/images/api/quick-start/source-photo.webp", "variant": "high", "size_mm": 120, "carving_depth_mm": 10, "base_thickness_mm": 3, "bend_mode": "convex", "bend_angle": 90, "color_mapping": true, "target_formats": ["glb", "obj", "stl"] }' ``` ```javascript // A low relief, 60 mm on its longer side const response = await fetch("https://api.meshy.ai/openapi/v2/relief", { method: "POST", headers: { Authorization: `Bearer ${process.env.MESHY_API_KEY}`, "Content-Type": "application/json", }, body: JSON.stringify({ image_url: "https://docs.meshy.ai/images/api/quick-start/source-photo.webp", }), }); if (!response.ok) throw new Error(await response.text()); const task = await response.json(); console.log(task.id, task.status); ``` ```python import os import requests # A low relief, 60 mm on its longer side response = requests.post( "https://api.meshy.ai/openapi/v2/relief", headers={"Authorization": f"Bearer {os.environ['MESHY_API_KEY']}"}, json={ "image_url": "https://docs.meshy.ai/images/api/quick-start/source-photo.webp", }, ) response.raise_for_status() task = response.json() print(task["id"], task["status"]) ``` **Response** ```json { "id": "0199c3d2-5a7e-7b14-9e2f-3c8d1a6b4f20", "type": "relief", "name": null, "status": "PENDING", "progress": 0, "created_at": 1790640079880, "started_at": null, "finished_at": null, "expires_at": null, "preceding_tasks": 1, "consumed_credits": 20, "task_error": null, "input": { "image_url": "https://docs.meshy.ai/images/api/quick-start/source-photo.webp" }, "output": null } ``` --- ## Get the result Read Relief tasks the same way as every other v2 task, through the [Tasks](https://docs.meshy.ai/api/v2/tasks.md) routes. To list only Relief tasks, filter by `type=relief`. | 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=relief`](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) | --- ## Relief 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 relief model, one per format in `target_formats`, keyed by format. An `obj` comes with an `mtl`. The GLB file's units are meters. The STL file is binary, and its units are millimeters, so it opens at the relief's real size, with Z up. The files can be large; [`mesh_resolution`](#create-a-relief-task) lists typical sizes. `{}` for a depth-map-only task (`should_generate_model` set to `false`). - `texture_urls` · *array* The texture of a colored model, as one item with a signed URL to its `base_color` map. The other maps are `null`. Present only when you sent `color_mapping: true`. - `depth_map_url` · *string | null* Signed URL to the 16-bit grayscale depth map the relief is built from. Brighter pixels are higher. The values are relative heights, not millimeters. Laser engraving and CNC software can use it as a height map. The file is about 1 to 2 MB. `null` if there is none. - `thumbnail_url` · *string | null* Signed URL to a preview image of the relief model, or `null` if none was rendered, including for a depth-map-only task. **Succeeded Relief task** ```json { "id": "0199c3d2-5a7e-7b14-9e2f-3c8d1a6b4f20", "type": "relief", "name": null, "status": "SUCCEEDED", "progress": 100, "created_at": 1790640079880, "started_at": 1790640079887, "finished_at": 1790640139916, "expires_at": 1790899339916, "preceding_tasks": 0, "consumed_credits": 20, "task_error": null, "input": { "image_url": "https://docs.meshy.ai/images/api/quick-start/source-photo.webp" }, "output": { "model_urls": { "glb": "https://assets.meshy.ai/***/output/model.glb?Expires=***" }, "depth_map_url": "https://assets.meshy.ai/***/output/depth.png?Expires=***", "thumbnail_url": "https://assets.meshy.ai/***/output/preview.png?Expires=***" } } ``` **Depth map only** ```json { "id": "0199c3d2-6b8f-7c25-8f3a-4d9e2b7c5a31", "type": "relief", "name": null, "status": "SUCCEEDED", "progress": 100, "created_at": 1790640079880, "started_at": 1790640079887, "finished_at": 1790640109916, "expires_at": 1790899309916, "preceding_tasks": 0, "consumed_credits": 20, "task_error": null, "input": { "image_url": "https://docs.meshy.ai/images/api/quick-start/source-photo.webp", "should_generate_model": false }, "output": { "model_urls": {}, "depth_map_url": "https://assets.meshy.ai/***/output/depth.png?Expires=***", "thumbnail_url": null } } ``` **Colored model** ```json { "id": "0199c3d2-7c90-7d36-9a4b-5e0f3c8d6b42", "type": "relief", "name": null, "status": "SUCCEEDED", "progress": 100, "created_at": 1790640079880, "started_at": 1790640079887, "finished_at": 1790640139916, "expires_at": 1790899339916, "preceding_tasks": 0, "consumed_credits": 20, "task_error": null, "input": { "image_url": "https://docs.meshy.ai/images/api/quick-start/source-photo.webp", "color_mapping": true, "target_formats": ["glb", "obj"] }, "output": { "model_urls": { "glb": "https://assets.meshy.ai/***/output/model.glb?Expires=***", "mtl": "https://assets.meshy.ai/***/output/model.mtl?Expires=***", "obj": "https://assets.meshy.ai/***/output/model.obj?Expires=***" }, "texture_urls": [ { "base_color": "https://assets.meshy.ai/***/output/texture_0.png?Expires=***", "metallic": null, "roughness": null, "normal": null, "metallic_roughness": null, "emission": null } ], "depth_map_url": "https://assets.meshy.ai/***/output/depth.png?Expires=***", "thumbnail_url": "https://assets.meshy.ai/***/output/preview.png?Expires=***" } } ``` --- # Balance API Source: https://docs.meshy.ai/api/v2/balance # Balance API Check how many credits you can spend, and how many of them expire at the next monthly refresh. > **Note:** Moving from v1? Only the path changes. `GET /openapi/v1/balance` becomes `GET /openapi/v2/balance`, and the response stays the same. See [Endpoint paths in the migration reference](/api/migrate-to-v2/reference#endpoints). --- ## GET /openapi/v2/balance -- Get the balance Returns the credit balance of the account that owns the API key. On a team with a shared credit pool, the values are those of the pool. Calling this endpoint is free. ### Parameters None. ### Returns - `balance` · *integer* Number of credits you can spend. It's usually `monthly_credits` plus `permanent_credits`. It's lower when a member credit limit or an Enterprise workspace credit limit applies to you. Team owners and admins have no such limit. `balance` doesn't take an [API key credit limit](/api/authentication) into account. A request can still return `402` with `API key credit limit reached` while `balance` is above zero. - `monthly_credits` · *integer* Number of credits from your plan's monthly allowance. Meshy clears unused monthly credits at the next monthly refresh, at `monthly_resets_at`. Some Enterprise plans carry part of them over. - `permanent_credits` · *integer* Number of credits that don't expire, for example from credit packs you bought and from rewards. - `monthly_resets_at` · *integer | null* Time of the next monthly refresh, in Unix milliseconds. At that time, your plan's monthly allowance replaces the remaining monthly credits. `null` when the account has no refresh date. On an account that doesn't refresh monthly, it can be a time in the past. ### Failure modes - `401 - Unauthorized` The API key is missing or invalid. Check the `Authorization` header. - `429 - Too Many Requests` You sent too many requests. Wait the number of seconds in `Retry-After`, then retry. **cURL** ```bash # Get your credit balance curl https://api.meshy.ai/openapi/v2/balance \ -H "Authorization: Bearer ${MESHY_API_KEY}" ``` ```javascript // Get your credit balance const response = await fetch("https://api.meshy.ai/openapi/v2/balance", { headers: { Authorization: `Bearer ${process.env.MESHY_API_KEY}` }, }); if (!response.ok) throw new Error(await response.text()); const balance = await response.json(); console.log(balance.balance, balance.monthly_resets_at); ``` ```python import os import requests # Get your credit balance response = requests.get( "https://api.meshy.ai/openapi/v2/balance", headers={"Authorization": f"Bearer {os.environ['MESHY_API_KEY']}"}, ) response.raise_for_status() balance = response.json() print(balance["balance"], balance["monthly_resets_at"]) ``` **Response** ```json { "balance": 1000, "monthly_credits": 600, "permanent_credits": 400, "monthly_resets_at": 1793491200000 } ``` --- # Usage API Source: https://docs.meshy.ai/api/v2/usage # Usage API List your team's finished API tasks and the credits each one used, for billing exports and cost reports. > **Note:** Moving from v1? The parameters and records are the same as on `GET /openapi/v1/usage/tasks`. The response is `{"data": [...], "has_more": ...}` instead of a bare array. See [Endpoint paths in the migration reference](/api/migrate-to-v2/reference#endpoints). To call this endpoint, use an API key of an active member of a **Studio** or **Enterprise** team. Any member can call it, not only owners and admins. With any other API key, the request returns `403`. --- ## GET /openapi/v2/usage/tasks -- List usage records Returns one page of your team's usage records, newest first by default. Without `start_time` and `end_time`, the records cover the last 30 days. Calling this endpoint is free. The records include these tasks: * API tasks that finished as `SUCCEEDED` or `FAILED` * Tasks of every current member of the team, from any of their API keys * Tasks you deleted, and tasks whose files have expired The records leave out these tasks: * Tasks that are still `PENDING` or `IN_PROGRESS`, and `CANCELED` tasks * Tasks of people who have left the team They also leave out these tasks, even though they use the same credits: * Creative Lab tasks * Tasks that Meshy's AI agents ran * Work done in the Meshy web app A task appears after it finishes, in the window of its `created_at`. Before you reconcile, pull recent windows again. If your team has a data retention period, the window starts no earlier than that period allows. ### Parameters - `start_time` · *string* The start of the window, as an RFC 3339 timestamp, for example `2026-09-01T00:00:00Z`. The records include tasks created at or after this time. Leave it out to start the window 30 days before `end_time`. The window can span at most 366 days. A longer window returns `400`, so split a longer export into several windows. In a URL, write the `+` of an offset such as `+08:00` as `%2B`, or use `Z`. Otherwise the `+` is read as a space, and the request returns `400`. - `end_time` · *string* The end of the window, as an RFC 3339 timestamp. The records include tasks created before this time. Leave it out to end the window at the time of your request. - `endpoints` · *string* A comma-separated list of the endpoints to include, by the same names as the `endpoint` field. Leave it out to include every endpoint. An unknown name returns `400`. Available values: * `text-to-3d`: one-call, preview, and refine Text to 3D tasks * `text-to-3d-preview`: preview tasks only * `text-to-3d-refine`: refine tasks only * `image-to-3d` * `multi-image-to-3d` * `remesh` * `convert` * `resize` * `uv-unwrap` * `retexture` * `rig` * `rig-check` * `animate` * `text-to-motion` * `text-to-image` * `image-to-image` * `print-multi-color` * `print-analyze` * `print-repair` * `print-split` * `relief` - `status` · *string* The status to include, `SUCCEEDED` or `FAILED`. Leave it out to include both. Any other value returns `400`. - `page_num` · *integer* · default: `1` The page to return, from `1` to `255`. A value above `255` returns `400`. One window holds at most 255 pages, so split a large export into shorter windows. - `page_size` · *integer* · default: `10` Number of records per page, from `1` to `100`. A value from `101` to `255` returns 100 records, and a value above `255` returns `400`. - `sort_by` · *string* · default: `-created_at` The sort order. Available values: * `-created_at`: newest first * `+created_at`: oldest first In a URL, write `+` as `%2B`. Otherwise the `+` is read as a space, and the request returns `400`. ### Returns - `data` · *array* The [usage records](#the-usage-record-object) on this page. An empty array when there are none. - `has_more` · *boolean* Whether there's another page. If `true`, request the next page with `page_num` plus one. `false` on the last page. The response has no total count. ### Failure modes - `400 - Bad Request` A parameter is invalid. The error message says which one. For example: * `start_time must be an RFC 3339 timestamp, e.g. 2026-01-01T00:00:00Z` * `end_time must be after start_time` * `time range cannot exceed 1 year` * `invalid endpoint: "rigging"` * `invalid sort_by: " created_at"` Fix the parameter, then send the request again. 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. - `403 - Forbidden` The API key's account isn't an active member of a Studio or Enterprise team. The message is `This endpoint is available on Studio and Enterprise plans`. Use an API key of a Studio or Enterprise team member. - `429 - Too Many Requests` You sent too many requests. Wait the number of seconds in `Retry-After`, then retry. **cURL** ```bash # List September's usage, 50 records per page curl "https://api.meshy.ai/openapi/v2/usage/tasks?page_size=50&start_time=2026-09-01T00:00:00Z&end_time=2026-10-01T00:00:00Z" \ -H "Authorization: Bearer ${MESHY_API_KEY}" ``` ```javascript // Export every usage record from September, one page at a time const params = new URLSearchParams({ page_size: "100", start_time: "2026-09-01T00:00:00Z", end_time: "2026-10-01T00:00:00Z", }); const records = []; for (let page = 1; ; page++) { params.set("page_num", String(page)); const response = await fetch( `https://api.meshy.ai/openapi/v2/usage/tasks?${params}`, { headers: { Authorization: `Bearer ${process.env.MESHY_API_KEY}` } }, ); if (!response.ok) throw new Error(await response.text()); const { data, has_more } = await response.json(); records.push(...data); if (!has_more) break; } const credits = records.reduce((sum, r) => sum + r.consumed_credits, 0); console.log(records.length, credits); ``` ```python import os import requests # Export every usage record from September, one page at a time params = { "page_size": 100, "start_time": "2026-09-01T00:00:00Z", "end_time": "2026-10-01T00:00:00Z", } records = [] page = 1 while True: response = requests.get( "https://api.meshy.ai/openapi/v2/usage/tasks", headers={"Authorization": f"Bearer {os.environ['MESHY_API_KEY']}"}, params={**params, "page_num": page}, ) response.raise_for_status() body = response.json() records.extend(body["data"]) if not body["has_more"]: break page += 1 print(len(records), sum(r["consumed_credits"] for r in records)) ``` **Response** ```json { "data": [ { "task_id": "018a210d-8ba4-705c-b111-1f1776f7f578", "endpoint": "image-to-3d", "status": "SUCCEEDED", "created_at": 1790640079880, "finished_at": 1790640138211, "consumed_credits": 30, "api_key_name": "production", "api_key_suffix": "a1b2", "metadata": { "user": "alex@example.com", "team": "fab" } }, { "task_id": "018a210d-1c22-7e0f-9d3a-4a5b6c7d8e9f", "endpoint": "text-to-3d", "status": "FAILED", "created_at": 1790639000000, "finished_at": 1790639030000, "consumed_credits": 0, "api_key_name": "production", "api_key_suffix": "a1b2", "metadata": {} } ], "has_more": true } ``` --- ## Usage record object - `task_id` · *string* The task ID. To read a task you created, use [`GET /openapi/v2/tasks/{id}`](https://docs.meshy.ai/api/v2/tasks.md#get-a-task) until the task is deleted or expires. A task that a teammate created returns `404` there, because each API key reads only its own account's tasks. - `endpoint` · *string* The task's [type](https://docs.meshy.ai/api/v2/tasks.md#task-types), for example `image-to-3d`, `rig`, or `print-repair`. A one-call Text to 3D task shows `text-to-3d`, and a preview or refine task shows `text-to-3d-preview` or `text-to-3d-refine`. Older records can have names of retired endpoints, which the `endpoints` filter doesn't accept. - `status` · *string* The task's final status, `SUCCEEDED` or `FAILED`. - `created_at` · *integer* Time the task was created, in Unix milliseconds. - `finished_at` · *integer | null* Time the task finished, in Unix milliseconds. `null` if the task has no finish time. - `consumed_credits` · *integer* Number of credits the task used, after refunds. `0` for a failed task, and for free tasks such as Analyze Printability. - `api_key_name` · *string* The name of the API key that ran the task. For a task run with a Meshy CLI login, it's `Meshy CLI`. It's an empty string in these cases: * The task was never charged, for example an Analyze Printability task, which is free. * The API key has been deleted. * The task ran through another app's login. * The API key was created in the last few minutes. - `api_key_suffix` · *string* The last four characters of that API key, to tell keys with the same name apart. An empty string whenever `api_key_name` is empty, and for Meshy CLI logins. - `metadata` · *object* The tags sent in the `X-Meshy-Metadata` header when the task was created. `{}` if none. See [Metadata](https://docs.meshy.ai/api/v2/metadata.md). **Usage record** ```json { "task_id": "018a210d-8ba4-705c-b111-1f1776f7f578", "endpoint": "image-to-3d", "status": "SUCCEEDED", "created_at": 1790640079880, "finished_at": 1790640138211, "consumed_credits": 30, "api_key_name": "production", "api_key_suffix": "a1b2", "metadata": { "user": "alex@example.com", "team": "fab" } } ``` ---