Async Jobs
Cancel Task
Cancel a queued async task when its model supports cancellation
Overview
Use DELETE /v1/tasks/{id} to cancel an asynchronous task that has not started running yet. Use the same task ID from the create response or the returned poll_url.
Supported Tasks
Cancellation is available for queued Seedance tasks using seedance-2.0, seedance-2.0-fast, or seedance-2.5 when that task supports cancellation. A task already running or in a terminal state cannot be cancelled. A cancelled task is not charged. Status remains queryable while its public task record is retained.
To cancel a task created through the Volc-compatible Seedance endpoint, see Cancel Task (Volc Compatible).
Path Parameters
The async task ID returned by the create request or embedded in poll_url.
Response
Canonical async task identifier.
Async task identifier alias.
Status URL for the task. It remains valid after cancellation. Poll GET /v1/tasks/{id} with id.
Task status. A successfully cancelled task is returned as failed with cancelled: true for compatibility with existing status values.
true when the task was cancelled before execution.
Cancellation marker. The value is cancelled when cancellation succeeds.
Cancellation reason or task failure message.
Error Behavior
| HTTP | Code | Meaning |
|---|---|---|
400 | missing_task_id, invalid_task_id | The task ID is missing or not a valid task ID |
400 | unsupported_task_cancel | The task type or model does not support cancellation |
403 | task_not_owned | The task does not belong to the workspace of this API key |
404 | async_task_not_found | The task has expired or is not available |
409 | task_not_cancellable | The task is already processing, finished, or otherwise no longer cancellable. current_status gives its state |
503 | async_task_owner_unavailable | The task cannot be read right now. Retry |
Request
curl -X DELETE "https://api.tokenlab.sh/v1/tasks/ldtask_aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" \
-H "Authorization: Bearer sk-your-api-key"Response
{
"id": "ldtask_aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
"task_id": "ldtask_aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
"poll_url": "/v1/tasks/ldtask_aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
"status": "failed",
"cancelled": true,
"cancellation_status": "cancelled",
"error": "Task cancelled before execution"
}Authorization
BearerAuth API Key authentication. Create or manage API keys in Dashboard > API > API Keys.
In: header
Path Parameters
The async task ID returned by id / task_id, or embedded in poll_url
Response
application/json
application/json
application/json
application/json
application/json
application/json
application/json