TokenLab

Video & Materials

Get Video Status

Get a video task's status and result

GET
/v1/tasks/{id}

Path Parameters

idstringpathrequired

The task ID returned by the create video request. id and task_id identify the same task.

If the create response includes poll_url, call that URL directly.

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.

Response

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

idstring

Task ID.

task_idstring

Same task ID as id.

poll_urlstring

URL for checking status and retrieving the result.

billing_transaction_idstring

Billing transaction ID after settlement. It is separate from the task ID.

statusstring

Task status: pending, processing, completed, failed.

progressnumber

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

video_urlstring

URL of the generated video (when completed). If it points to the TokenLab API, download it with the same Authorization: Bearer header used for task polling. Only the organization that owns the task can access the result.

videoobject

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

videosarray

Multiple video results when the task returns more than one output.

errorstring | object

Error message (if failed).

createdinteger

Creation timestamp.

updatedinteger

Last update timestamp.

modelstring

Model used for the task.

Request

curl "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": "pending",
  "model": "veo3.1",
  "created": 1706000000,
  "updated": 1706000000
}

Check Interval

  • Check every 5–10 seconds.
  • Increase the interval for long-running tasks.
  • Set a maximum wait time for your application.
  • Stop when the status is failed and show the returned error.
import requests
import time

def wait_for_video(task_id, max_wait=600, interval=5):
    """Wait for video with timeout."""
    start = time.time()

    while time.time() - start < max_wait:
        response = requests.get(
            f"https://api.tokenlab.sh/v1/tasks/{task_id}",
            headers={"Authorization": "Bearer sk-your-api-key"}
        )
        response.raise_for_status()
        data = response.json()

        if data["status"] == "completed":
            return data["video_url"]
        elif data["status"] == "failed":
            raise Exception(data.get("error", "Video generation failed"))

        time.sleep(interval)

    raise TimeoutError("Video generation timed out")

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