EPUB Create, Read & Validate API

Build a valid EPUB 3 e-book from Markdown or HTML chapters with cover and TOC, or read an EPUB: metadata, TOC, chapter text and structure checks.

POSThttps://apibox.io.vn/v1/epub

action=create (default with title) builds an EPUB 3 book: send chapters (array of {title, markdown | html}) or one markdown text split at # headings (split_level 2 for ##), plus authors, language (default vi), publisher, description, date, subjects, rights, identifier and an optional cover image (multipart field or cover_base64). The book has a nav document and an NCX for old readers, a cover page, landmarks, clean XHTML (scripts and unsafe tags removed, images given as data: URIs embedded), optional title page, toc_depth=2 for sections and embed_font=1 to embed Be Vietnam Pro for readers without Vietnamese fonts. The answer is the .epub file, or JSON with base64 when format=json.

action=read (default when a file is sent) returns the metadata (title, creators with roles, languages, identifiers, publisher, dates, subjects, series), the table of contents (nav or NCX), each spine item with title, word count and its content as text, markdown, html or none, the cover (base64 with include_cover=1) and structure issues. action=validate returns only the checks: mimetype first and stored, container.xml, package document, required metadata, manifest files present, spine references, navigation, XHTML namespace and HTML entities.

Everything runs in memory; files are not stored. The checks cover the common mistakes, not the full W3C EPUBCheck rule set. No conversion to MOBI or PDF.

Markdown · OpenAPI · Postman · llms.txt

Parameters

NameInTypeRequiredDefault
actionbodystringnocreate, read or validate (default: read when a file is sent, otherwise create).
filebodyfilenoread / validate: the EPUB file (multipart, raw body or file_base64).
contentbodystringnotextread: text, markdown, html or none.
titlebodystringnocreate: book title (required).
chaptersbodyarraynocreate: [{title, markdown | html}].
markdownbodystringnocreate: one Markdown text split into chapters at # headings.
authorsbodyarraynocreate: authors.
languagebodystringnovicreate: BCP 47 language tag.
coverbodyfilenocreate: cover image (PNG / JPEG / GIF / WebP).
embed_fontbodybooleannocreate: embed Be Vietnam Pro.
formatbodystringnoepubcreate: epub or json (base64).

Example

curl -X POST "https://apibox.io.vn/v1/epub" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"title":"Truyện ngắn","authors":"Nguyễn Văn A","markdown":"# Chương 1\n\nXin chào.\n\n# Chương 2\n\nTạm biệt.","format":"json"}'

Response

{
  "filename": "Truyen-ngan.epub",
  "bytes": 3165,
  "identifier": "urn:uuid:00000000-0000-4000-8000-000000000001",
  "chapters": [
    {
      "title": "Chương 1",
      "href": "text/ch001.xhtml",
      "sections": 0
    },
    {
      "title": "Chương 2",
      "href": "text/ch002.xhtml",
      "sections": 0
    }
  ],
  "images": 0,
  "words": 8,
  "files": [
    "mimetype",
    "META-INF/container.xml",
    "OEBPS/text/ch001.xhtml",
    "OEBPS/text/ch002.xhtml",
    "OEBPS/style.css",
    "OEBPS/nav.xhtml",
    "OEBPS/toc.ncx",
    "OEBPS/content.opf"
  ],
  "warnings": [],
  "epub_base64": "UEsDBBQAAAAAAAA4IVxvYassFAAAABQAAAAIAAAA…"
}

Use cases

  • Publish web novels or translated stories as EPUB for e-readers
  • Extract chapter text from EPUB files for RAG or search
  • Check an EPUB before uploading it to a store
  • Generate e-books from a CMS or a Markdown repository

FAQ

Does it pass EPUBCheck?

The writer produces EPUB 3 with the required parts (stored mimetype, nav, NCX, dcterms:modified, unique identifier) and well-formed XHTML. Run W3C EPUBCheck for a full conformance report before publishing to a store.

Are remote images downloaded?

No. Readers do not load remote images, so they are removed with a warning; send images as data: URIs in the Markdown or HTML.

Can it read EPUB 2 files?

Yes. The reader uses the nav document of EPUB 3 or the NCX of EPUB 2 for the table of contents.

Related APIs

Start with 1,000 free requests every month. Get free API key →