Skip to content

List an EPUB's chapters

GET
/assets/{id}/epub/spine

Lists the chapters of an EPUB asset in reading order, one entry for each item in the book’s spine. Pass an entry’s idx to GET /assets/{id}/epub/chapters/{idx} to read that chapter.

A chapter’s label is taken from the book’s table of contents where possible, otherwise from its first heading, its title or its manifest id. The table of contents is read only from a navigation document or NCX file that the manifest lists under the id toc or ncx. A label that looks like a file name or a short code becomes “Chapter N”, with N = idx + 1, so a short one-word title such as “Prologue” can be replaced as well.

You need to be signed in, and any account can list any EPUB asset’s chapters. The list is cached per asset and not refreshed, so a cached list can still be returned after the asset is deleted, for as long as its entry stays in the cache. Otherwise a 404 means no asset has that id, it’s in the trash or it has no stored file. A file that can’t be read as an EPUB gets a 500, as JSON or, for some broken files, as plain text.

id
required
string format: uuid

The id of the EPUB asset.

The chapters, in reading order.

Array<object>

One chapter of an EPUB, in reading order.

object
idx
required

The chapter’s position in the reading order, starting at 0. Pass it to GET /assets/{id}/epub/chapters/{idx}.

integer
label
required

The name to show for the chapter: its table-of-contents entry, its first heading or title, or its manifest id. A value that looks like a file name or a short code is replaced with “Chapter N”, where N is idx + 1.

string
href
required

The chapter file’s path as the manifest gives it, relative to the book’s package file.

string
media_type
required

The chapter file’s media type as the manifest declares it; it isn’t checked against the file.

string
Example
application/xhtml+xml

Authentication required, missing, or invalid

object
error
required

Human-readable error summary

string
Example
the request could not be completed
Example
{
"error": "authentication required: sign in and retry with a valid session or API token"
}

Resource not found

object
error
required

Human-readable error summary

string
Example
the request could not be completed

Unexpected server error

object
error
required

Human-readable error summary

string
Example
the request could not be completed