Documentation IndexFetch the complete documentation index at: /llms.txtUse this file to discover all available pages before exploring further.
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
Poll the status and results of an async generation task
POST /api/v1/task/{id}
status
"completed"
results
id
{}
{ "code": 0, "message": "ok", "request_id": "req-1710000000000", "data": { "id": "64f3a1b2c8d9e0f1a2b3c4d5", "status": "processing", "created_at": 1710000000000 } }
{ "code": 0, "message": "ok", "request_id": "req-1710000000001", "data": { "id": "64f3a1b2c8d9e0f1a2b3c4d5", "status": "completed", "created_at": 1710000000000, "results": [ { "id": "clip-abc123", "audio_url": "https://cdn.example.com/tob/gen/abc123.mp3", "image_url": "https://cdn.example.com/tob/gen/abc123.jpg", "title": "My Track", "duration": 87.4, "tags": "pop upbeat", "prompt": "An upbeat pop track", "expire_at": 1710604800000 } ] } }
{ "code": 0, "message": "ok", "request_id": "req-1710000000002", "data": { "id": "64f3a1b2c8d9e0f1a2b3c4d5", "status": "failed", "created_at": 1710000000000, "error": "Generation failed: all platforms unavailable" } }
queuing
processing
completed
failed
error
created_at
status = "completed"
status = "failed"
audio_url
image_url
title
duration
tags
prompt
expire_at
import time, requests def wait_for_task(task_id, api_key, timeout=300): url = f"https://api.example.com/api/v1/task/{task_id}" headers = {"Authorization": f"Bearer {api_key}", "Content-Type": "application/json"} deadline = time.time() + timeout while time.time() < deadline: resp = requests.post(url, json={}, headers=headers).json() status = resp["data"]["status"] if status == "completed": return resp["data"]["results"] if status == "failed": raise Exception(resp["data"].get("error", "Task failed")) time.sleep(5) raise TimeoutError("Task did not complete in time")
curl -X POST https://api.example.com/api/v1/task/64f3a1b2c8d9e0f1a2b3c4d5 \ -H "Authorization: Bearer sk-mm-your-key" \ -H "Content-Type: application/json" \ -d '{}'