Upload, generate, list, and manage documents. Supports PDF, DOCX, TXT, and Markdown with automatic AI indexing.
/documents/uploadUpload a document file to a knowledge base. The document is automatically processed and indexed by AI for search.
filefile*The document file (PDF, DOCX, TXT, MD).knowledgeDbIdstring*Target knowledge base ID.messagestringUpload confirmation.documentIdstringUnique document identifier.filenamestringOriginal filename.statusstringProcessing status (e.g., "processing").// POST /documents/upload // Content-Type: multipart/form-data // Authorization: Bearer <idToken> // x-api-key: <apiKey> FormData: file: <binary> knowledgeDbId: "kb_abc123"
/documents/generateGenerate a new document using AI based on a prompt. The generated document is automatically added to the knowledge base.
knowledgeDbIdstring*Target knowledge base ID.promptstring*Prompt describing the document to generate.titlestringOptional title for the generated document.// POST /documents/generate
{
"knowledgeDbId": "kb_abc123",
"prompt": "Write a summary of machine learning basics",
"title": "ML Basics"
}/documentsRetrieve all documents in a knowledge base.
documentsarrayArray of document objects.countnumberTotal document count.// GET /documents?knowledgeDbId=kb_abc123
// 200 OK
{
"documents": [
{
"documentId": "doc_xyz789",
"filename": "report.pdf",
"status": "completed",
"fileSize": 245760,
"chunkCount": 12,
"createdAt": "2026-01-15T10:30:00Z"
}
],
"count": 1
}/documents/{documentId}Retrieve a specific document by its ID.
// GET /documents/{documentId}
// 200 OK
{
"documentId": "doc_xyz789",
"filename": "report.pdf",
"status": "completed",
"fileSize": 245760,
"chunkCount": 12,
"createdAt": "2026-01-15T10:30:00Z"
}/documents/{documentId}Delete a document and its associated embeddings from the knowledge base.
// DELETE /documents/{documentId}
// Authorization: Bearer <idToken>
// x-api-key: <apiKey>/documents/reindexRe-process and re-index a document. Useful if indexing failed or you want to refresh the embeddings.
documentIdstring*ID of the document to reindex.// POST /documents/reindex
// Authorization: Bearer <idToken>
// x-api-key: <apiKey>
{
"documentId": "doc_xyz789"
}