Text to 3D API

Text to 3D API is a feature that allows you to integrate Meshy's Text to 3D capabilities into your own application. In this section, you'll find all the information you need to get started with this API.

The workflow of Text to 3D involves two stages: the preview stage and the refine stage. In the preview stage, a base mesh is generated with no texture applied, allowing you to evaluate the geometry. In the refine stage, the preview mesh is textured based on the text prompt.


POST/openapi/v2/text-to-3d

Create a Text to 3D Preview Task

This endpoint allows you to create a new Text to 3D Preview task. Refer to The Text to 3D Task Object to see which properties are included with Text to 3D task object.

Parameters

Required attributes

  • Name
    mode
    Type
    string
    Description

    This field should be set to "preview" when creating a preview task.

  • Name
    prompt
    Type
    string
    Description

    Describe what kind of object the 3D model is.

Optional attributes

  • Name
    art_style
    Type
    string
    Description

    Describe your desired art style of the object.

    Available values:

    • realistic: Realistic style
    • sculpture: Sculpture style

    Default to realistic if not specified.

  • Name
    seed
    Type
    integer
    Description

    When you use the same prompt and seed, you will generate the same result.

  • Name
    ai_model
    Type
    string
    Description

    ID of the model to use.

    Available values:

    • meshy-4

    Default to meshy-4 if not specified.

  • Name
    topology
    Type
    string
    Description

    Specify the topology of the generated model.

    Available values:

    • quad: Generate a quad-dominant mesh.
    • triangle: Generate a decimated triangle mesh.

    Default to triangle if not specified.

  • Name
    target_polycount
    Type
    integer
    Description

    Specify the target number of polygons in the generated model. The actual number of polygons may deviate from the target depending on the complexity of the geometry.

    The valid value range varies depending on the user tier:

    • Premium users: 100 to 300,000 (inclusive)
    • Free users: 10,000 to 30,000 (inclusive)

    Default to 30,000 if not specified.

  • Name
    should_remesh
    Type
    boolean
    Description

    The should_remesh flag controls whether to enable the remesh phase.

    When set to false, it directly returns an unprocessed triangular mesh, ignoring topology and target_polycount.

    Default to true if not specified.

Returns

The result property of the response contains the task id of the newly created Text to 3D task.

Request

POST
/openapi/v2/text-to-3d
curl https://api.meshy.ai/openapi/v2/text-to-3d \
  -H 'Authorization: Bearer ${YOUR_API_KEY}' \
  -H 'Content-Type: application/json' \
  -d '{
  "mode": "preview",
  "prompt": "a monster mask",
  "art_style": "realistic",
  "should_remesh": true
}'

Response

{
  "result": "018a210d-8ba4-705c-b111-1f1776f7f578"
}

POST/openapi/v2/text-to-3d

Create a Text to 3D Refine Task

This endpoint allows you to create a new Text to 3D Refine task.

Parameters

Required attributes

  • Name
    mode
    Type
    string
    Description

    This field should be set to "refine" when creating a preview task.

  • Name
    preview_task_id
    Type
    string
    Description

    The corresponding preview task id.

    The status of the given preview task must be SUCCEEDED.

Optional attributes

  • Name
    enable_pbr
    Type
    boolean
    Description

    Generate PBR Maps (metallic, roughness, normal) in addition to the base color.

    Default to false if not specified.

Returns

The result property of the response contains the task id of the newly created Text to 3D task.

Request

POST
/openapi/v2/text-to-3d
curl https://api.meshy.ai/openapi/v2/text-to-3d \
  -H 'Authorization: Bearer ${YOUR_API_KEY}' \
  -H 'Content-Type: application/json' \
  -d '{
  "mode": "refine",
  "preview_task_id": "018a210d-8ba4-705c-b111-1f1776f7f578"
  "enable_pbr": true,
}'

Response

{
  "result": "018a210d-8ba4-705c-b111-1f1776f7f578"
}

GET/openapi/v2/text-to-3d/:id

Retrieve a Text to 3D Task

This endpoint allows you to retrieve a Text to 3D task given a valid task id. Refer to The Text to 3D Task Object to see which properties are included with Text to 3D task object.

This endpoint works for both preview and refine tasks.

Parameters

  • Name
    id
    Type
    path
    Description

    Unique identifier for the Text to 3D task to retrieve.

Returns

The response contains the Text to 3D task object. Check The Text to 3D Task Object section for details.

Examples

ModeSample Model
PreviewPreview model
RefineRefined model

Request

GET
/openapi/v2/text-to-3d/018a210d-8ba4-705c-b111-1f1776f7f578
curl https://api.meshy.ai/openapi/v2/text-to-3d/018a210d-8ba4-705c-b111-1f1776f7f578 \
-H "Authorization: Bearer ${YOUR_API_KEY}"

Response

