/tasks/submit. Returns whatever’s known right now
— pending, running, or one of three terminal states (completed,
failed, cancelled).
For real-time delivery (server-pushed state changes instead of
client-pulled polls), use GET /v1/tasks/stream/{task_id} (SSE) or a
callback_url registered on submit.
When to use
- Cheap polling loop —
/tasks/queryis free; call it on a cadence matched to the task’sestimated_seconds - Reconciling after process restart — your client died, you only
have the
out_task_idin your DB; query by that to recover the current state - Final output retrieval — once
statusiscompleted, theoutputarray holds the generated images / videos
Request
By task_id
By out_task_id (idempotency key)
Body
| Field | Type | Required | Notes |
|---|---|---|---|
task_id | string | one-of | Server-generated ULID returned by /tasks/submit. |
out_task_id | string | one-of | The idempotency key you supplied on submit. |
task_id or out_task_id is required. Sending both
returns 400 invalid_param.
Response
While running
After completion
After failure
Response fields
| Field | Type | Notes |
|---|---|---|
task_id | string | Always present. |
out_task_id | string | Echoes back if you supplied one on submit. |
status | string | pending, running, completed, failed, cancelled. |
estimated_credits | number | Pre-flight cost estimate. Present from pending onward, cleared once credits_used is set. |
estimated_seconds | integer | Pre-flight ETA. |
credits_used | number | Final billed credits. Present only on completed. Failed and cancelled tasks are free (field absent). |
output | array | Array of result objects. Shape depends on the model. Present only on completed. |
error_code | string | Machine-readable error tag. Present only on failed. |
error_message | string | Human-readable error. Present only on failed. |
Polling cadence
Match your poll interval to the model’sestimated_seconds from the
submit response. A good default for video:
callback_url (set on submit) or
the SSE stream endpoint.
Errors
| HTTP | code | When |
|---|---|---|
| 400 | invalid_param | Both task_id and out_task_id sent, or both empty. |
| 401 | invalid_api_key | Missing / revoked key. |
| 404 | task_not_found | No task matches the supplied identifier — or the task belongs to a different API key. |
Pricing
Free. Polling does not consume credits. Onlycompleted tasks bill
(via the original submit). Re-querying a completed task as many times
as you like is zero-cost.
Next
POST /tasks/cancel— abort a non-terminal taskPOST /tasks/submit— kick a task off