Skip to main content
Many media endpoints are asynchronous. A create request starts work and returns a public TokenLab task identity; your application polls until that task reaches a terminal status. Do not build customer workflows around upstream task URLs, routing IDs, or provider callback behavior.

Public Task Contract

Create responses can include: /v1/tasks/{id} is the canonical fixed status endpoint for public async media jobs. Media-specific status routes may exist for compatibility, but new integrations should prefer poll_url or /v1/tasks/{id}.
  1. Validate the user request and send the create call with an explicit model.
  2. Persist id / task_id, poll_url, endpoint, model, user ID, and your own job ID before returning control to the UI.
  3. Poll every 5-10s for long-running media tasks.
  4. Stop only when the task is completed or failed.
  5. On completed, read the media-specific result fields and store final URLs or metadata.
  6. On failed, store the public error and offer retry only as a new user-visible job.

Polling Example

Expected public statuses are pending, processing, completed, and failed. Cancelled tasks are represented as failed with cancelled: true and cancellation_status: "cancelled" so older status handling keeps working.

Client Retry Rules

Network timeouts are the most common source of duplicate jobs. Use this rule: Do not send a second create request just because the browser refreshed or a status poll failed.

Billing And Settlement

Async jobs can reserve an estimated amount when the create request is accepted. Final settlement happens after terminal status. When available, task status responses can expose billing_transaction_id and the X-Billing-Transaction-ID header. For reconciliation, join these identifiers in your logs:
  • request_id from the create request.
  • task_id / id from the task.
  • billing_transaction_id when present.
  • Your own user ID, project ID, or job ID.

Cancellation

DELETE /v1/tasks/{id} is intentionally narrow. It currently supports queued Seedance video tasks such as seedance-1.5-pro, seedance-2.0, and seedance-2.0-fast when cancellation is available for the selected task. Unsupported tasks return 400 unsupported_task_cancel. Tasks that are already running or terminal return 409 task_not_cancellable. Build cancellation UI as “request cancellation” rather than a guaranteed stop button.

Troubleshooting

Support Packet

When contacting support, include request_id, task_id, billing_transaction_id when present, endpoint, model, timestamp, and a sanitized request shape. Do not include API keys, private media, signed URLs, or full prompts unless support asks for a redacted sample.

API Reference