TokenLab

Async Jobs

Get Task Status

Retrieve the status and result of any async task using the poll_url returned by create endpoints

GET
/v1/tasks/{id}

Overview

Use this endpoint for unified async polling across task types such as video, image, music, and 3D generation.

If a create response includes poll_url, call that exact path. Some image models may return task-based responses under either an image-specific status path or /v1/tasks/{id}.

Path Parameters

idstringpathrequired

The task ID returned by the create request.

Response

Fields describing results, errors, timestamps, and the model are returned when available for the task.

idstring

Canonical async task identifier.

task_idstring

Async task identifier alias.

poll_urlstring

Preferred polling URL when the create response supplies one.

statusstring

Task status such as pending, processing, completed, or failed. Cancelled tasks are represented as failed with cancelled: true.

cancelledboolean

true when a queued async task was cancelled before execution.

cancellation_statusstring

Cancellation marker. Present as cancelled when cancellation succeeds.

dataarray

For completed image tasks, generated image results are returned here. Image tasks return URLs in data[].url.

progressnumber

Optional progress value. Returned only when a real progress value is available; use status to determine completion.

video_urlstring

Result asset URL when the task completes and produces a video.

videoobject

Single video payload with url, duration, width, and height when available.

videosarray

Multiple video payloads when more than one output is available.

errorstring | object

Error message when the task fails.

createdinteger

Creation timestamp when available.

updatedinteger

Last update timestamp when available.

modelstring

Model used by the task when available.

Error Behavior

An expired or unavailable public task can return 404 async_task_not_found. If task ownership cannot be established for the current API key, the response is 403 task_not_owned.

{
  "error": {
    "message": "Task not found or no longer available.",
    "type": "invalid_request_error",
    "code": "async_task_not_found"
  }
}

Examples

Request

cURL
curl "https://api.tokenlab.sh/v1/tasks/ldtask_aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" \
  -H "Authorization: Bearer sk-your-api-key"
Python
import requests

poll_url = "/v1/tasks/ldtask_aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
response = requests.get(
    f"https://api.tokenlab.sh{poll_url}",
    headers={"Authorization": "Bearer sk-your-api-key"},
)
print(response.json())
JavaScript
const pollUrl = '/v1/tasks/ldtask_aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa';
const response = await fetch(`https://api.tokenlab.sh${pollUrl}`, {
  headers: { Authorization: 'Bearer sk-your-api-key' },
});
console.log(await response.json());
{  "id": "string",  "status": "pending",  "progress": 0,  "created": 0,  "updated": 0,  "model": "string",  "video": {    "url": "string",    "duration": 0,    "width": 0,    "height": 0  },  "error": "string",  "error_details": {    "projection_version": 0,    "status": 400,    "message": "string",    "type": "string",    "code": "string",    "param": "string",    "retryable": true,    "upstream": {      "source": "string",      "code": "string",      "message": "string",      "param": "string"    }  },  "task_id": "string",  "poll_url": "string",  "cancelled": true,  "cancellation_status": "cancelled",  "billing_transaction_id": "string",  "video_url": "string",  "videos": [    {}  ],  "data": [    {}  ],  "audio_url": "string",  "title": "string",  "lyrics": "string",  "model_url": "string",  "glb_url": "string",  "fbx_url": "string"}

Authorization

BearerAuth
AuthorizationBearer <token>

API Key authentication. Create or manage API keys in Dashboard > API > API Keys.

In: header

Path Parameters

id*string

The async task ID returned by id / task_id, or embedded in poll_url

Response

application/json

application/json

application/json

application/json