Skip to Content

Documents and Folders

Add, find, search and organize a library.

Add a document

POST /api/v1/documents
{ "name": "notes.md", "source": { "type": "text", "text": "# Notes\n\nA document to read." } }

name must include a text or Markdown extension.

Creation accepts an optional folderId; text and links also accept author and language. It returns 201, a Location header and the document, except for a DOCX, which returns 202 with an upload resource while it converts (see Uploads).

The ID is the SHA-256 of the canonical file, so reimporting the same bytes reuses it. HTML pages and inline text are limited to 2 MB, and JSON document requests to 3 MB.

Check that it is ready

GET /api/v1/documents/{id} adds status, operationId, error, fileUrl and webUrl. Reading it never opens the reader, updates recent activity or starts parsing.

StatusMeaning
readyThe document can be read and used for audio.
not_startedA PDF has not been parsed yet. Opening it or requesting an audiobook starts parsing.
processingA PDF is being parsed.
failedParsing failed; error explains why.
unknownThe compute worker could not be reached. Read the status again later.

List and filter

Lists return { "data": [...], "nextCursor": "..." }. Keep requesting the returned cursor, unchanged, until it is null.

ParameterEffect
limit100 by default, 200 at most
qA literal, case-insensitive part of the filename
folderIdOne folder. Empty (folderId=) selects unfiled documents; omitted selects all.
idsUp to 200 comma-separated IDs

Documents are ordered by ID. Bulk moves and deletes also accept at most 200 IDs, and deletion always requires explicit IDs. Setting folderId to null moves a document out of its folder. Renaming or moving keeps its audio and version.

GET /api/v1/documents/{id}/chapters returns chapters in reading order. Each has title, depth (zero is top level), inclusive startOrdinal and endOrdinal, the first sentence's segmentKey, page (PDF only) and webUrl. Titles come from the document's contents or headings.

GET /api/v1/documents/{id}/search?q=&limit= finds text inside a document.

Use a segmentKey with a reader goto to jump there.

New documents are prepared first

Preparing counts toward compute limits. Until it finishes, chapters answer 409 DOCUMENT_PREPARING with retryAfterMs.

Audiobook titles use the same contents but keep their own chapter boundaries, so several audio chapters may share a title.

Folders

GET /api/v1/folders is ordered by position, creation time and ID.

ToCall
CreatePOST /api/v1/folders with name, an optional id, and optional documentIds (at most 200) to move in atomically
Rename or reorderPATCH /api/v1/folders/{id} with name and/or integer position
Delete one, or allDELETE /api/v1/folders/{id}, or DELETE /api/v1/folders

Deleting a folder keeps its documents, unfiled. Names are trimmed and limited to 200 characters. IDs are 1–100 letters, digits or hyphens. Folder write bodies are limited to 64 KB.

On this page

Edit this page