apyhub
Back
▣ OUTPUT KIT

Generate Book and Manuscript PDF API

What it does

Book Typesetter turns book manuscript data into a print-ready PDF, and also supports a Shunn standard-format manuscript PDF workflow.

Use the first endpoint when you need a finished book layout from structured content. Send a bookTitle, trim size (trimWidthIn, trimHeightIn), chapter list, and optional front matter, author metadata, publisher details, cover images, and back matter. The response is a binary PDF suitable for review or production. The schema supports chapter blocks such as paragraphs, headings, images, lists, tables, and scene breaks, plus book-level sections like praise, foreword, preface, dedication, epigraph, glossary, bibliography, endnotes, index, and answer key.

Use the second endpoint when you need a manuscript formatted to Shunn standard style. Send bookTitle, byline, authorLegalName, and chapter content. That endpoint returns a binary PDF with manuscript conventions applied for submission or editorial review.

Book Typesetter is a fit for publishing pipelines, self-publishing tools, editorial systems, and internal automation that need consistent book formatting without manual layout work. It gives you deterministic output from structured input, so you can generate readable drafts, production proofs, or submission copies from the same content model.

▣ ENDPOINT 01 / 02
POST
Typeset a print-ready book PDF (trim size, fonts, front and back matter)
https://api.eu.apyhub.com/freedailypro/generate-book-and-manuscript-pdf/typeset-book

QUICKSTART

GUIDE

Quickstart

Create a book layout and download the generated file.

curl -X POST "https://api.eu.apyhub.com/freedailypro/generate-book-and-manuscript-pdf/typeset-book" \
  -H "apy-token: $APY_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "bookTitle": "My First Book",
    "trimWidthIn": 5.5,
    "trimHeightIn": 8.5,
    "chapters": [
      {
        "title": "Chapter 1",
        "blocks": [
          {
            "type": "paragraph",
            "runs": [
              {
                "text": "Hello, world!"
              }
            ]
          }
        ]
      }
    ]
  }' \
  --output typeset-book-output.bin

What you'll get back

Returns a binary file (string with format: "binary"), not JSON. Save the response to a file with --output as shown above.

TRY ITLIVE · 10 ATOMS
Loading your default key…
The full key is used to call the gateway and stays in this tab — never sent to orbit or saved.
body*
chapters*
The chapters, in order, up to 100.
chapters-1*
The chapter title, printed as the chapter heading and used in the table of contents.
blocks*
The chapter content in reading order, up to 800 blocks.
blocks-0*
runs*
runs-1*
A piece of text with one style. A paragraph is a list of runs.
The words of this run. Control characters that XML cannot hold are removed.
The book title: title page, cover, running header.
Page width in inches (3 to 14), for example 5.5 for a 5.5 x 8.5 in book.
Page height in inches (3 to 14).
Printed on the copyright page as given (not validated; use /v1/publishing/isbn to check it).
Electronic ISBN, printed on the copyright page.
index
index-0*
runs*
runs-1*
A piece of text with one style. A paragraph is a list of runs.
The words of this run. Control characters that XML cannot hold are removed.
foreword
blocks*
blocks-0*
runs*
runs-1*
A piece of text with one style. A paragraph is a list of runs.
The words of this run. Control characters that XML cannot hold are removed.
Who wrote the foreword; printed under it.
backCover
Adds a full-bleed back cover as the last page.
publisher
frontCover
Adds a full-bleed front cover as the first page.

About this endpoint

What it does

Typesets a print-ready book PDF from a structured book manuscript. The request body defines the book metadata, front matter, chapters, back matter, trim size, font, layout options, and optional cover assets; the success response is a binary file.

Request Body

