Skip to article

Task lifecycle

Interpret terminal states, batch progress and partial success.

Accepted is not completed

POST /api/v1/tasks returns HTTP 202 after acceptance. Its receipt contains taskId, status, statusUrl, pollAfterSeconds and replayed. Poll GET /api/v1/tasks/{taskId} or call get_task until terminal is true.

Single and batch results

FieldMeaning
operationBusiness operation selected at submission
statusCurrent aggregate state
terminalWhether all media items have finished
progressTotal, processing, completed and failed item counts
itemsIndividual media task states, assets and actionable errors
assetsReady successful files available for download or reuse
webhookDelivery status, stable event ID and attempt count

Direction animation and sound effects can contain multiple media items. Batch NPC currently uses one media generation for the whole cast; NPC count and media-item count differ.

Before a terminal callback event is created, webhook.status and webhook.eventId are null, including tasks without a callback. Delivery states are pending, delivered and failed. These fields describe callback delivery, not generation progress.

Terminal states

A complete success is completed. A batch with both successes and failures is partially_completed. A complete failure is failed or the reported parameter failure state. Never infer completion from elapsed time or from only one finished batch item.

Recovery

When a response is lost, recover the original request with the same idempotency key. When polling fails temporarily, keep the same task ID and back off. A terminal failure can be reviewed for a deliberate new request; an unknown provider submission must first be reconciled by the existing workflow.