> ## 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.

# Captions

> Generate and rewrite captions from public HTTPS images

Caption operations are asynchronous. A successful request returns a job with HTTP `202`; read the captions from `GET /v1/jobs/{job_id}?include=items` or `/v1/jobs/{job_id}/items` when the job is done.

## Generate captions

`POST /v1/captions/generate`

```json theme={"system"}
{
  "media_urls": ["https://joip.com/assets/landing/art-captions.webp"],
  "style": "joi"
}
```

Named styles are `joi`, `forced-bi`, `beta`, `cbt`, and `cuckold`. For a custom style, set `style` to `custom` and provide nonblank `custom_instructions` up to 4,000 characters.

## Rewrite captions

`POST /v1/captions/rewrite`

```json theme={"system"}
{
  "items": [
    {
      "media_url": "https://joip.com/assets/landing/art-captions.webp",
      "caption": "The original caption"
    }
  ],
  "rewrite_mode": "improve"
}
```

Named rewrite modes are `improve`, `spicier`, `milder`, and `different`. Custom mode requires nonblank `custom_instructions`.

## Media requirements

* One to ten items per request.
* Every URL must use public `https://`.
* Joip validates hosts, redirects, media responses, and size limits before dispatch.
* Private, loopback, link-local, credential-bearing, or otherwise unsafe URLs are rejected.
* The caller must have the right and consent to process the supplied adult content.

## Idempotent submission

Every caption request needs an `Idempotency-Key` header of 8 to 255 characters. Use one key per logical request, such as your own record ID plus the operation, and keep it for every retry of that request.

| You send | Joip answers |
| - | - |
| A new key | `202 Accepted` with a new job, and reserves its credits. |
| The same key and body again | `202 Accepted` with the original job and `Idempotent-Replayed: true`. Nothing new is reserved. |
| The same key while the first request is still being accepted | `409 idempotency_in_progress`. Retry shortly with the same key. |
| The same key with a different body | `409 idempotency_conflict`. Send the original body, or use a new key for new work. |

```http theme={"system"}
HTTP/1.1 202 Accepted
Idempotent-Replayed: true
X-Request-Id: req_01j5v6m7n8p9q0r1s2t3u4v5w6
```

The first acceptance never carries `Idempotent-Replayed`. A replay is how you know a retried request after a dropped connection reached Joip the first time. Keys are scoped to your account and the route.

The SDKs send a key on every submission and reuse it on their automatic retries. The accepted job's `replayed` property tells you whether Joip replayed it.

## Get the captions

A `202` job is only the start. Read the captions with `GET /v1/jobs/{job_id}?include=items` once the job is terminal ([Jobs](https://docs.joip.io/api-reference/jobs.md)), or let the SDKs' `captions()` and `rewrite()` helpers submit, wait and return them in one call.


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