Docs / Task Management
Query Task Status
GET /v1/tasks/{id} is the shared query endpoint for all async tasks, used to check the execution status, progress, results, and error details of image, music, video, and other tasks.
GET /v1/tasks/{id} is the shared query endpoint for all async tasks, used to check the execution status, progress, results, and error details of tasks such as image, music, and video generation.
After an async task is created, the API returns a task ID that starts with task_. Clients poll this endpoint with that ID until the task reaches the completed or failed final state.
Authentication#
Use the API key of the user who created the task:
Authorization: Bearer YOUR_API_KEYTasks can only be queried by their owner. An invalid task ID, a task that does not exist, or a task that belongs to another user all return 404 task_not_found, which prevents leaking other users' task information.
Path parameters#
| Parameter | Type | Required | Description |
|---|---|---|---|
id | string | Yes | The task ID returned when the async task was created; it must start with task_ |
This endpoint has no request body.
Request example#
curl 'https://api.apimax.ai/v1/tasks/task_V1StGXR8_Z5jdHi6B' \
--header 'Authorization: Bearer <token>'Status reference#
status | Meaning | Final state |
|---|---|---|
queued | The task has been created and is queued | No |
in_progress | The task is executing | No |
completed | The task succeeded; the result is in data | Yes |
failed | The task failed; the reason is in error | Yes |
Polling every 2-5 seconds is recommended. As long as status is not completed or failed, the client should keep waiting.
Common response fields#
| Field | Type | Description |
|---|---|---|
id | string | Task ID |
object | string | image.generation.task for image tasks; usually task for other task types |
type | string | Task type, such as image, music, or video |
platform | string | Platform identifier that some non-image tasks may return |
status | string | Current task status |
progress | integer | Task progress, from 0 to 100 |
model | string | The model used to create the task |
created / created_at | integer | Creation time as a Unix timestamp |
started_at | integer | Execution start time; returned by some tasks |
completed_at / finished_at | integer | Task end time; returned for tasks in a final state |
task_info | object | Cancellation availability and estimated duration for image tasks |
data | array/object | Task result; the exact structure depends on the task type |
usage | object | Billing and token usage details for image tasks |
error | object | Failure reason; returned only for failed tasks |
Each task type returns its own result structure on top of the common fields. Image tasks use created, completed_at, and image.generation.task; music, video, and other tasks usually use created_at, finished_at, and the generic task structure.
In-progress response#
{
"id": "task_V1StGXR8_Z5jdHi6B",
"object": "image.generation.task",
"type": "image",
"status": "in_progress",
"progress": 35,
"created": 1757156493,
"model": "gpt-image-2",
"task_info": {
"can_cancel": false,
"estimated_time": 60
},
"usage": {
"billing_rule": "per_call",
"credits_reserved": 1,
"user_group": "default"
}
}task_info.estimated_time is an estimated duration in seconds for UI display and should not be treated as a hard client timeout.
Completed image task response#
{
"id": "task_V1StGXR8_Z5jdHi6B",
"object": "image.generation.task",
"type": "image",
"status": "completed",
"progress": 100,
"created": 1757156493,
"completed_at": 1757156593,
"model": "gpt-image-2",
"task_info": {
"can_cancel": false,
"estimated_time": 0
},
"data": [
{
"url": "https://cdn.example.com/images/result.png",
"url_expires_at": 1757160193
}
],
"usage": {
"billing_rule": "per_call",
"input_tokens": 12,
"output_tokens": 4160,
"total_tokens": 4172,
"user_group": "default"
}
}Image result links may have an expiry; save them promptly after the task completes.
Other task results#
Music, video, and other tasks return the generic task structure, with data holding the result payload of that task type:
{
"id": "task_example123",
"object": "task",
"type": "video",
"platform": "video",
"status": "completed",
"progress": 100,
"model": "video-model",
"created_at": 1757156493,
"started_at": 1757156500,
"finished_at": 1757156593,
"data": [
{
"url": "https://cdn.example.com/videos/result.mp4"
}
]
}Determine the task type from type or platform, then parse the corresponding data content.
Failure response#
{
"id": "task_V1StGXR8_Z5jdHi6B",
"object": "image.generation.task",
"type": "image",
"status": "failed",
"progress": 0,
"failed_at": 1757156593,
"model": "gpt-image-2",
"error": {
"code": "upstream_error",
"message": "content policy violation"
}
}error.code | Description |
|---|---|
task_not_found | The task ID is invalid, the task does not exist, or it belongs to another user |
upstream_error | The upstream rejected the request or returned a business error |
upstream_unavailable | The upstream service is temporarily unavailable |
storage_error | Failed to save the task result |
internal_error | Gateway internal error |
Polling recommendations#
- A polling interval of 2-5 seconds is recommended; avoid high-frequency requests.
- Both
completedandfailedare final states; stop polling once a task reaches either one. - If
callback_urlwas set when creating the task, you can use callbacks instead of continuous polling; the callback payload matches the final-state structure of this query endpoint. - A client timeout does not mean the task failed; you can keep querying with the same task ID later.

