Query tasks
Poll task status and fetch result images with a task_id.
GET /v1/tasks/{task_id}
Query a task with the task_id you got on submission. The response uses the platform envelope { code, data }.
Status values
data.status has exactly four public values:
| status | Meaning | Terminal |
|---|---|---|
pending | Submitted / queued | No |
processing | Generating | No |
completed | Succeeded | Yes |
failed | Failed | Yes |
The real status values are pending / processing / completed / failed. Do not branch on legacy values like queued / success.
Response fields (data)
| Field | Type | Description |
|---|---|---|
id | string | Task id (the same task_id returned on submission) |
status | string | pending / processing / completed / failed |
progress | string | Progress, e.g. 100% |
created | integer | Submission time (Unix seconds) |
estimated_time | integer | Estimated duration (seconds) |
completed | integer | Completion time (Unix seconds; terminal states only) |
actual_time | integer | Actual duration (seconds; terminal states only) |
credits_cost | integer | Credits consumed |
result | object | Present on success (see below) |
error | object | Present on failure (see below) |
result (success)
| Field | Type | Description |
|---|---|---|
url | string[] | Result image URLs (platform domain token-img.jiufeng.ai) |
expires_at | integer | Expiry (Unix seconds; 24 hours after completion) |
image_ids | string[] | Platform ids of the result images |
error (failure): { message, type, param, code }.
Success example
Failure example
Polling tips
- Exponential backoff: start around 1s and stretch to a few seconds between calls; don't busy-loop.
- Result image URLs expire 24 hours after completion — download or re-host them to your own storage promptly.
- To skip polling entirely, use Webhook callbacks.
Batch query POST /v1/tasks/batch
Query many tasks at once (simplified: each task returns only id and status, no result). Send task_ids (an array of task_id, default limit 500). Beyond the four standard states, batch may also return invalid_id / expired / not_found for the corresponding id.
To fetch result images, call GET /v1/tasks/{task_id} on each completed task.