Knowledge Base API
Knowledge Base API
Section titled “Knowledge Base API”Upload, manage, and search your bot’s knowledge base programmatically.
Upload Document
Section titled “Upload Document”POST /v1/projects/:project_id/documentsUpload a document to be processed and indexed for RAG retrieval.
Supported formats: PDF, DOCX, TXT, MD, CSV
Request: Multipart form data with the file.
Response:
{ "document_id": "doc-001", "filename": "support-faq.pdf", "status": "processing", "created_at": "2025-03-20T14:00:00Z"}List Documents
Section titled “List Documents”GET /v1/projects/:project_id/documentsReturns all documents in the project’s knowledge base.
Delete Document
Section titled “Delete Document”DELETE /v1/documents/:document_idRemove a document from the knowledge base. Associated embeddings are also deleted.
Search Knowledge Base
Section titled “Search Knowledge Base”POST /v1/projects/:project_id/searchSearch the knowledge base using semantic search.
Request body:
{ "query": "How do I reset my password?", "top_k": 5}Response:
{ "results": [ { "chunk_id": "faq-password-reset", "content": "To reset your password, go to Settings > Security...", "score": 0.92, "tags": ["account", "security"] } ]}