API Reference
Upload documents
POST /api/v1/knowledge-bases/:knowledgeBaseId/documents — add files to a Knowledge Base.
Uploads one or more files. Each one is extracted, chunked, embedded and indexed in the background; the call returns as soon as the files are accepted. Follow their progress with List documents.
POST /api/v1/knowledge-bases/{knowledgeBaseId}/documents
Content-Type: multipart/form-dataForm fields
| Field | Type | Required | Description |
|---|---|---|---|
files | file, repeated | Yes | One part per file. At most 10 files per request and 50 MB per file. |
chunkingStrategy | string | No | fixed (default), recursive, token, semantic, late, row or json. See Documents. |
chunkSize | integer | No | Target chunk size. Default 1000. |
overlap | integer | No | Overlap between chunks. Default 200. |
metadata | JSON string | No | Metadata applied to every file in this request, validated against the Knowledge Base's metadata fields. |
Response
202 Accepted
{
"documents": [{ "documentId": "9d0a…", "filename": "pump-x200.pdf", "status": "PENDING" }]
}Errors
| Status | error | When |
|---|---|---|
400 | invalid_request | No files part, an unsupported file type, or chunking settings the service refuses. |
403 | forbidden | Your key is scoped to a different project. |
404 | not_found | No such Knowledge Base in your organization. |
413 | payload_too_large | A file is over 50 MB. |
413 | too_many_files | More than 10 files in one request. Send the rest in another request. |
415 | unsupported_media_type | The request is not multipart/form-data. |
Example
curl -X POST https://api.elizon.ai/api/v1/knowledge-bases/4f1c…/documents \
-H "X-API-Key: elz_your_key_here" \
-F "files=@pump-x200.pdf" \
-F "files=@pump-x300.pdf" \
-F "chunkingStrategy=recursive"