packages/cloud-frontend/content/api/documents.mdx
import { Callout, Tabs } from "@/docs/components";
Upload documents and query your knowledge base for RAG applications.
Upload one or more documents to your knowledge base using multipart form data.
Use multipart/form-data with the files field:
curl -X POST "https://elizacloud.ai/api/v1/documents/upload-file" \
-H "Authorization: Bearer YOUR_API_KEY" \
-F "[email protected]" \
-F "characterId=optional_agent_id"
| Parameter | Type | Required | Description |
|---|---|---|---|
files | file[] | ✓ | One or more files to upload (max 5) |
characterId | string | Associate with a specific agent |
| Limit | Value |
|---|---|
| Max file size | 5 MB per file |
| Max files per batch | 5 files |
| Max total batch size | 5 MB |
| Format | Extensions |
|---|---|
.pdf | |
| Text | .txt, .md |
| Documents | .doc, .docx |
| Web | .html |
| Data | .json, .csv |
{
"success": true,
"data": [
{
"id": "doc_abc123",
"filename": "document.pdf",
"type": "application/pdf",
"size": 1048576,
"uploadedAt": 1705312800000,
"fragmentCount": 42,
"status": "success"
}
],
"message": "Successfully uploaded 1 file(s)",
"successCount": 1,
"failedCount": 0,
"totalCount": 1
}
Get all documents in your knowledge base.
{
"documents": [
{
"id": "doc_abc123",
"name": "company-handbook.pdf",
"size": 2097152,
"chunks": 85,
"createdAt": "2024-01-15T10:30:00Z"
}
],
"total": 15
}
Search your knowledge base.
{
"query": "How do I reset my password?",
"limit": 5,
"minScore": 0.7
}
| Parameter | Type | Required | Description |
|---|---|---|---|
query | string | ✓ | Search query |
limit | integer | Max results (default: 5) | |
minScore | number | Minimum similarity (0-1) |
{
"results": [
{
"content": "To reset your password, go to Settings > Security > Reset Password...",
"score": 0.92,
"documentId": "doc_abc123",
"documentName": "user-guide.pdf"
}
]
}
Get document details.
Remove a document from your knowledge base.
Check whether an agent or character has documents.
<Callout type="info"> Documents are stored in the runtime documents table and chunked for search. </Callout>