Webhook
What is Webhook
Token360 can POST to your HTTPS endpoint when an asynchronous job reaches a terminal state, so you do not have to poll continuously.
| Video | callback_url on POST /v1/videos | completed / failed |
| Batch jobs | callback_url on POST /v1/batches, or account default in console Batch jobs → Webhook | completed / failed / cancelled / expired |
| Async Chat | Not supported. Poll GET /v1/async/chat/completions/{job_id}. For many lines with a callback, use Batch Jobs. | — |
Use webhooks when your application needs to react in the background (update an order, persist output URLs, notify a user).
How to Enable Webhook
When calling POST /v1/videos, include two fields:
callback_url: your HTTPS endpoint that receives the POST callback.request_id: your business ID, such as an order ID. Token360 echoes this value in the callback envelope so you can match the callback to your local record.
1curl -X POST https://api.token360.ai/v1/videos \
2 -H "Authorization: Bearer sk-your-api-key" \
3 -H "Content-Type: application/json" \
4 -d '{
5 "model": "seedance-2.5",
6 "prompt": "A paper crane unfolds into a real bird and flies away.",
7 "resolution": "480p",
8 "duration": 5,
9 "aspect_ratio": "16:9",
10 "generate_audio": false,
11 "callback_url": "https://your-app.example.com/webhooks/video",
12 "request_id": "your-order-id-001"
13 }'If callback_url is omitted, no callback fires and you must poll GET /v1/videos/{video_id} yourself.
When the Callback Fires
- Token360 sends the callback once when the video task reaches a terminal state:
completedorfailed. - Intermediate states, such as
queuedandin_progress, do not trigger callbacks. - A given video task delivers at most one successful callback. If all delivery attempts fail, Token360 gives up.
Retry and Timeout
- Per-attempt timeout: 30 seconds.
- Maximum attempts: 3 total attempts, including the first delivery.
- Retry backoff intervals: 1 second before the second attempt, then 3 seconds before the third attempt.
- Any
2xxresponse stops retrying and marks delivery as successful. - After following redirects, any final non-
2xxresponse triggers a retry. A redirect chain that resolves to2xxis treated as successful. - After 3 failed attempts, Token360 gives up and does not redeliver. Use
GET /v1/videos/{video_id}to recover the final state if needed.
Idempotency
- A given video task
iddelivers at most one successful callback. - If you reuse the same
request_idacross multiple video tasks, each task can still deliver its own callback. - Network conditions may still produce rare duplicate deliveries during retry.
- Implement your endpoint idempotently, for example by deduplicating on
idandstatus.
Video Callback Request
Authentication
The POST request that Token360 sends to your callback_url carries no authentication headers. Protect your receiving endpoint by:
- Exposing only HTTPS.
- Using an unguessable random path, or embedding a verification token in the callback URL.
- Checking
request_idagainst your local records before acting on the payload.
Request Body
idstringrequiredVideo task ID. This matches the id returned by the submit response.
statusenum<string>requiredTerminal state of the video task.
payloadobjectrequiredFull video object. It matches the response from GET /v1/videos/{video_id}, including id, object, status, model, prompt, url, video_url, duration, parameters, content, usage, and error fields when available.
request_idstringBusiness ID echoed from the video creation request. Omitted when not provided.
errorobject | nullError details. Present only when status is failed.
error.codestringProvider or platform error code.
error.messagestringHuman-readable error message.
Response
status_codeintegerrequiredReturn any 2xx HTTP status code to acknowledge delivery. After following redirects, any final non-2xx response triggers a retry.
bodyanyOptional response body. Token360 ignores the body content.