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. KIE queries use a 30-second grace window. Relay tasks return pollAfterSeconds; wait at least that long between polls (at least 5 seconds). Polling never creates a replacement task. See AI Relay for uncertain submissions and expiry.
Status values
status | Meaning | Next step |
|---|---|---|
0 | PENDING | Continue polling. |
1 | COMPLETED | Read outputImageUrls[] or outputVideoUrl. Relay media requires application authentication. |
2 | Terminal failure or unavailable | Read errorCode / errorMessage, relayStatus and creditRefunded. Unknown or expired Relay tasks do not automatically refund credits. |
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://nanobanana-api.com/api/ai/tasks/tsk_01J9XA5M2R9W4QZC4PYJF3N7ND"{
"taskId": "string",
"type": "image",
"status": 0,
"model": "string",
"prompt": "string",
"errorCode": "string",
"errorMessage": "string",
"creditsUsed": 0,
"createdAt": "2019-08-24T14:15:22Z",
"updatedAt": "2019-08-24T14:15:22Z",
"id": "string",
"outputImageUrls": [
"string"
],
"outputVideoUrl": "string",
"creditRefunded": true,
"relayStatus": "string",
"providerTaskId": "string",
"requestId": "string",
"httpRequestId": "string",
"upstreamHttpStatus": 0,
"pollAfterSeconds": 5,
"submissionUncertain": true,
"effectiveWatermark": true,
"demo": true,
"expiresAt": "2019-08-24T14:15:22Z"
}{
"error": "Unauthorized"
}{
"error": "Task not found"
}{
"error": "string"
}