> **Reading as an AI agent?** This is the Markdown version of https://docs.meshy.ai/api/v2/relief, part of the Meshy API v2 docs.
>
> - v2 docs index: https://docs.meshy.ai/api/v2/llms.txt
> - All v2 pages in one file: https://docs.meshy.ai/api/v2/llms-full.txt
> - OpenAPI spec for v2: https://docs.meshy.ai/api/v2/openapi.yaml

---

# 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=***"
  }
}
```
