Loading...
Loading...
Manage documents in your workspace. Upload files for automatic parsing, chunking, and embedding. Supported formats: PDF, DOCX, TXT, HTML, Markdown, and more.
/api/documentsSend the file as multipart/form-data with field name file.
curl -X POST https://your-domain.com/api/documents \
-H "Authorization: Bearer sk-your-api-key" \
-F "file=@report.pdf"{
"id": "doc_abc123",
"name": "report.pdf",
"status": "processing",
"createdAt": "2025-01-15T10:30:00Z"
}The document is processed asynchronously by Inngest. Check status via GET /api/documents/:id.
/api/documents{
"documents": [
{
"id": "doc_abc123",
"name": "report.pdf",
"status": "completed",
"chunkCount": 47,
"createdAt": "2025-01-15T10:30:00Z",
"ingestionJob": {
"status": "completed",
"errorCategory": null
}
}
]
}/api/documents/:id{
"id": "doc_abc123",
"name": "report.pdf",
"status": "completed",
"chunkCount": 47,
"createdAt": "2025-01-15T10:30:00Z",
"ingestionJob": {
"id": "job_xyz",
"status": "completed",
"errorCategory": null,
"startedAt": "2025-01-15T10:30:01Z",
"completedAt": "2025-01-15T10:30:28Z"
}
}When ingestion fails, the errorCategory field indicates why:
PARSE_ERROR — Document could not be parsed (corrupt file, unsupported format)EMBEDDING_ERROR — Embedding provider failed (API key, rate limit, dimension mismatch)SIZE_LIMIT — Document exceeds workspace size limitsOCR_FAILURE — OCR failed on scanned contentNETWORK_ERROR — Network connectivity issue during processing/api/documents/:id{
"success": true,
"message": "Document deleted"
}/api/documents/:id/re-ingestRetries ingestion for a failed document, or re-processes a successfully ingested document. Existing chunks are replaced with new ones.