Skip to content

Get a file from inside an EPUB

GET
/assets/{id}/epub/resources/{path}

Returns one file from inside an EPUB asset, such as an image, stylesheet or font. The HTML from GET /assets/{id}/epub/chapters/{idx} already points its links here, so you don’t normally build these URLs yourself.

Only files listed in the book’s manifest are returned, matched on their exact path from the start of the archive. Content-Type is the media type the manifest gives the file, or application/octet-stream when it gives none; it isn’t checked against the file. No caching or range headers are sent.

The path must arrive as a single URL segment. The URLs the chapter route writes keep the slashes between folders, so for a file below the top level of the archive they get a 404 instead of the file.

You need to be signed in, and any account can read files from any EPUB asset. A 400 means the path resolves to the top of the archive rather than to a file, or contains .. anywhere, even inside a file name. A 404 means the asset wasn’t found or the file isn’t in the manifest. Server errors usually get the JSON 500, but some get a plain-text 500.

id
required
string format: uuid

The id of the EPUB asset.

path
required
string

The file’s full path inside the archive. Chapter HTML already contains these URLs; files below the top level don’t load through them at the moment (see above).

The file, with the media type from the book’s manifest.

string format: binary

Malformed request

object
error
required

Human-readable error summary

string
Example
the request could not be completed

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