Endpoints
Documents
API reference for uploading, managing, and searching documents in your knowledge bases.
Overview
The Documents API lets you upload files, track processing status, manage document metadata, and search through document content. Documents are automatically chunked and embedded for semantic retrieval by your AI agent.
Upload Document
POST /workspaces/{workspaceId}/documents — Upload a document as multipart/form-data. Include the file in the "file" field and optionally specify a knowledgeBaseId. Supported formats: PDF, DOCX, XLSX, TXT, CSV, and Markdown. Maximum file size depends on your plan. The response returns the document object with status "pending".
Pre-scan for Sensitive Data
POST /workspaces/{workspaceId}/documents/pre-scan — Scan a file before upload to detect sensitive data (API keys, passwords, credit card numbers). Returns detected items with confidence levels (high, medium, low) and locations. Use this to warn users before uploading files with potentially sensitive content.
List Documents
GET /workspaces/{workspaceId}/documents — Retrieve all documents in a workspace. Filter by knowledge base, status (pending, processing, completed, failed), or search by name. Returns paginated results with document metadata including size, page count, chunk count, and processing status.
Get Document Chunks
GET /workspaces/{workspaceId}/documents/{documentId}/chunks — Retrieve the processed chunks of a document. Each chunk includes the text content, position, and embedding metadata. Useful for debugging retrieval quality or building custom search interfaces.
Bulk Operations
POST /workspaces/{workspaceId}/documents/bulk-move — Move multiple documents to a different knowledge base. POST /workspaces/{workspaceId}/documents/bulk-delete — Delete multiple documents at once. Both endpoints accept an array of document IDs.