Back to docs

Query Task Status API

Poll any asynchronous Nano AI task through one status endpoint. The backend is inferred from task_id.

Nano AI API Base URL: https://nanobnana.com

Authentication

Send the same Bearer token that you used to create the task.

http
Authorization: Bearer YOUR_API_KEY

Model Inference

You normally only need to pass task_id. The API detects whether the task belongs to nano, nano2, or nano2pro from the task ID format.

nano...ban

nano

npro...nono

nano2

n82...nb2

nano2pro

Endpoint

Use the task_id returned from /api/generate or /api/edit.

Query parameters
task_id:string

The task ID returned from /api/generate or /api/edit.

model:optional string

Optional fallback when task_id does not match a known pattern. Supported values: nano, nano2, nano2pro.

bash
curl "https://nanobnana.com/api/status?task_id=nprob71e549f645122eb8db5f75af2c11nono" \
  -H "Authorization: Bearer YOUR_API_KEY"
{
  "code": 200,
  "message": "success",
  "data": {
    "task_id": "nprob71e549f645122eb8db5f75af2c11nono",
    "request": {
      "prompt": "A professional product photo of a modern wristwatch",
      "model": "nano2"
    },
    "response": null,
    "status": "IN_PROGRESS",
    "status_code": 3,
    "status_text": "IN_PROGRESS",
    "consumed_credit": 24,
    "consumed_credits": 24,
    "model": "nano2"
  }
}

Status Codes

Important: for original nano...ban tasks, status: 3 means the task is still processing. It is not a failed state.

  • status_code: 1 means success.
  • status_code: 2 means failed.
  • status_code: 3 means in progress.

Polling Example

Poll every few seconds while status_code is 3. Stop on 1 or 2.

javascript
async function waitForImage(taskId) {
  while (true) {
    const res = await fetch(`https://nanobnana.com/api/status?task_id=${taskId}`, {
      headers: { Authorization: 'Bearer YOUR_API_KEY' }
    });
    const payload = await res.json();
    const task = payload.data || payload;

    if (task.status_code === 1) return task.response;
    if (task.status_code === 2) throw new Error(task.error_message || 'Task failed');

    await new Promise((resolve) => setTimeout(resolve, 3000));
  }
}

Common Errors

{
  "code": 400,
  "message": "task_id is required",
  "data": null
}