Upload a document
POST /v1/knowledge-bases/{kb_id}/documents
Upload a file to a knowledge base. The document is processed asynchronously through the ingestion pipeline: parse, chunk, embed, index.
Returns immediately with a 202 Accepted response containing the document record in pending status.
Poll the document detail endpoint or register a webhook to be notified when processing completes.
Supported file types:
- Tier 1 (parsed via external service): PDF, DOCX, PPTX, XLSX, PNG, JPG, JPEG, WEBP, TIFF
- Tier 2 (direct ingestion, no parsing cost): TXT, MD, HTML, HTM, CSV, TSV, JSON
Limits: Max file size 50 MB.
Authorizations
Section titled “Authorizations ”Parameters
Section titled “ Parameters ”Path Parameters
Section titled “Path Parameters ”Example
kb_a1b2c3d4e5Knowledge base ID
Request Body required
Section titled “Request Body required ”object
The file to upload. Max 50 MB. Allowed extensions: pdf, docx, pptx, xlsx, png, jpg, jpeg, webp, tiff, txt, md, html, htm, csv, tsv, json.
Optional JSON string of arbitrary metadata to attach to the document. This metadata is filterable at search time.
Example
{"department": "engineering", "version": 2}Responses
Section titled “ Responses ”Document accepted for processing
object
object
Document ID (prefixed with doc_)
Example
doc_f6g7h8i9j0Parent knowledge base ID
Example
kb_a1b2c3d4e5Owning account ID
Example
acc_x9y8z7w6v5Original file name
Example
product-guide.pdfFile extension
Example
pdfFile size in bytes
Example
2048576Number of pages (for Tier 1 files, set after parsing)
Example
15Number of chunks generated from this document
Example
34Error message if status is failed
User-supplied metadata (filterable at search time)
object
Example
{ "department": "engineering", "version": 2}Internal storage path
Example
acc_x9y8z7w6v5/kb_a1b2c3d4e5/doc_f6g7h8i9j0/product-guide.pdfExample
2026-02-10T12:00:00.000ZExample
2026-02-10T12:01:30.000ZRequest validation failed
object
object
Machine-readable error code
Example
VALIDATION_ERRORHuman-readable error message
Example
Invalid request bodyAdditional error details (e.g., validation issues)
object
Example
{ "error": { "code": "VALIDATION_ERROR", "message": "Invalid request body", "details": { "issues": [ { "path": [ "name" ], "message": "Required" } ] } }}Authentication failed or missing
object
object
Machine-readable error code
Example
VALIDATION_ERRORHuman-readable error message
Example
Invalid request bodyAdditional error details (e.g., validation issues)
object
Example
{ "error": { "code": "AUTHENTICATION_ERROR", "message": "Invalid or missing API key" }}Resource not found
object
object
Machine-readable error code
Example
VALIDATION_ERRORHuman-readable error message
Example
Invalid request bodyAdditional error details (e.g., validation issues)
object
Example
{ "error": { "code": "NOT_FOUND", "message": "KnowledgeBase not found: kb_nonexistent" }}Rate limit or usage limit exceeded
object
object
Machine-readable error code
Example
VALIDATION_ERRORHuman-readable error message
Example
Invalid request bodyAdditional error details (e.g., validation issues)
object
Examples
Rate limit exceeded
{ "error": { "code": "RATE_LIMIT_EXCEEDED", "message": "Rate limit exceeded" }}Page usage limit exceeded
{ "error": { "code": "USAGE_LIMIT_EXCEEDED", "message": "Usage limit exceeded for pages_processed. Upgrade your plan or wait for the next billing period.", "details": { "limit": 1000, "current_usage": 998, "plan": "starter", "requested": 5 } }}