Production & export

Endpoints for cover art, chapter illustrations, batch narration, manuscript export, and translation. The same surface is available through the MCP server (generate_cover_art, generate_chapter_image, narrate_book, produce_book, translate_book, etc.).

Render manuscript (EPUB / DOCX / PDF)

POST/v1/books/{bookId}/producescope: generation:run

EPUB and DOCX render synchronously and stream the file back. PDF dispatches to a workflow and returns { jobId, status: "pending" } — poll /books/{bookId}/production-jobs/{jobId} until status === "ready", then download from resultBlobUrl.

curl -X POST "$ANTHRA_BASE/books/$BOOK/produce" \
  -H "authorization: Bearer $ANTHRA_TOKEN" \
  -H "content-type: application/json" \
  -d '{ "format": "epub" }' \
  --output book.epub

Poll a production job

GET/v1/books/{bookId}/production-jobs/{jobId}scope: account:read

Returns { id, status, resultBlobUrl, error, startedAt, completedAt }. Statuses cycle pending → running → ready (or failed).

Generate cover art

POST/v1/books/{bookId}/cover-imagescope: generation:run

Generates 1–3 cover variants via the AI Gateway image pipeline, stores them in Vercel Blob, and selects the first as the active cover. Charges one illustration credit per variant; refunds the unspent portion on partial failure. The matching back-cover panel and spine live at POST /books/{bookId}/back-cover and POST /books/{bookId}/spine.

Compose a print-ready cover spread

POST/v1/books/{bookId}/cover/composescope: generation:run

Stitches the currently-selected front cover, back cover, and spine panels into a single wraparound PNG spread sized to the book's estimated page count. Pure server-side composition — no model call, no extra credits.

Generate a chapter illustration

POST/v1/chapters/{chapterId}/imagescope: generation:run

Distills a prompt from the chapter prose, calls the AI Gateway image pipeline, stores the result in Vercel Blob, and sets it as the chapter's lead image. Charges one illustration credit; refunds on failure.

Translate a book into another language

POST/v1/books/{bookId}/translatescope: generation:run

Clones the source book into a new draft (with parentBookId set), seeds matching chapter shells, then translates every written chapter sequentially. Returns the new bookId. Expensive — one LLM call per chapter. Pass a glossary (Markdown list) to lock canonical translations for proper names and specialty terms.

curl -X POST "$ANTHRA_BASE/books/$BOOK/translate" \
  -H "authorization: Bearer $ANTHRA_TOKEN" \
  -H "content-type: application/json" \
  -d '{ "targetLanguage": "pt-BR", "glossary": "- Marin → Marin (do not translate)" }'

Narration voice catalog

GET/v1/voicesscope: books:read

Lists every ElevenLabs voice available on the instance with voiceId, name, previewUrl, and category labels (accent, gender, age, description, useCase). Use the voice id when configuring narration.