ParameterTypeMandatoryDescription
bookTitleStringYesThe book title, printed on the title page, cover, and running header.
trimWidthInNumberYesPage width in inches, from 3 to 14.
trimHeightInNumberYesPage height in inches, from 3 to 14.
chaptersObject ArrayYesThe chapters in order, up to 100 items. Each chapter object requires title and blocks. partTitle is optional and groups adjacent chapters under the same part divider page.
chapters[].titleStringYesThe chapter title, printed as the chapter heading and used in the table of contents.
chapters[].blocksObject ArrayYesChapter content in reading order, up to 800 blocks. Each block must match one of the supported block shapes in the schema.
chapters[].partTitleStringNoGroups this chapter and following chapters with the same value under a Part divider page.
isbnStringNoPrinted on the copyright page as given. Not validated.
eisbnStringNoElectronic ISBN, printed on the copyright page.
indexObject ArrayNoIndex entries. Each item must match one of the supported index item shapes in the schema.
praiseObject ArrayNoFront-matter praise entries, up to 800 items. Each item must match one of the supported content shapes in the schema.
authorsObject ArrayNoAuthor entries, up to 50 items. Each author requires name and role. bio and photoDataUri are optional.
authors[].nameStringYesAuthor name, up to 200 characters.
authors[].roleENUMYesAuthor role. Allowed values: main, contributing, illustrator, editor.
authors[].bioObject ArrayNoAuthor bio content shown on the About the Author page, up to 800 items.
authors[].photoDataUriStringNoAuthor photo as an image data URI.
editionStringNoEdition label, such as 2nd Edition, shown on the title page and covers.
prefaceObject ArrayNoPreface content, up to 800 items.
appendixObject ArrayNoAppendix content, up to 800 items.
endnotesObject ArrayNoEndnotes content, up to 800 items.
epigraphObject ArrayNoEpigraph content, up to 800 items.
forewordObjectNoForeword content. Requires authorName and blocks.
foreword.authorNameStringYesName printed under the foreword.
foreword.blocksObject ArrayYesForeword content blocks, up to 800 items.
glossaryObject ArrayNoGlossary content, up to 800 items.
answerKeyObject ArrayNoAnswer key content, up to 800 items.
backCoverObjectNoBack cover configuration.
backCover.blurbObject ArrayNoBack-cover blurb content, up to 800 items.
backCover.imageDataUriStringNoFull-bleed back-cover image as a data URI.
backCover.publisherNameStringNoPublisher name shown on the back cover.
backCover.qrCodeDataUriStringNoQR code image data URI placed on the back cover.
backCover.barcodeDataUriStringNoBarcode image data URI placed on the back cover.
backCover.publisherLogoDataUriStringNoPublisher logo data URI placed on the back cover.
directionENUMNoReading direction. Allowed values: auto, ltr, rtl.
publisherObjectNoPublisher details. Requires name; intro and logoDataUri are optional.
publisher.nameStringYesPublisher name.
publisher.introObject ArrayNoPublisher intro content, up to 800 items.
publisher.logoDataUriStringNoPublisher logo data URI.
watermarkBooleanNoOpt-in preview watermark. Default is false.
dedicationObject ArrayNoDedication content, up to 800 items.
frontCoverObjectNoFront-cover configuration. imageDataUri, publisherName, and publisherLogoDataUri are optional.
frontCover.imageDataUriStringNoFull-bleed front-cover image as a data URI.
frontCover.publisherNameStringNoPublisher name shown on the front cover.
frontCover.publisherLogoDataUriStringNoPublisher logo data URI shown on the front cover.
includeTocBooleanNoWhether to include a table of contents.
seriesNameStringNoSeries name, up to 300 characters.
authorsNoteObject ArrayNoAuthors' note content, up to 800 items.
gutterModelENUMNoMargin model. Allowed values: kdp-scaled, flat-0.5, flat-0.75-inside.
alsoByAuthorObject ArrayNoAlso-by-author content, up to 800 items.
bibliographyObject ArrayNoBibliography content, up to 800 items.
listOfGraphsObject ArrayNoList of graphs content, up to 800 items.
listOfTablesObject ArrayNoList of tables content, up to 800 items.
titlePageContentObject ArrayNoExtra title-page content, up to 800 items.
copyrightYearIntegerNoCopyright year. Minimum 1000, maximum 9999. Default is the current year.
bodyFontFamilyENUMNoBody font embedded in the PDF. Allowed values: literata, eb-garamond, merriweather, lora, tinos, inter, arimo, playfair-display. Default literata.
peerReviewNoteObject ArrayNoPeer review note content, up to 800 items.
backMatterOrderString ArrayNoOrder of back-matter sections. Allowed values: acknowledgments, also-by-author, appendix, bibliography, endnotes, glossary, answer-key, index.
copyrightHolderStringNoName printed after the copyright symbol.
frontMatterOrderString ArrayNoOrder of front-matter sections. Allowed values: praise, title-page, copyright-page, authors, dedication, epigraph, foreword, authors-note, preface, how-to-use, publisher, peer-review, toc, list-of-images, list-of-tables, list-of-graphs. A section omitted from this list is left out.
howToUseThisBookObject ArrayNoHow-to-use content, up to 800 items.
epigraphShowLabelBooleanNoWhether to show the epigraph label.
dedicationShowLabelBooleanNoWhether to show the dedication label.
includeListOfImagesBooleanNoWhether to include a list of images.
copyrightPageContentObject ArrayNoExtra copyright-page content, up to 800 items.
epigraphImageDataUriStringNoImage data URI used with the epigraph section.
titlePageImageDataUriStringNoImage data URI used on the title page.
dedicationImageDataUriStringNoImage data URI used with the dedication section.
copyrightPageImageDataUriStringNoImage data URI used on the copyright page.

