Poll tasks and download every usable output
Handle asynchronous states, credit accounting, partial outputs, cancellation, and expiring signed asset URLs without leaking credentials.
On this page
A create response is not a finished animation
POST /animations returns HTTP 202 with a task ID and Retry-After. Persist that ID before doing anything else. A response accepted into the queue is not proof that production has completed.
Poll GET /animations/{id}. Prefer the server's Retry-After value (currently typically five seconds), add bounded backoff for transient errors, and use an overall deadline. Do not create another task just because polling is slow. The current public workflow is polling-based, not webhook-based.
States and stages
| State | What the caller should do |
|---|---|
queued |
Wait; a worker has not completed the task |
running |
Continue polling; inspect stage and progress |
cancelling |
Cancellation requested, not final; continue polling |
succeeded |
Terminal; inspect and download outputs |
failed |
Terminal; inspect error and any outputs |
cancelled |
Terminal; inspect any completed outputs and credit accounting |
stage identifies video_generation or animation_export when relevant. progress is a value between 0 and 1, not a guaranteed time estimate. A task can advance between polls without emitting every intermediate state.
credits.quoted, credits.held, and credits.charged describe different accounting states. Do not treat the initial quoted value as the final charge or add all three together.
Partial outputs matter
A one-click task can generate a usable source video and then fail during export. Always read outputs at a terminal state, even if status is not succeeded.
Download each available asset, record the task error and missing requested formats, then report partial success accurately. Retry only the operation actually needed; an existing source video can be exported through /animation-exports without regenerating the motion.
Download securely
Each asset has id, format, mime_type, byte_size, download_url, and download_expires_at.
- Save a task or asset ID for durable application state.
- Use the returned signed URL to download the bytes.
- Do not attach the API Bearer header to the signed URL or a redirected storage host.
- Save to an application-chosen filename and verify the download completed.
- If the link expired, call
GET /assets/{asset_id}with your API key to request a fresh link.
Links are normally short-lived; use download_expires_at instead of a hard-coded lifetime. Asset lookup does not restore an asset that is no longer available under storage or retention policy.
Treat signed URLs as temporary credentials: do not publish them in logs, analytics, issue trackers, or AI conversation transcripts.
Cancellation
Use POST /animations/{id}/cancel for the owned task. Cancellation is best effort and may return an intermediate state. Poll to a terminal result; completion can win a race with cancellation.
Production already performed can remain charged. Unspent holds can be released; inspect the returned credit usage rather than promising a full refund.
Review before exporting: two-step flow
Use POST /video-generations and poll GET /video-generations/{id} to obtain the video asset. After review, create an export with source_video_asset_id, selection, and export settings at POST /animation-exports, then poll GET /animation-exports/{id}.
Quote and use an idempotency key for each new paid create operation. A source asset ID and task ID are different resources; do not swap them. The quickstart example demonstrates the simpler one-click lifecycle.
Was this page helpful?
No search queries, code, or free text are collected. This switch controls documentation interactions only; general site analytics follow the privacy policy. Privacy policy