Production & export

Endpoints for cover art, chapter illustrations, picture books, batch narration, audiobook and manuscript export, print quotes, 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. For DOCX, docxProfile: "vellum" gives a Vellum / Atticus import file: Heading 1 per chapter, scene breaks as a centred ***, and no generated front matter, headers or page numbers (the default is manuscript).

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 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 are below. Locked portraits Anthra generated go to the image model as reference images, up to 4, at 1 extra credit each, refunded if the art falls back to the prompt alone.

Upload your own image

POST/v1/books/{bookId}/imagesscope: books:write

Free; no model runs. Multipart form: file (PNG, JPEG, WebP or GIF, up to 10 MB), kind (cover, back_cover, spine, cover_spread, chapter, character, map or mood), chapterId (required for chapter), an optional label, and paragraphAnchor to add a chapter scene. A cover or chapter-lead upload becomes the selected art (coverImageUrl / the chapter's imageUrl); a scene upload is added unselected.

Back-cover and spine panels

POST/v1/books/{bookId}/back-coverscope: generation:run
POST/v1/books/{bookId}/spinescope: generation:run

Generate 1–3 back-cover or spine panels for the print wraparound; the first is selected so the cover composer picks it up. Optional body: prompt (4–800 characters, overrides the built-in brief), style, aspectRatio (e.g. "1:6") and variants (1–3). When the front cover is Anthra-drawn art it goes to the image model as a reference, so the panels match it, at 1 extra credit a panel (refunded if the art falls back to the prompt alone). Charges one illustration credit per variant, plus that reference credit, and refunds any that fail. Returns { charged, refunded, failed, images }, each image with id, url, selected and the prompt used.

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 image pipeline, stores the result in Vercel Blob, and sets it as the chapter’s lead image. Pass paragraphAnchor (0-based paragraph index) to add a scene image inside the chapter instead; the MCP tool takes afterText, a quote from that paragraph. Opener and scene images print in the EPUB, PDF and DOCX. Charges one illustration credit; refunds on failure. Locked portraits Anthra generated go to the image model as reference images, up to 4, at 1 extra credit each, refunded if the art falls back to the prompt alone.

Repair an illustration

POST/v1/tools/repair_illustrationscope: generation:run

repair_illustration redraws one chapter or picture-book page illustration against the locked character portraits, keeping its composition, setting and style. Body: bookId, imageId, an optional note and optional characterImageIds. The new art is selected and the old art stays in the library. It needs a locked portrait Anthra generated: uploaded art is never sent to the model and can’t be repaired. Charges one illustration plus one credit per input image (the art and up to 4 portraits); refunded in full on failure.

Cover checks, matching panels and image edits

POST/v1/tools/check_cover_conventionsscope: generation:run
POST/v1/tools/derive_cover_back_and_spinescope: generation:run
POST/v1/tools/regenerate_chapter_illustrationsscope: generation:run
POST/v1/tools/edit_image_regionscope: generation:run

These are tools, called through POST /v1/tools/{tool}. check_cover_conventions scores the front cover against its genre: a 0–100 fit score, per-aspect verdicts, suggestions and a text layout; advice only. derive_cover_back_and_spine paints a back cover and spine from the selected front and composes the wraparound in one call. regenerate_chapter_illustrations repaints chapter openers in bulk, up to 6 a call, for example after an art-style change. Pass quote: true to either of those two for the price before spending. edit_image_region repaints one region of a generated image and keeps the rest: send a PNG mask the size of the image, transparent where it should change, and a note. All four are paid and refund on failure; MCP tools lists each price.

Picture books

POST/v1/tools/create_picture_bookscope: books:write
POST/v1/tools/get_picture_bookscope: books:read
POST/v1/tools/set_picture_book_pagescope: books:write

A picture book is a fixed-layout book of pages, each one image plus a few lines of text. Create it with create_picture_book, then edit it a page at a time with set_picture_book_page, add_picture_book_page, move_picture_book_page and remove_picture_book_page. All of these are free. get_picture_book returns the pages and a preflight of what stops the book printing. A coloring book is a picture book with black-and-white outline art: a brief that says so (or imageStyle: 'coloring-page') gets that style and the page count it asks for. A page's imagePrompt is its art direction, styled when the page is drawn. Pages are 8.5x8.5 by default, or trim 7.5x7.5 or 8.5x11; a coloring book defaults to 8.5x11 and takes each picture its brief lists as that page's imagePrompt. A page with no text prints its art over the whole page.

A page is a chapter, so draw it with generate_chapter_image or POST /v1/chapters/{chapterId}/image. The book has layoutMode: "picture_book" and no outline or generation run: POST /v1/books/{bookId}/outline answers 409 picture_book. POST /v1/books/{bookId}/produce switches to a fixed-layout EPUB and a full-bleed print PDF on its own, and the square hardcovers are in the print products below.

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)" }'

