Video & Materials
Get Video Status
Get a video task's status and result
Path Parameters
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.
Task ID.
Same task ID as id.
URL for checking status and retrieving the result.
Billing transaction ID after settlement. It is separate from the task ID.
Task status: pending, processing, completed, failed.
Optional progress value. Returned only when a real progress value is available; use status to determine completion.
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.
Single video result with url, duration, width, and height when available.
Multiple video results when the task returns more than one output.
Error message (if failed).
Creation timestamp.
Last update timestamp.
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
failedand show the returnederror.
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 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