Knowledge base
Upload a document
POST
Uploads a file for agents to answer questions from. Indexing starts immediately. Check progress with GET /knowledge-base/jobs/{job_id}, or later with the file's index_status. A file with the same name in the same folder is replaced and indexed again.
Supported formats: PDF, DOCX, XLSX, XLS, CSV, TXT, MD, RST, PNG, JPG, and WebP, up to 50 MB. Scanned PDF pages and images are read with OCR.
To use the file on calls, add the returned id to an agent's kb_item_ids.
Requires the agents:write scope.
apiKeyheader
X-API-Key<token>Your API key, from Settings → API access in the dashboard.
multipart/form-data- body
file*fileFormat
binaryfolder?stringFolder to put it in, e.g. docs/prices. Created if missing.
Uploaded; indexing has started.
application/json- response
item?job_id?stringFormat
uuidcurl -X POST "https://example.com/knowledge-base/items" \ -F file="string"{ "item": { "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", "name": "string", "type": "file", "mime_type": "string", "size_bytes": 0, "path": "string", "parent_path": "string", "created_at": "2019-08-24T14:15:22Z", "updated_at": "2019-08-24T14:15:22Z", "index_status": "queued", "index_error": "string", "index_chunks": 0, "index_facts": 0, "index_updated_at": "2019-08-24T14:15:22Z" }, "job_id": "453bd7d7-5355-4d6d-a38e-d9e7eb218c3f"}