Response

Returns a binary file containing the generated PDF. The output schema is a single binary payload, so the success response is the downloadable document itself.

ParameterTypeMandatoryDescription
fileBinaryYesThe generated PDF binary.

Notes

watermark defaults to false, so the exported file is clean unless you opt in to the preview marking. Also note that bodyFontFamily is limited to the eight enumerated fonts, and unsupported scripts such as Chinese, Japanese, Korean, and other unsupported scripts are rejected with 422 unsupported_script according to the schema description.

▣ ENDPOINT 02 / 02
POST
Typeset a manuscript as a Shunn standard-format PDF
https://api.eu.apyhub.com/freedailypro/generate-book-and-manuscript-pdf/typeset-manuscript

QUICKSTART

GUIDE

Quickstart

Create a book manuscript from the required title, byline, author legal name, and at least one chapter.

curl -X POST "https://api.eu.apyhub.com/freedailypro/generate-book-and-manuscript-pdf/typeset-manuscript" \
  -H "apy-token: $APY_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "bookTitle": "The Hidden Orchard",
    "byline": "by Maria Lopez",
    "authorLegalName": "Maria Lopez",
    "chapters": [
      {
        "title": "Chapter 1",
        "blocks": [
          {
            "type": "paragraph",
            "runs": [
              {
                "text": "It was a quiet morning in the orchard."
              }
            ]
          }
        ]
      }
    ]
  }'

What you'll get back

Returns a binary file response. The output schema is a raw binary payload, so there is no JSON object to describe.

TRY ITLIVE · 30 ATOMS
Loading your default key…
The full key is used to call the gateway and stays in this tab — never sent to orbit or saved.
body*
Written as it should appear after by, for example Maria Lopez.
chapters*
chapters-1*
blocks*
blocks-0*
runs*
runs-1*
A piece of text with one style. A paragraph is a list of runs.
The words of this run. Control characters that XML cannot hold are removed.
Title, printed on the title page and in the running head (shortened, upper case).
Your legal name: top-left of the title page, the running-head surname, and the DOCX author property.
Reading direction: auto (the default), ltr or rtl. With auto, a book whose text is mostly Arabic or Hebrew is laid out right to left and anything else left to right; ltr or rtl overrides that. Right to left means the first page is a left-hand page with the binding on its right, mirrored margins, text, lists, tables and the table of contents running from the right, correct mixing of English words and numbers inside Arabic or Hebrew lines, and a PDF marked right-to-left (page 1 on the right of the spine in two-page view). EPUB: every page is dir=rtl and the spine has page-progression-direction=rtl. DOCX: right-to-left paragraphs and sections, Arabic and Hebrew runs marked right-to-left.
Opt-in preview watermark. Default false: the file is clean, with no promotional text. true adds a visible PREVIEW marking: in the PDF a light diagonal PREVIEW tiled across every page, in the EPUB and DOCX a banner line reading PREVIEW COPY on the cover and every chapter (EPUB) or in the page header (DOCX). The X-Watermark response header says whether it was applied.

About this endpoint

What it does

Typesets a manuscript into a Shunn standard-format PDF. You send the book metadata and chapter content in the request body, and the endpoint returns the generated file as binary data.

Request Body

