Knowledge API
Libraries, collections, and documents that make up the knowledge base.
List collections
With `applicationId` the list contains the collections attached to that application, otherwise every collection of the caller’s company that the caller can see. `libraryId` narrows either list to one library. Only ACTIVE collections are returned.
Create collection
Body: `{ name, description?, icon?, isPrivate?, libraryId }`. Validation failures answer `400 { error: 'Validation failed', details }`.
Get collection
Returns one ACTIVE collection in the same item shape as the `GET /api/collections/` list. Access follows the shared collection visibility rules (owner, member, application member, or public).
Update collection
Updates any subset of `name`, `description`, `icon`, and `isPrivate`; `libraryId` moves the collection to another library. Moving into a private library also makes the collection (and its documents) private.
Archive collection
Soft delete: archives the collection together with its documents and repositories. Archived collections disappear from every listing and their knowledge stops being retrievable.
List libraries
With `applicationId` the list contains the libraries of the collections attached to that application, otherwise every library of the caller’s company that the caller can see. The company-wide list is served from cache.
Create library
Body: `{ name, isPrivate? }`. Validation failures answer `400 { error: 'Validation failed', details }`.
Get document
Returns one document with its user, collection, and summarized knowledge entries. Documents outside the caller’s visibility answer 404.
Rename document
Updates the user-facing filename and/or title of a document. The stored file extension is preserved, and an empty `title` clears the user-defined title. Requires write access to the document’s collection.
Delete document
Soft delete: the document is archived and its knowledge entries stop being retrievable. Requires write access to the document’s collection.
Get document status
Intended for polling after an upload: the status moves from `QUEUED` through `PROCESSING` to `COMPLETED` or `FAILED` once ingestion finishes. The response is never cached.
Get extracted text content of document
Returns the parsed text of a processed document as ordered chunks. For audio and video documents each chunk is the transcription of one time window, with `startOffsetSec`/`endOffsetSec` locating it on the media timeline. Content is only returned once ingestion is `COMPLETED` — poll `GET /api/v1/documents/{id}/status/` first; any other status (including `FAILED`) answers an empty `chunks` page. A file that was stored without entering the knowledge pipeline (an AI-generated file while 'Search Generated Files' is off) is `COMPLETED` with an empty page and `knowledgeIngestion: 'skipped'`, so an empty result is never mistaken for an empty file.
List document threads
`limit` is clamped to 1-100 (default 50) and `page` is 1-based (values below 1 are treated as 1).
Copy document to collection
Takes the source document id as the `id` path parameter and a JSON body `{ collectionId }` (destination collection). The copy is a new document: it starts QUEUED and is ingested again, which spends budget, and the original stays where it was. To relocate a document instead, keeping its knowledge and paying nothing, use moveDocumentToCollection. Failure responses other than the invalid-id 400 are plain-text bodies.
Move document to another collection
Moves an uploaded document into another collection of the same company, optionally into one of its manual folders. The document keeps its id, status and knowledge: nothing is re-ingested and no budget is spent, unlike exportDocumentToCollection, which copies the file into a new QUEUED document and leaves the original behind. The document takes the privacy of the destination collection. Connector-synced documents cannot be moved (the next sync run would recreate them at the source). Requires write access to both collections.
Generate collection embeddings
Optional body: `{ generateText?, generateMultimodal?, force?, batchSize? }`. Returns immediately with the number of entries queued; generation continues in the background.
List documents
One page of the collection documents, most recently updated first. When `search` is set, the page is ranked by semantic similarity to the query instead. Requires read access to the collection.
Upload documents
Multipart upload of one or more files into a collection. Plain multipart posts of the `files` field work for any file that fits in one request; `folderId` files every file into one manual folder, and `folderIds` (comma-separated, one entry per file in order, empty for the root) files each into its own, so one request can mirror a directory tree. One request carries at most the single-request ceiling of the infrastructure in front of the platform (`maxRequestSizeInMBytes` in the createDocumentUploadUrl response, 100MB on the hosted platform); a bigger body answers 413 with `code: 'upload/request-too-large'` and `useChunkedUpload: true`. Files up to the plan limit go through the resumable chunked protocol: POST each 5MB chunk as `files` with the `X-Chunk-Index`, `X-Total-Chunks`, `X-Chunk-Size`, `X-Total-File-Size`, `X-File-Name`, `X-File-Type` and `X-Resume-Token` headers (see `src/shared/chunked-upload.ts`); the last chunk answers with the created document. A multipart body the server cannot parse answers 400 with `code: 'upload/malformed-multipart'`; an exhausted plan budget or quota answers 402 with `code: 'budget-exceeded'` or `code: 'quota-exceeded-<quota>'`. Requires write permission on the collection.
List folders of collection
The collection folders as a flat list; parentId links assemble the tree. Connector-synced folders (isSynced) mirror a provider and cannot be renamed, deleted, or written to; manual folders can. Requires read access to the collection.
Create folder in collection
Creates a manual folder at the collection root, or inside another manual folder via parentFolderId. Connector-synced folders cannot hold manual folders — the connector owns that subtree. The response carries the created folder under `folder`, in the same shape listCollectionFolders returns, plus its id as `folderId`. Requires write access to the collection.
Rename manual folder
Renames a manual folder. Connector-synced folders mirror the provider and cannot be renamed. Requires write access to the collection.
Delete manual folder
Deletes a manual folder. The documents and subfolders inside it move to the collection root — nothing is deleted with the folder. Connector-synced folders cannot be deleted here; unlink the connector instead. Requires write access to the collection.
Move document into folder
Moves an uploaded document into a manual folder, or to the collection root with a null folderId. Connector-synced documents cannot be moved — their location mirrors the provider and the next sync run would move them back. Requires write access to the collection.
Create upload URL
The two-step upload for callers that cannot send multipart/form-data (MCP hosts, plain scripts): this operation returns a short-lived, single-use URL, and sending the raw file bytes to it with PUT ingests the file into the collection exactly like a regular upload. The URL inherits the permissions of whoever created it. The response reports two ceilings: `maxFileSizeInMBytes`, the company plan's document size limit, and `maxRequestSizeInMBytes`, the most one request may carry through the infrastructure in front of the platform. A file between the two must go through the resumable chunked protocol of `uploadCollectionDocuments` (see the getDocanaHelp uploads guide): the upload URL itself only enforces the plan limit, so a bigger body is refused by the edge, not by a JSON 413 from the platform.
Send upload file bytes
Second step of the two-step upload: PUT the raw file bytes to the URL returned by `createDocumentUploadUrl`. The URL is single-use and expires; no authentication header is required because the URL itself is the credential.
Download document
Streams the document bytes. `size` (e.g. `SMALL`, `MEDIUM`, `LARGE`, `WHATSAPP`) serves a resized variant for images; `pdfPreviewType=image` serves a PDF page rendered as an image. The response content type follows the stored file.