{
  "id": "018a210d-8ba4-705c-b111-1f1776f7f578",
  "model_urls": {
    "glb": "https://assets.meshy.ai/***/tasks/018a210d-8ba4-705c-b111-1f1776f7f578/output/model.glb?Expires=***",
    "fbx": "https://assets.meshy.ai/***/tasks/018a210d-8ba4-705c-b111-1f1776f7f578/output/model.fbx?Expires=***",
    "obj": "https://assets.meshy.ai/***/tasks/018a210d-8ba4-705c-b111-1f1776f7f578/output/model.obj?Expires=***",
    "mtl": "https://assets.meshy.ai/***/tasks/018a210d-8ba4-705c-b111-1f1776f7f578/output/model.mtl?Expires=***",
    "usdz": "https://assets.meshy.ai/***/tasks/018a210d-8ba4-705c-b111-1f1776f7f578/output/model.usdz?Expires=***"
  },
  "thumbnail_url": "https://assets.meshy.ai/***/tasks/018a210d-8ba4-705c-b111-1f1776f7f578/output/preview.png?Expires=***",
  "prompt": "a monster mask",
  "art_style": "realistic",
  "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=***"
    }
  ],
  "preceding_tasks": 0,
  "task_error": {
    "message": ""
  }
}

The Text to 3D Task Object

The Text to 3D Task object is a work unit that Meshy keeps track of to generate a 3D model from a text input. There are two stages of the Text to 3D API, preview and refine. Preview stage is for generating a mesh-only 3D model, and refine stage is for generating a textured 3D model based on the preview stage's result.

The object has the following properties:

Properties

  • Name
    id
    Type
    string
    Description

    Unique identifier for the task. While we use a k-sortable UUID for task ids as the implementation detail, you should not make any assumptions about the format of the id.

  • Name
    model_urls
    Type
    object
    Description

    Downloadable URL to the textured 3D model file generated by Meshy. The property for a format will be omitted if the format is not generated instead of returning an empty string.

    • Name
      glb
      Type
      string
      Description

      Downloadable URL to the GLB file.

    • Name
      fbx
      Type
      string
      Description

      Downloadable URL to the FBX file.

    • Name
      usdz
      Type
      string
      Description

      Downloadable URL to the USDZ file.

    • Name
      obj
      Type
      string
      Description

      Downloadable URL to the OBJ file.

    • Name
      mtl
      Type
      string
      Description

      Downloadable URL to the MTL file.

  • Name
    prompt
    Type
    string
    Description

    This is unmodified prompt that was used to create the task.

  • Name
    art_style
    Type
    string
    Description

    This is unmodified art_style that was used to create the preview task.

  • Name
    thumbnail_url
    Type
    string
    Description

    Downloadable URL to the thumbnail image of the model file.

  • Name
    video_url
    Type
    string
    Description

    Downloadable URL to the preview video.

  • Name
    progress
    Type
    integer
    Description

    Progress of the task. If the task is not started yet, this property will be 0. Once the task has succeeded, this will become 100.

  • Name
    seed
    Type
    integer
    Description

    Seed of the task.

  • Name
    started_at
    Type
    timestamp
    Description

    Timestamp of when the task was started, in miliseconds. If the task is not started yet, this property will be 0.

  • Name
    created_at
    Type
    timestamp
    Description

    Timestamp of when the task was created, in miliseconds.

  • Name
    finished_at
    Type
    timestamp
    Description

    Timestamp of when the task was finished, in miliseconds. If the task is not finished yet, this property will be 0.

  • Name
    status
    Type
    string
    Description

    Status of the task. Possible values are one of PENDING, IN_PROGRESS, SUCCEEDED, FAILED, EXPIRED.

  • Name
    texture_urls
    Type
    array
    Description

    An array of texture URL objects that are generated from the task. Normally this only contains one texture URL object. Each texture URL has the following properties:

    • Name
      base_color
      Type
      string
      Description

      Downloadable URL to the base color map image.

    • Name
      metallic
      Type
      string
      Description

      Downloadable URL to the metallic map image.

    • Name
      normal
      Type
      string
      Description

      Downloadable URL to the normal map image.

    • Name
      roughness
      Type
      string
      Description

      Downloadable URL to the roughness map image.

  • Name
    preceding_tasks
    Type
    integer
    Description

    The count of preceding tasks.

  • Name
    task_error
    Type
    object
    Description

    Error object that contains the error message if the task failed. The message property should be empty if the task succeeded.

    • Name
      message
      Type
      string
      Description

      Detailed error message.

Example Text to 3D Task Object

{
  "id": "018a210d-8ba4-705c-b111-1f1776f7f578",
  "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=***"
  },
  "prompt": "a monster mask",
  "art_style": "realistic",
  "texture_richness": "high",
  "thumbnail_url": "https://assets.meshy.ai/***/tasks/018a210d-8ba4-705c-b111-1f1776f7f578/output/preview.png?Expires=***",
  "video_url": "https://assets.meshy.ai/***/tasks/018a210d-8ba4-705c-b111-1f1776f7f578/output/preview.mp4?Expires=***",
  "progress": 1,
  "seed": 1234,
  "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_roughness.png?Expires=XXX",
      "roughness": "https://assets.meshy.ai/***/tasks/018a210d-8ba4-705c-b111-1f1776f7f578/output/texture_0_normal.png?Expires=XXX"
    }
  ],
  "preceding_tasks": 0,
  "task_error": {
    "message": ""
  }
}