# 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 # Documentation Index Each link below points to the Markdown version of that page. For single-fetch full content (all v2 pages concatenated), see [llms-full.txt](https://docs.meshy.ai/api/v2/llms-full.txt). ## Getting Started - [Meshy API v2 documentation](https://docs.meshy.ai/api/v2.md): Generate and process 3D models, textures, animations, and images from your own code with Meshy API v2. - [Quickstart](https://docs.meshy.ai/api/v2/quick-start.md): 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. - [Models](https://docs.meshy.ai/api/v2/models.md): Compare Meshy's geometry and texture models on the same input, and choose a pair for your project. - [Tasks](https://docs.meshy.ai/api/v2/tasks.md): 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. - [Errors](https://docs.meshy.ai/api/v2/errors.md): 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`. - [Rate limits](https://docs.meshy.ai/api/v2/rate-limits.md): Check how many requests and tasks your plan allows, and use the error `code` to tell which limit you reached. - [Asset retention](https://docs.meshy.ai/api/v2/asset-retention.md): 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. - [Webhooks](https://docs.meshy.ai/api/v2/webhooks.md): Get a `POST` request from Meshy when one of your API tasks makes progress or finishes, instead of polling for it. - [Metadata](https://docs.meshy.ai/api/v2/metadata.md): 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. ## 3D Generation - [Text to 3D API](https://docs.meshy.ai/api/v2/text-to-3d.md): Turn a text prompt into a 3D model in one call. - [Image to 3D API](https://docs.meshy.ai/api/v2/image-to-3d.md): Turn one image into a 3D model, textured or untextured, in the formats you choose. - [Multi-Image to 3D API](https://docs.meshy.ai/api/v2/multi-image-to-3d.md): Turn one to four images of the same object, from different angles, into one 3D model. ## Post-Processing - [Remesh API](https://docs.meshy.ai/api/v2/remesh.md): 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. - [Convert API](https://docs.meshy.ai/api/v2/convert.md): Convert a 3D model to other file formats, from a Meshy task or from your own model file. - [Resize API](https://docs.meshy.ai/api/v2/resize.md): Scale a 3D model to a real-world size, in meters, and set where its origin goes. - [UV Unwrap API](https://docs.meshy.ai/api/v2/uv-unwrap.md): Generate a fresh UV layout for a 3D model, ready to texture. - [Retexture API](https://docs.meshy.ai/api/v2/retexture.md): Generate new textures for an existing 3D model from a text prompt or a reference image. - [Rigging API](https://docs.meshy.ai/api/v2/rigging.md): 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. - [Rigging Check API](https://docs.meshy.ai/api/v2/rigging-check.md): 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. - [Animation API](https://docs.meshy.ai/api/v2/animation.md): 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. - [Text to Motion API](https://docs.meshy.ai/api/v2/text-to-motion.md): Generate a character animation from a text prompt, then play it on any two-legged character you rigged with the Rigging API. ## 2D Generation - [Text to Image API](https://docs.meshy.ai/api/v2/text-to-image.md): 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. - [Image to Image API](https://docs.meshy.ai/api/v2/image-to-image.md): 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. ## 3D Printing - [Multi-Color Print API](https://docs.meshy.ai/api/v2/multi-color-print.md): 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. - [Analyze Printability API](https://docs.meshy.ai/api/v2/analyze-printability.md): 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. - [Repair Printability API](https://docs.meshy.ai/api/v2/repair-printability.md): Repair a 3D model for printing. Meshy closes holes, fixes broken geometry, and thickens walls too thin for your printer. - [Auto Split API](https://docs.meshy.ai/api/v2/auto-split.md): 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. - [Relief API](https://docs.meshy.ai/api/v2/relief.md): Turn one photo into a bas-relief 3D model and a 16-bit depth map, for 3D printing, laser engraving, and CNC carving. ## Account - [Balance API](https://docs.meshy.ai/api/v2/balance.md): Check how many credits you can spend, and how many of them expire at the next monthly refresh. - [Usage API](https://docs.meshy.ai/api/v2/usage.md): List your team's finished API tasks and the credits each one used, for billing exports and cost reports. ## Shared with v1 These pages apply to both API versions. - [Authentication](https://docs.meshy.ai/api/authentication.md): Create a Meshy account and an API key, then send the key with every request. - [Pricing](https://docs.meshy.ai/api/pricing.md): Check how many credits each Meshy API request costs. - [Deprecations](https://docs.meshy.ai/api/deprecations.md): See which Meshy AI models and API features are active, deprecated, or retired, and find retirement dates and recommended replacements. - [AI Integration](https://docs.meshy.ai/api/ai.md): Connect AI agents and coding assistants to Meshy, with the Meshy CLI or a Meshy MCP server for generating models, or with `llms.txt` and `llms-full.txt` for reading the docs. - [Meshy CLI](https://docs.meshy.ai/api/cli.md): Generate, track, and download Meshy models from your terminal. One command turns a prompt or an image into a textured model, and most API endpoints are commands of their own. - [Remote MCP Server](https://docs.meshy.ai/api/remote-mcp.md): Connect an AI app to Meshy without installing anything. Add the server URL to the app and sign in with your Meshy account, on any plan, and the app can generate, track, and download 3D models. The models appear in the Meshy web app, next to the ones you make there. - [Local MCP Server](https://docs.meshy.ai/api/local-mcp.md): Run Meshy's MCP server on your computer with your API key, so your AI app can generate, track, and download 3D models. - [Animation Library](https://docs.meshy.ai/api/animation-library.md): Every preset action you can apply to a rigged character, with its `action_id` for the Animation API. On v2 the catalog is also served as JSON by `GET https://api.meshy.ai/openapi/v2/animations/library`.