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

# Chapter lifecycle

> Every status a chapter can be in, what moves it on, and what you can do in each.

A **chapter** is the unit of work and billing: one upload, one run through the pipeline, one result. The site and the API use the same chapter object.

## Statuses

```mermaid theme={null}
stateDiagram-v2
  [*] --> awaiting_upload: POST /chapters
  awaiting_upload --> validating: uploads/complete
  awaiting_upload --> expired: 24 h without complete
  validating --> ready: images OK, quote known
  validating --> failed: bad image (no charge)
  validating --> queued: auto_start, quote within max_credits
  ready --> queued: start (credits held)
  ready --> expired: 7 days without start
  queued --> processing: reaches the front of the GPU queue
  processing --> succeeded: all parts done, nothing to review
  processing --> needs_review: zones to review (exports locked)
  processing --> failed: nothing usable (full refund)
  needs_review --> succeeded: all zones accepted or fixed
  needs_review --> processing: rerender
  succeeded --> processing: rerender / retranslate after edits
  awaiting_upload --> canceled: cancel
  ready --> canceled: cancel
  queued --> canceled: cancel (full refund)
  processing --> canceled: cancel (finished steps charged)
```

| Status | Meaning | Terminal? |
| - | - | - |
| `awaiting_upload` | Created; waiting for your uploads and `uploads/complete` | No |
| `validating` | Checking images, cutting parts, computing the quote. Free. | No |
| `ready` | Quote known; waiting for `start` | No |
| `queued` | Credits held; waiting for the GPU | No |
| `processing` | Running. See `progress.step`. | No |
| `needs_review` | Finished, but some zones need your decision. Exports locked. | **No** |
| `succeeded` | Results downloadable | Yes |
| `failed` | Nothing usable; see `error`. Refunded. | Yes |
| `canceled` | Stopped by you, or by a GPU timeout | Yes |
| `expired` | Never completed or started in time | Yes |

> [!WARNING]
>
> New statuses may be added within v1. **Treat an unknown status as not terminal** and keep polling.

A `succeeded` chapter can move back to `processing` when you re-render after edits. The previous result stays downloadable until the new render finishes, and the result `version` goes up by one.

## Progress

While `processing`, `progress.step` is one of four public steps:

| Step | What happens |
| - | - |
| `read` | Find and read the Korean text |
| `translate` | Translate the whole chapter in one pass, with your series context |
| `render` | Clean the original lettering and letter the English (SFX included when enabled) |
| `stitch` | Assemble the output images |

`progress` also has `percent`, `parts_total`, `parts_done`, and a `steps` array with each step's status. While `queued`, `queue.position` is your place in the shared queue (it never shows whose chapters are ahead), and `queue.estimated_start_at` is an estimate.

## Partial failure

If some parts fail to render, the chapter still ends `succeeded`. The failed parts are listed in `warnings` and their credits are refunded. `failed` means no part produced output, or translation failed outright.

`chapter.error` is `{code, message, step}`, with `code` one of `invalid_image`, `read_failed`, `translate_failed`, `render_failed`, `gpu_unavailable_timeout`, `internal_error`.

## Needs review

Sometimes the cleaner can't safely remove the Korean lettering in a zone (its erase mask fails a check). That zone keeps its Korean and gets no English, and the chapter stops in `needs_review` with **exports locked**, so a damaged page is never exported by accident. `GET /result` returns `409 chapter_locked`.

`chapter.review` lists the zones: `{"zones": [{"id", "page", "box", "reason"}], "open": n, "accepted": n}`.

To unlock, for each zone either:

* **Accept it as is** with `POST /v1/chapters/{id}/review/accept` (`{"zone_ids": [...]}` or `{"all": true}`). Free. The Korean stays in that zone.
* **Fix and re-render**: edit the regions, then `POST /rerender`.

When no zone is left open the chapter becomes `succeeded` and `chapter.succeeded` fires.

For unattended bots, create the chapter with `"on_mask_failure": "accept"`. Those zones are then accepted automatically: their Korean stays, they're listed in `warnings`, and the chapter ends `succeeded`. Parts are charged normally.

## Editing and re-rendering

| Endpoint | Does |
| - | - |
| `GET /v1/chapters/{id}/regions` | Every text region: `id`, `page`, `box`, `ko`, `en`, `type`, `include`, `render`, `flags`. Returns an `ETag`. |
| `PATCH /v1/chapters/{id}/regions` | Batch edit `ko`, `en`, `type`, `include`. Requires `If-Match` with the regions `ETag` (`412` if stale). Returns the dirty parts. |
| `POST /v1/chapters/{id}/retranslate` | Re-translate the given `region_ids` |
| `POST /v1/chapters/{id}/rerender` | Re-render only the dirty parts. Joins the back of the GPU queue. |

Pricing for these is on [Credits and pricing](https://docs.relettr.com/credits-and-pricing.md#edits-and-re-renders).

## Output layout

| `output.layout` | You get |
| - | - |
| `original` (default) | One image per uploaded image, same order, same heights (widths are normalised to the chapter's common width) |
| `parts` | The internal processing parts, each at most 1,600 px tall |

Set `output.strip: true` to also get the full stitched strip (cut at about 30,000 px). `output.format` is `png` (default), `webp` or `jpeg`, with `output.quality` 1–100 (default 90). Region `page` and `box` values use the coordinates of the layout you chose.

Input `layout` is separate: `strip` (default) joins your images into one vertical strip, for vertical-scroll manhwa; `pages` treats each image as its own page.

## Limits

| Limit | Value |
| - | - |
| Formats | PNG, JPEG, WebP |
| Size per file | 50 MB |
| Pixels per image | 80 MP; each side at least 64 px |
| Files per chapter | 300 |
| Pixels per chapter | 1,000 MP |
| Parts per chapter | 300 |
| Chapters in `awaiting_upload` per account | 10 |

## Cancel and delete

* `POST /v1/chapters/{id}/cancel` stops the chapter and releases unused held credits. The record and any finished outputs are kept.
* `DELETE /v1/chapters/{id}` cancels it if it's running, then deletes its images, text and results from our storage. `GET` then returns `410 gone`.

You can delete a chapter, a series or your whole account at any time. Deletion removes the images, text and results from our storage. Ledger entries stay, because they're financial records; they contain credits and ids only.


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