ParameterTypeMandatoryDescription
bookTitleStringYesTitle, printed on the title page and in the running head (shortened, upper case).
bylineStringYesWritten as it should appear after by, for example Maria Lopez.
authorLegalNameStringYesYour legal name: top-left of the title page, the running-head surname, and the DOCX author property.
authorEmailStringNo
authorPhoneStringNo
authorAddressStringNo
directionENUMNoReading direction. Allowed values: auto (default), ltr, rtl. auto lays out right-to-left only when the book is mostly Arabic or Hebrew.
watermarkBooleanNoOpt-in preview watermark. Default false. true adds a visible PREVIEW marking.
chaptersObject ArrayYesChapter entries. Each chapter must include title and blocks.
chapters[].titleStringYesChapter title. Maximum length 300 characters.
chapters[].partTitleStringNoPart title. Maximum length 300 characters.
chapters[].blocksObject ArrayYesContent blocks for the chapter. Allowed block types: paragraph, heading, image, list, table, sceneBreak.
chapters[].blocks[].typeENUMYesAllowed values depend on the block object: paragraph, heading, image, list, table, or sceneBreak.
chapters[].blocks[].runsObject ArrayYes (if type is paragraph or heading)Text runs for a paragraph or heading. Each run must include text.
chapters[].blocks[].runs[].textStringYesThe words of this run. Control characters that XML cannot hold are removed.
chapters[].blocks[].runs[].boldBooleanNo
chapters[].blocks[].runs[].colorStringNoText colour as a hex code matching ^#[0-9a-fA-F]{3,8}$.
chapters[].blocks[].runs[].italicBooleanNo
chapters[].blocks[].runs[].subscriptBooleanNo
chapters[].blocks[].runs[].underlineBooleanNo
chapters[].blocks[].runs[].superscriptBooleanNo
chapters[].blocks[].alignENUMNoAllowed values: left, center, right, justify.
chapters[].blocks[].lineHeightStringNoLine height as a multiplier written as text, matching ^[0-9](\\.[0-9]+)?$, for example 1.5.
chapters[].blocks[].levelENUMYes (if type is heading)Heading level. Allowed values: 1, 2, 3, 4. Level 1 is shown as a sub-heading inside a chapter.
chapters[].blocks[].dataUriStringYes (if type is image)Base64 data URI for the image. Allowed types: image/jpeg, image/png, image/gif, image/webp, image/svg+xml. Maximum length 15,000,000 characters.
chapters[].blocks[].altStringNoAlternative text for screen readers. Maximum length 500 characters.
chapters[].blocks[].captionStringNoCaption shown under the picture. Maximum length 500 characters.
chapters[].blocks[].widthFracNumberNoPicture width as a fraction of the text width, from 0.1 to 1. Default 1.
chapters[].blocks[].orderedBooleanYes (if type is list)true for a numbered list, false for bullets.
chapters[].blocks[].itemsObject ArrayYes (if type is list)List items. Each item is a list of runs.
chapters[].blocks[].items[].textStringYesThe words of this run. Control characters that XML cannot hold are removed.
chapters[].blocks[].items[].boldBooleanNo
chapters[].blocks[].items[].colorStringNoText colour as a hex code matching ^#[0-9a-fA-F]{3,8}$.
chapters[].blocks[].items[].italicBooleanNo
chapters[].blocks[].items[].subscriptBooleanNo
chapters[].blocks[].items[].underlineBooleanNo
chapters[].blocks[].items[].superscriptBooleanNo
chapters[].blocks[].rowsObject ArrayYes (if type is table)Table rows. Short rows are padded to the widest row.
chapters[].blocks[].rows[].cellsObject ArrayYesTable cells for the row. Each cell is a list of runs.
chapters[].blocks[].rows[].headerBooleanNotrue makes this a header row; in DOCX it is bold and repeats on each page.
chapters[].blocks[].rows[].cells[].textStringYesThe words of this run. Control characters that XML cannot hold are removed.
chapters[].blocks[].rows[].cells[].boldBooleanNo
chapters[].blocks[].rows[].cells[].colorStringNoText colour as a hex code matching ^#[0-9a-fA-F]{3,8}$.
chapters[].blocks[].rows[].cells[].italicBooleanNo
chapters[].blocks[].rows[].cells[].subscriptBooleanNo
chapters[].blocks[].rows[].cells[].underlineBooleanNo
chapters[].blocks[].rows[].cells[].superscriptBooleanNo

Response

Returns a binary file containing the generated PDF. The output schema is a single binary string, so the success response is the downloadable document itself.

ParameterTypeMandatoryDescription
binaryStringYesBinary PDF file returned by the endpoint.

Notes

Image inputs must be provided as data URIs, not web URLs. The schema explicitly says web addresses are never fetched, and image bytes are decoded and checked; a wrong MIME label or damaged image is rejected.

▣ COMMON ERRORS

Errors any endpoint can return

400bad_request

Required parameter missing or malformed body.

401unauthorized

API key missing, revoked, or not authorized for this service.

429rate_limited

Your plan's per-second rate exceeded. Retry with exponential backoff.

503upstream_busy

Backend temporarily unavailable. Try again in a few seconds.