> ## Documentation Index
> Fetch the complete documentation index at: https://docs.chexnik.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Jobs & polling

> Lifecycle of an asynchronous generation job.

Every generation request creates a **job** that runs asynchronously. Track it by polling `GET /jobs/{job_id}` until it reaches a terminal state.

## Status values

| `status`     | Meaning                                  | Terminal |
| ------------ | ---------------------------------------- | :------: |
| `queued`     | Accepted, waiting to be picked up.       |          |
| `processing` | Currently generating.                    |          |
| `done`       | Completed — `result.image_url` is ready. |     ✅    |
| `failed`     | Failed — see `error`.                    |     ✅    |

<Note>
  The job creation response always returns `status: "queued"`. The status surfaced by `GET /jobs/{job_id}` uses `processing` (not `queued`) while actively generating.
</Note>

## Polling

Poll `GET /jobs/{job_id}` until `status` is `done` or `failed`. A short interval (e.g. 2 seconds) is typical.

```bash theme={null}
curl -s https://bananahub.io/api/v1/jobs/$JOB_ID \
  -H "Authorization: Bearer $API_KEY"
```

<Warning>
  When `status` is `done`, `result.image_url` is a presigned URL valid for **24 hours**. It is regenerated on every poll — always use the freshest value rather than caching an old one.
</Warning>

<Tip>
  To avoid polling entirely, register a [webhook](/concepts/webhooks) and we'll notify you when the job reaches a terminal state.
</Tip>

See the full [Get job](/api-reference/get-job) reference for the response schema.
