Get task status
GET /api/ai/tasks/{id} — fetch the current snapshot of a submitted task.
Returns the current state of a task. Works for both image and video tasks — the type field distinguishes them.
The database is the source of truth. Terminal rows (status: 1 or status: 2) return immediately. Pending rows may trigger a single upstream provider query at most every 30 seconds, so callers can safely poll as often as every 2 seconds without hitting rate limits.
Status values
status | Meaning | Next step |
|---|---|---|
0 | PENDING | Continue polling. |
1 | COMPLETED | Read imageUrls[] or videoUrl. |
2 | FAILED | Read errorCode / errorMessage. Credits have been refunded (or will be shortly). |
Authorization
bearerAuth API keys are in closed beta — send your key as Authorization: Bearer <key>. In the meantime, first-party usage from the web dashboard is authenticated via session cookie. See Authentication for details.
In: header
Path Parameters
The taskId returned from /api/ai/image/generate or /api/ai/video/generate.
Response Body
application/json
application/json
application/json
application/json
curl -X GET "https://gptimage2api.org/api/ai/tasks/tsk_01J9XA5M2R9W4QZC4PYJF3N7ND"{
"taskId": "string",
"type": "image",
"status": 0,
"model": "string",
"prompt": "string",
"imageUrls": [
"http://example.com"
],
"videoUrl": "http://example.com",
"errorCode": "STORAGE_ERROR",
"errorMessage": "string",
"creditsUsed": 0,
"creditsRefunded": true,
"createdAt": "2019-08-24T14:15:22Z",
"updatedAt": "2019-08-24T14:15:22Z"
}{
"error": "Unauthorized"
}{
"error": "Task not found"
}{
"error": "string"
}