Relief
Generate a grayscale depth PNG from RGB, a relief model from a depth image, or a relief model directly from RGB. Choose whether the model has texture and which format to download.
The API base URL is https://api.triverse.ai/api/v1.
Choose an Operation and Quote Credits
| Goal | operation | with_texture | Images | Default result | Credits |
|---|---|---|---|---|---|
| RGB to depth | rgb-to-depth | false | RGB | Grayscale PNG | 5 |
| Depth to relief | depth-to-relief | false | Depth | STL | 10 |
| Textured depth to relief | depth-to-relief | true | Depth and a separate RGB reference | Textured 3MF | 15 |
| RGB to relief | rgb-to-relief | false | RGB | STL | 15 |
| Textured RGB to relief | rgb-to-relief | true | RGB, also used for texture | Textured 3MF | 20 |
Use the live pricing quote before creation. For textured depth-to-relief, send {"flow_name":"depth-to-relief","params":{"with_texture":true}}.
output_format does not affect generation credits. The creation response reports the accepted cost_credits.
Prepare Images
Each input must be a complete, decodable static PNG, JPEG or WebP, no larger than 20 MiB (20,971,520 bytes) and 40,000,000 pixels, and pass content review. Use the original grayscale PNG from RGB-to-depth as a depth input when available. Align a separate RGB reference with the depth image's composition, direction and subject.
Each input can be either of the following; a two-image request can mix the forms:
- A publicly readable HTTP(S) image URL using port 80 or 443. Retrieval must work without cookies, login or extra headers. Keep signed URLs valid through queueing and execution. Each new execution reads the URL's actual contents at that time; keep a stable copy in your own storage when needed.
- The exact
data.file_keyfrom image upload. Upload with multipart fieldfile, then use the returned key asimage_fileortexture_image_file. The upload API also accepts AVIF and files up to 50 MiB, and allows 10 uploads per 60 seconds, shared with model uploads. This endpoint still accepts only a static PNG, JPEG, or WebP within the limits above. A file outside those limits can upload and then be rejected when the task is created. An upload over the rate limit returns HTTP 429 /2000.
Create a Task
Endpoint
POST /tasks/relief
Authentication
Required (Bearer Token)
Request Parameters
Content-Type: application/json.
| Field | Type | Required | Description |
|---|---|---|---|
client_order_id | string | yes | Stable ID for one intent: 1–64 characters matching ^[A-Za-z0-9_-]+$. Retain it when recovering the same request. |
operation | string | yes | rgb-to-depth, depth-to-relief, or rgb-to-relief. |
image_file | string | yes | Main RGB or depth URL or uploaded file_key; nonblank, at most 8192 characters. |
with_texture | boolean | no | JSON boolean. Omit the key for the default false. null and the strings "true" and "false" are rejected. rgb-to-depth accepts only omit or false. Textured depth-to-relief needs a separate RGB reference. Textured RGB-to-relief uses its main image. |
texture_image_file | string | conditional | Required and non-blank for textured depth-to-relief. Omit the key for every other combination. Sending it when it is not allowed is rejected. URL or uploaded key, at most 8192 characters. |
output_format | string or null | no | Model operations only: lowercase glb, fbx, fbxz, obj, usd, usdz, stl, or 3mf. Omit the key, or send JSON null, for stl without texture and 3mf with texture. Texture plus stl is rejected. rgb-to-depth rejects the key, including JSON null. |
name | string or null | no | Display name, at most 255 characters. This is the task title. It is not the name of the downloaded file. |
is_public | boolean or null | no | Whether the result is public. When omitted, the account plan default is used. |
license | string or null | no | cc-by-4.0 or proprietary. When omitted, it is determined from the plan and the public setting. |
Results generated on the Free plan are public and use the cc-by-4.0 license. Paid plans default to private results with the proprietary license. When a result is set to public, the license is always cc-by-4.0.
Unknown fields are rejected. Choosing 3mf does not enable texture; set with_texture for a textured model. RGB-to-depth always delivers PNG. Without texture, omitting output_format, JSON null, and explicit stl are the same request. With texture, omitting it, JSON null, and explicit 3mf are the same request. Explicit 3mf without texture is not the plain STL default. Texture plus stl is rejected before a task is created. The format does not change the generation quote.
Optional Crop, Relief and Print Parameters
All 16 fields are optional and are accepted only on POST /tasks/relief. The original POST /tasks/rgb-to-depth route rejects them as unknown fields.
For depth-to-relief and rgb-to-relief, omit a field or send JSON null to keep the default in the table. For rgb-to-depth, only the four crop fields and contrast, brightness, and sharpen may carry a value. The other nine fields must be omitted or JSON null. A concrete value is rejected even when it equals the default, including smoothness 0 and background_cutout false.
| Field | JSON type and range | Default for the model operations |
|---|---|---|
crop_x, crop_y | Nonnegative integers, measured from the input's upper-left corner in pixels. | No crop. |
crop_width, crop_height | Integers, each at least 32 pixels. Supply all four crop fields together. | No crop. |
contrast, brightness, sharpen | Numbers from -1 to 1. Negative sharpen values blur the heightmap. | Each is 0. |
smoothness | Number from 0 to 4. | 0. |
model_resolution | draft, standard, high, ultra: 192, 320, 512, 768 cells per side. | standard. |
relief_depth | Number from 0.2 to 3; 1 corresponds to 5 mm of relief height. | 1. |
board_thickness | Number from 0.2 to 3; 0.8 corresponds to an 8 mm board. | 0.8. |
background_cutout | Boolean. Removes near-black background connected to the outer border, preserving interior dark regions. Actual board thickness becomes 0, even if board_thickness was supplied. | false. |
depth_compression | Boolean. Raises normalized height to the power of 1.65. | false. |
target_height | Positive finite number or numeric string, such as 20 or "20"; booleans are rejected. | Retain the original model size. |
target_unit | mm, cm, m, in, or ft. | Omit together with target_height. |
origin_type | center scales around the world origin; bottom scales and moves the lowest point to world Z=0. | center when scaling; otherwise retain the original position. |
The two model operations accept all 16 fields. Crop coordinates are strict JSON integers. contrast, brightness, and sharpen are JSON numbers, so 0 and 0.0 are both valid. Algorithm switches require JSON booleans.
The crop rectangle must lie inside the image. That check runs during execution, not when the task is created. An out-of-bounds crop is accepted, credits are frozen, and the task can then finish as FAILED. The public task error is often data.error.code 5005 and may not say that the crop was out of bounds. The freeze is released when the task fails. RGB cropping happens before depth inference. Textured RGB-to-relief uses the cropped RGB image. Textured depth-to-relief aligns both images to the same crop proportionally, including when their pixel resolutions differ.
For printing, trim whitespace around height, unit and origin values; blank strings mean omitted, and unit/origin names are case-insensitive. After normalization, height and unit must be supplied together. A valid origin_type can be supplied alone, but it has no effect without a target height. Target height means the entire model's world-Z bounding-box height: all three axes are scaled uniformly. It is distinct from algorithm relief height, board thickness and planar dimensions. Printing parameters and crop/relief choices do not change the generation quote.
A GLB without a target size is delivered directly. A GLB with a target size goes through GLB-to-GLB conversion; other formats use their existing conversion with the optional print settings. Download returns that final file, with no second generation charge.
{
"client_order_id": "relief-print-001",
"operation": "rgb-to-relief",
"image_file": "https://images.example.com/rgb.png",
"with_texture": false,
"output_format": "glb",
"crop_x": 10,
"crop_y": 20,
"crop_width": 512,
"crop_height": 512,
"contrast": 0.2,
"model_resolution": "high",
"relief_depth": 1.2,
"target_height": "20",
"target_unit": "mm",
"origin_type": "bottom"
}Example: Default STL from a Depth Image
curl --fail-with-body -sS 'https://api.triverse.ai/api/v1/tasks/relief' \
-H 'Authorization: Bearer YOUR_API_KEY' \
-H 'Content-Type: application/json' \
--data '{"client_order_id":"relief-depth-001","operation":"depth-to-relief","image_file":"https://images.example.com/depth.png","with_texture":false}'Example: Textured OBJ Package
{
"client_order_id": "relief-depth-obj-001",
"operation": "depth-to-relief",
"image_file": "YOUR_UPLOADED_DEPTH_FILE_KEY",
"with_texture": true,
"texture_image_file": "https://images.example.com/rgb.jpg",
"output_format": "obj"
}For RGB-to-relief, set "operation":"rgb-to-relief", supply the RGB image as image_file, and choose texture and format. The main RGB image also supplies texture.
Response
HTTP 200 with code 0 means the task was accepted. During maintenance, HTTP 200 with code 2021 also means the task was accepted; generation continues after maintenance. Both responses include data.task_uuid. Any other non-zero code means the task was not accepted. A client that accepts only code 0 drops a task that was accepted during maintenance.
| Field | Description |
|---|---|
code | 0 for normal acceptance. 2021 for acceptance during maintenance. |
data.task_uuid | Task ID to retain for status and download. |
data.flow_name | Accepted task type. |
data.status | Current status. Acceptance does not mean generation has finished. |
data.created_at | Creation time. |
data.cost_credits | Accepted generation cost. Credits are frozen on acceptance, settled on success, and released on failure. |
data.queue | Queue information, when available. |
data.read_after_write_header | Present with code 2021. The header name to send on the following status read. The current value is X-Triverse-Read-Your-Writes. |
data.read_after_write_deadline_seconds | Present with the header name. During this many seconds, send that header with the value 1. |
Query Status and Download
Query task status using GET /tasks/{task_uuid}. While data.status is PENDING, QUEUED or RUNNING, wait about 3 to 5 seconds and query again. When the create response includes read_after_write_header and read_after_write_deadline_seconds, send that header with the value 1 until the deadline passes. Stop at SUCCESS, FAILED or CANCELLED. A top-level 5003, HTTP 5xx or network timeout leaves task status unknown: back off and query the original task. A query failure is not a task failure. For HTTP 429, respect Retry-After. A local timeout does not cancel the server task. Keep the task ID when your local wait limit expires.
There is no public list of depth-to-relief or rgb-to-relief tasks. Heightmap tasks, including those created here with operation rgb-to-depth, appear in GET /tasks/rgb-to-depth. That history list does not refresh a running task.
At SUCCESS, data.output.assets identifies the final asset and business format. Get a fresh URL from download assets, GET /tasks/url/{task_uuid}. Read data.download_url and download it with a separate GET; do not forward the API key to the file host.
Single files open directly. When texture is enabled, the texture is inside that file. Do not unpack .3mf or .usdz; they are delivered as one model file.
output_format | Download | What the file contains |
|---|---|---|
glb | .glb | Geometry. With texture, the image is inside this file. |
stl | .stl | Geometry only. Texture is not allowed. |
3mf | .3mf | Geometry. With texture, the image is inside this file. |
fbx | .fbx | Geometry. With texture, the image is embedded in this FBX. |
usdz | .usdz | Geometry. With texture, the image is inside this file. |
fbxz, obj, and usd download as ZIP archives. Those formats store the model, material, and texture as separate files. Saving only the model breaks the relative references, so the ZIP adds the sidecar files. It does not add a second mesh. Keep the archive and its relative paths.
output_format | Download | Without texture | Extra files with texture |
|---|---|---|---|
fbxz | .fbxz.zip | One .fbx | A texture under texture/, referenced by the FBX. |
obj | .obj.zip | .obj and a .mtl material file | A texture beside the OBJ and MTL. The MTL points to it. |
usd | .usd.zip | One .usd | A texture under textures/, referenced by the USD. |
A plain fbxz or usd archive has no texture file; the ZIP only wraps the model. A plain obj archive adds the .mtl and no texture image. usdz is not this kind of ZIP.
For RGB-to-depth, save the original .png. The primary asset in data.output.assets uses asset_id, kind image, role primary, and format png, with width, height, and bit_depth of 8 or 16. availability is AVAILABLE when the file can be downloaded. Normalized height is gray_value / (2^bit_depth - 1). A successful model task returns the format selected by output_format on creation, including STL, 3MF, FBX, FBXZ, OBJ, USD, and USDZ. That conversion is included in this generation and its quote. Download this relief task to receive that file. preview_url stays empty when no preview image exists; do not copy the model URL into a preview field. Download response kind can also be null. Use the successful status, final format, and download URL.
If a file URL expires, request another URL for the same task. Status reads, re-signing and repeated download do not create another generation or charge generation credits again. Save important files to your own storage according to your retention needs. An accepted order keeps its effective format: the same client_order_id with a different effective format conflicts and does not change the result. To convert an existing model to another supported format, create a separate format conversion task and use that task's quote. That conversion does not alter the accepted relief order.
Recover Requests and Handle Errors
The same client_order_id and the same effective request recover the same task. The effective request is the full accepted body. Changing the operation, either image, texture, crop, relief shape, print size, display name, visibility, license, or effective format conflicts with the accepted order and does not change it. Use a new order ID for a changed intent.
Without texture, omitted, null, and explicit stl are one intent. With texture, omitted, null, and explicit 3mf are one intent. Explicit 3mf without texture is a different intent from the plain STL default. A failed task keeps its original ID. To generate again, submit a new ID. If the create call times out or returns HTTP 5xx before a task ID is returned, retry the original body and ID.
POST /tasks/relief with operation rgb-to-depth shares the original RGB request identity only when crop, contrast, brightness, and sharpen are all omitted. If any of those fields is set, the same client_order_id on POST /tasks/rgb-to-depth conflicts with this request.
| Response | Meaning | Next action |
|---|---|---|
HTTP 400 / code 1004 | Invalid parameters, an unknown field, or a conflicting order. | Check the message, image and texture combination, lowercase format, null handling, and the original request. Correct an unaccepted request. Use a new ID for a changed intent. |
HTTP 400 / code 2008 | Content review rejected an image. | Use a different image. suggestion may include the review reason. |
HTTP 401 / code 1001 | The API key is invalid. | Check the key and the Authorization header. |
HTTP 403 / code 1005 | The key cannot access this resource, or the account is not allowed to create the task. | Check the key permission and the account from the response. |
HTTP 403 / code 2010 | Not enough available credits. The task was not created. | Add credits, then submit with a new client_order_id. |
HTTP 404 / code 1006 | The specified task was not found. | Check the task ID, account, and request URL. |
HTTP 429 / code 2000 | The number of concurrent generation tasks has reached the plan limit. | Wait for existing tasks to finish. If Retry-After is present, wait that long. Retry the same create body and client_order_id when no task ID was returned. |
HTTP 200 / code 2021 | The task was accepted during maintenance and is waiting for processing to resume. | Save data.task_uuid and keep querying. This is not a failure. |
Top-level 5003 or HTTP 503 | The service is temporarily unavailable, and this request did not get a normal result. | Retry a query with backoff. Retry a create request with the original ID and body. |
Task FAILED, including data.error.code 5005 | Processing failed and no file was delivered. 5005 is the generic processing-failure code. | Read data.error and keep the task ID. Credits frozen for the task are released. |
Download HTTP 409 / code 2005 | The result is not downloadable yet. | Query task status and retry after success. A finished relief task of any selected format should return its file. |
Download HTTP 404 / code 4042 | This task has no downloadable file. | Check status and retention, and keep the task ID. |
The original POST /tasks/rgb-to-depth remains available for heightmap generation. It shares this route's RGB request identity only in the case described above.