- Text — raw text you provide directly. Best for brand voice, short reference docs, or pasted content.
- File — uploaded files (PDF, DOCX, EPUB, TXT, MD, HTML). The server extracts text, chunks it, and embeds the chunks for vector similarity retrieval.
- URL — a public web page or document. The server fetches it, extracts text, and ingests it the same way as a file.
- A stable
idlikekndoc_<cuid2>(we diverge from ElevenLabs’s bare-UUID convention to keep IDs prefixed and self-describing). - A
name(display title, defaults to the first line of text / the uploaded filename / the page<title>). - A
folder_pathdescribing where the doc lives in your knowledge base’s folder tree (root-first ancestor chain by ID + name). metadata.size_bytes(the doc’s raw text size in bytes), plus ISO-8601created_atandupdated_attimestamps.- A
typeoftext,file, orurl. - A
statusofpending,processing,ready, orfailed. A document only becomes retrievable via search and/chunksonce it reachesready. Documents created through the API today staypendinguntil a follow-up wires up server-side chunk + embed indexing (the existing path that runs from the Knowledge Base UI is not yet shared with the API).
Creating documents
Three POST endpoints:POST /v1/knowledge-base/documents/from-text— JSON body withtext, optionalnameandfolder_id.POST /v1/knowledge-base/documents/from-file— multipart form with afilefield (max 25 MB), plus optionalnameandfolder_id. Currently returns 501 Not Implemented. The route shape is stable but the server-side file-ingestion pipeline (PDF/DOCX/EPUB/TXT extraction + blob storage + chunking) ships in a follow-up. Use the Knowledge Base UI to upload files in the meantime.POST /v1/knowledge-base/documents/from-url— JSON body withurl(http(s) only), optionalnameandfolder_id. The server fetches the URL, validates safety (SSRF guard, size cap, content-type allow-list), and extracts text.
Reading documents
GET /v1/knowledge-base/documents— paginated list with optional filters (folder_id,idsfor batch-get,types,search). Cursor pagination via the opaquecursorquery param.GET /v1/knowledge-base/documents/:id— full document object.GET /v1/knowledge-base/documents/:id/content— raw text astext/plain.GET /v1/knowledge-base/documents/:id/chunks— paginated chunks of the doc after splitting + embedding.GET /v1/knowledge-base/documents/:id/chunks/:chunkId— one chunk by ID.GET /v1/knowledge-base/documents/:id/source-file-url— pre-signed URL (or redirect) to the doc’s blob storage entry.GET /v1/knowledge-base/documents/:id/agents— agents that depend on this document.
Updating documents
PATCH /v1/knowledge-base/documents/:id— rename and/or move to a different folder. Body:{ name?, folder_id? }. Passfolder_id: nullto move to root.PATCH /v1/knowledge-base/documents/:id/file— replace the source file for a file-typed document. Re-chunks and re-embeds transactionally. Returns 400 for non-file-typed docs. Currently returns 501 Not Implemented alongsidePOST /from-file(same follow-up).POST /v1/knowledge-base/documents/:id/refresh— re-fetches the source URL for a URL-typed document, re-extracts text, replaces chunks. Returns 400 for non-URL-typed docs.
Deleting documents
DELETE /v1/knowledge-base/documents/:id— hard delete. Chunks are cascade-deleted via the database constraint; any agent attachments through this document are also cleaned up.
Searching
GET /v1/knowledge-base/search— vector similarity search over the org’s indexed chunks. Returns documents sorted by relevance with ascore(0-1, higher is better) and asearch_snippet(the matched chunk content, trimmed to 300 chars). Filters:types.
Stats
GET /v1/knowledge-base/size—{ size_bytes, document_count, chunk_count }for the org’s knowledge base.
Differences from ElevenLabs
Three documented divergences, surfaced explicitly:- ID format —
kndoc_<cuid2>instead of bare UUID. Our convention prefixes every entity ID with a short type marker for log readability and forwards-compat with multi-tenant routing. - Timestamps — ISO-8601 strings (
"2026-05-21T11:00:00.000Z") instead of*_unix_secsintegers. Easier to read; standard for modern API consumers. access_infoomitted — ElevenLabs returns a per-documentaccess_infoobject. We don’t have per-document ACLs — organisations are the access boundary — so we omit the field rather than return a misleading stub.
GET /v1/knowledge-base/sizereturns{ size_bytes, document_count, chunk_count }. ElevenLabs’s equivalent returns{ number_of_pages }(a tokens/pages metric specific to their billing model). We expose the underlying real units.