Export an M4B audiobook

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

For listening, not store upload. Concatenates every narrated chapter (audioStatus: "ready") into one 96 kbps AAC M4B with chapter markers, ambience and cover art, uploads it to an unguessable Blob URL, and records an audiobookExport job. Narrate the chapters first (POST /books/{bookId}/chapters/{chapterId}/narrate); with none ready the call is a 400. Synchronous — the response carries the file:

{ "data": { "jobId": "6c1e…", "audiobookUrl": "https://…/book.m4b", "sizeBytes": 48211022 } }

Retail audio package

POST/v1/books/{bookId}/audio-packagescope: generation:run
GET/v1/books/{bookId}/audio-packagescope: books:read

Background job for store upload: one MP3 per chapter (192 kbps CBR, 44.1 kHz mono, RMS -23 to -18 dB, peaks at -3 dB or lower) plus opening and closing credits files, from the dry narration with ambience and stings off. Body (optional): openingCredits, closingCredits. Every written chapter must be narrated first, or the call is a 400 listing them. The credits are narrated at the normal narration price. Returns 202 with a jobId; GET the same path for progress, the ZIP and the measured report. Each finished file is measured, and a file that misses spec fails the job with no ZIP. This is a file spec, not store access: ACX and Audible bar third-party AI narration. A package that passes also gets a retail sample, the first 5 minutes of chapter 1 faded out (retail-sample.mp3 in the ZIP, sample on GET). GET also lists every narrated chapter in chapters with its own MP3 audioUrl, to download one at a time without building a package.

Captions for narrated chapters

get_chapter_captions returns SRT or WebVTT captions for one narrated chapter, timed from its narration. Free and owner-only. spelling says whether the captions follow the manuscript (original) or the audio (narrated, after the text or pronunciation dictionary changed). It is a tool, so call it through POST /v1/tools/get_chapter_captions.

Print-on-demand products

GET/v1/print/productsscope: books:read

Lists the Lulu print products available on this instance: key, label, blurb, trim, coverFinish, minPages and maxPages. Returns 503 feature_disabled where print fulfilment isn’t configured.

Get a print quote

POST/v1/books/{bookId}/print/estimatescope: analytics:read

A read-only quote — no order is placed. Body: productKey (from the product list), quantity (1–500), shippingLevel (MAIL, PRIORITY_MAIL, GROUND_HD, GROUND_BUS, GROUND, EXPEDITED or EXPRESS) and a Lulu-style shippingAddress. The page count is estimated from the book’s word count (at least 200 words needed).

{
  "data": {
    "productKey": "paperback-6x9-bw",
    "pageCount": 212,
    "currency": "USD",
    "wholesaleCents": 812,
    "retailCents": 1499,
    "breakdown": { "line": { … }, "shipping": { … }, "tax": "0.00", "fulfillment": { … } },
    "shippingOptions": [ … ]
  }
}

Preview a narration voice

POST/v1/books/{bookId}/voice-previewscope: generation:run

Narrates a short sample so you can hear a voice before narrating the book. Body: voiceId (from the voice catalog) and an optional sampleText (up to 600 characters; defaults to the book's opening words). Each book’s first preview is free (it reads up to 600 characters, cut at a sentence end); after that it is charged at the narration price by character count, the same as preview_voice_sample, and refunded if synthesis fails. Returns { audioUrl, durationSec, free }.

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.