Intake
Ingest documents
Documents are the raw material of the knowledge base. Post markdown to /api/v1/documents and eli.ai commits the vault save, chunks, and full-text index before returning 201. Embedding and graph enrichment continue as detached work. This guide covers the full lifecycle: create, list, read, update, delete, and what the storage response does and does not guarantee.
Prerequisites
- A key with
kb:write(to create/update/delete) andkb:read(to list/read). See Getting started. - For a cross-workspace user key, an
X-Workspace-Idheader on every request.
Create a document
Supply markdown content and, normally, a vault path. The path may be omitted and derived; content may be omitted when creating a titled placeholder. The response is stored-document metadata only: docId, normalized path, content hash, and title.
/api/v1/documentsBearer · kb:writeSave markdown through the vault. The file, metadata, chunks, and full-text index commit before 201; embedding warm-up is detached and extraction is handed to the worker queue.
Request body
201 is storage readiness, not enrichment readiness
From document to graph
The 201 means the vault file, document metadata, chunks, and full-text index have committed. Embedding warm-up is started without delaying the response, and entity/relation extraction is handed to the worker queue. The create payload does not report either enrichment stage.
Extraction is what turns prose into structure: it reads the chunks, proposes entities and typed relations, and links each to the chunk it came from as a mention. Crucially, extraction reuses existing entities by normalized name — so a document that mentions "Northwind Trading Co" attaches to the same entity a prior document or a manual edit already created, rather than duplicating it. Read the model in Entity graph.
List & read
/api/v1/documentsBearer · kb:readList live, ACL-visible documents alphabetically by path. Paginate with limit/offset.
Query parameters
/api/v1/documents/{id}Bearer · kb:readFetch stored metadata plus full markdown content. missing is true when metadata exists but the vault file cannot be read. An id in another workspace is invisible under RLS → 404.
Update
PATCHrequires the complete replacement content. It commits the updated file, chunks, full-text index, revision, and audit row before responding, then starts the same detached embedding and extraction work. Extraction replaces the document's prior machine projection atomically when it runs.
/api/v1/documents/{id}Bearer · kb:writeReplace a document's markdown content. The durable save/chunk/FTS work commits before the response; enrichment is detached.
Request body
Delete
Deletion moves the file toward recoverable vault trash and commits the document tombstone, graph-provenance cleanup, chunk/vector removal, terminal revision, and audit event as one database transaction. That atomic cleanup prevents retrieval from seeing a half-deleted graph or index. See the full cascade in Export & offboarding.
/api/v1/documents/{id}Bearer · kb:writeSoft-delete a document; atomically tombstone metadata and remove graph/chunk-derived data.
Errors
400 for invalid JSON, pagination, path, or a PATCH without required content; 401 for a bad key, 403 when the key lacks kb:write, and 404 for an unknown or other-workspace id. Details in Errors & rate limits.The leverage
One POST is a document; a stream of them is a self-organizing knowledge graph. Point your CRM, ticket system, or meeting-notes pipeline at this endpoint and every artifact becomes searchable through committed FTS when it lands and available to semantic/graph retrieval as detached enrichment completes — with no schema required up front because extraction discovers the structure. Then ask questions of everything you've fed in, or curate the graph by hand where extraction needs a human's judgment.