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

# Jobs and results

> Poll asynchronous work, read every caption in one call, and filter your history

Every caption request creates a job. The job tracks state and billing; its items hold the captions, one per image, in the order you sent them.

## Job states

`queued`, `dispatching`, `submitted`, `polling` and `processing` are active. `needs_review` is held and not terminal. `completed`, `partially_completed`, `failed` and `redacted` are terminal.

```mermaid actions={false} theme={"system"}
stateDiagram-v2
    [*] --> queued
    queued --> processing
    processing --> completed
    processing --> partially_completed
    processing --> failed
    processing --> needs_review
    needs_review --> completed: reconciled
    needs_review --> partially_completed: reconciled
    needs_review --> failed: reconciled
```

## Read a job with its captions

`GET /v1/jobs/{job_id}?include=items` returns the job with an `items` array: every item, in input order. One call gives you the state, the cost and every caption.

```bash theme={"system"}
curl "https://api.joip.io/v1/jobs/0d362d39-bf9a-4237-b9d3-59d77d487045?include=items" \
  --header "Authorization: Bearer $JOIP_API_KEY"
```

```json theme={"system"}
{
  "id": "0d362d39-bf9a-4237-b9d3-59d77d487045",
  "type": "caption_generation",
  "state": "completed",
  "item_count": 1,
  "completed_item_count": 1,
  "failed_item_count": 0,
  "billing": {
    "reserved_credits": 4,
    "settled_credits": 4,
    "released_credits": 0,
    "currency": "credits"
  },
  "created_at": "2026-11-29T12:00:00.000Z",
  "updated_at": "2026-11-29T12:00:04.000Z",
  "completed_at": "2026-11-29T12:00:04.000Z",
  "items": [
    {
      "id": "c3c7f60a-95fc-4c82-9801-953ad3634838",
      "job_id": "0d362d39-bf9a-4237-b9d3-59d77d487045",
      "job_type": "caption_generation",
      "index": 0,
      "state": "completed",
      "input_asset_ids": ["d2e196a3-a26e-44eb-846f-9f04f2fd70d4"],
      "output_asset_ids": [],
      "result": {
        "type": "caption",
        "source_asset_id": "d2e196a3-a26e-44eb-846f-9f04f2fd70d4",
        "caption_text": "Your generated caption appears here."
      },
      "created_at": "2026-11-29T12:00:00.000Z",
      "updated_at": "2026-11-29T12:00:04.000Z",
      "completed_at": "2026-11-29T12:00:04.000Z"
    }
  ]
}
```

Without `include` the job comes back without `items`, exactly as before. `include` accepts only `items`; anything else returns `400 invalid_query` with `param` set to `include`.

`settled_credits` is what the job cost. A completed item carries `result.caption_text`. A failed item carries a sanitized `error` with only `code` and `message` (see [item errors](https://docs.joip.io/api-reference/errors.md#job-and-item-errors)) and costs nothing. Provider payloads and credentials are never exposed.

`GET /v1/jobs/{job_id}/items` returns the same items as a [cursor-paginated](https://docs.joip.io/api-reference/pagination-and-rate-limits.md) list, for when you want them a page at a time.

## Poll until it's done

```js JavaScript SDK theme={"system"}
const job = await joip.waitForJob(jobId); // backs off 1 s to 5 s, includes items
```

```python Python SDK theme={"system"}
job = joip.wait_for_job(job_id)  # backs off 1 s to 5 s, includes items
```

```bash cURL theme={"system"}
until state=$(curl -s "https://api.joip.io/v1/jobs/$JOB_ID?include=items" \
    --header "Authorization: Bearer $JOIP_API_KEY" | jq -r .state) \
  && [[ "$state" =~ ^(completed|partially_completed|failed|redacted|needs_review)$ ]]; do
  sleep 2
done
```

Or skip polling entirely: the SDKs' `captions()` and `rewrite()` submit, wait and return the captions in one call ([SDKs](https://docs.joip.io/api-reference/sdks.md#caption-in-one-call)).

If you poll yourself:

* Start about one second after acceptance and back off to five seconds.
* Stop on a terminal state or `needs_review`.
* On `429`, wait `Retry-After` seconds. Each poll counts toward the key's [120 requests per minute](https://docs.joip.io/api-reference/pagination-and-rate-limits.md#request-limit).
* After a network error or `503` on submission, retry with the original `Idempotency-Key`.

## Held for review

A job reaches `needs_review` when Joip can't confirm what the caption provider did with an item. Joip holds the job's remaining reservation until it reconciles the outcome, which takes far longer than a polling loop. Stop polling and keep the job ID. The SDK polling methods return a held job instead of waiting, and the one-call helpers throw `JoipJobHeldError`.

Never resubmit a held job's media under a new idempotency key: you would pay twice if the first attempt succeeded. Contact [support](https://joip.com/support/contact) with the job ID and `X-Request-Id`.

## Find jobs

`GET /v1/jobs` lists your jobs, newest first, and accepts two optional filters beside `limit` and `cursor`:

| Parameter | Values |
| - | - |
| `state` | One job state: `queued`, `dispatching`, `submitted`, `polling`, `processing`, `needs_review`, `completed`, `partially_completed`, `failed` or `redacted` |
| `type` | `caption_generation` or `caption_rewrite` |

```bash theme={"system"}
curl "https://api.joip.io/v1/jobs?state=needs_review&type=caption_generation" \
  --header "Authorization: Bearer $JOIP_API_KEY"
```

An unknown value returns `400 invalid_query` with `param` naming the filter. The SDKs' `iterJobs({ state, type })` and `iter_jobs(state=..., type=...)` walk every page for you.

Jobs are account-scoped. Another account's job ID returns `404 job_not_found`.

## Generations library

The signed-in [Generations library](https://joip.com/joip-api?tab=generations) shows this same job and item history inside Joip. Active generations refresh automatically; expand one to read its captions, sanitized errors and settled cost.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.