---
title: "Deterministic find/replace across one chapter or the whole manuscript"
method: POST
path: "/stories/{id}/manuscript/find-replace"
tags: ["chapters"]
---

# Deterministic find/replace across one chapter or the whole manuscript

`POST /stories/{id}/manuscript/find-replace`

## Request

- Base URL: `https://aistoryhub.co/api/v1`
- URL: `https://aistoryhub.co/api/v1/stories/{id}/manuscript/find-replace`
- Auth: HTTP bearer

No AI rewrite -- a literal text substitution, not a regex. Story-wide replacements snapshot each affected chapter first so they stay undoable.

## Path parameters

- `id` string, uuid, required

## Request body

- object
  - `find` string, required
  - `replace` string, required
  - `scope` 'chapter' | 'story', required
  - `chapter_id` string, uuid: Required when scope is "chapter".
  - `case_sensitive` boolean
  - `whole_word` boolean

## Response `200`

Match count and the chapters affected.

- object
  - `replacements` integer
  - `chapters_affected` integer

## Other responses

- `400`: The request body or parameters are invalid.
- `401`: Missing, malformed, invalid, revoked, or expired token.
- `403`: The token lacks the scope this endpoint requires.
- `404`: The resource does not exist or you do not own it.
- `429`: Too many requests. Retry after the delay in the `Retry-After` header.

---

[API](https://skmtc.dev/aistoryhub/apis/aistoryhub-api.md) · [All operations](https://skmtc.dev/aistoryhub/apis/aistoryhub-api/llms.txt) · [OpenAPI document](https://skmtc.dev/aistoryhub/apis/aistoryhub-api/revisions/0cfd2c14ae12?raw)
