Documents and Folders
Add, find, search and organize a library.
Add a document
{ "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.
| Status | Meaning |
|---|---|
ready | The document can be read and used for audio. |
not_started | A PDF has not been parsed yet. Opening it or requesting an audiobook starts parsing. |
processing | A PDF is being parsed. |
failed | Parsing failed; error explains why. |
unknown | The 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.
| Parameter | Effect |
|---|---|
limit | 100 by default, 200 at most |
q | A literal, case-insensitive part of the filename |
folderId | One folder. Empty (folderId=) selects unfiled documents; omitted selects all. |
ids | Up 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.
Chapters and search
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.
| To | Call |
|---|---|
| Create | POST /api/v1/folders with name, an optional id, and optional documentIds (at most 200) to move in atomically |
| Rename or reorder | PATCH /api/v1/folders/{id} with name and/or integer position |
| Delete one, or all | DELETE /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.