This documents the v1 product. It is kept for integrations already running
on it. If you are building something new, start with the
Quickstart.
The knowledge base is a v1 capability. v2 has no RAG yet.
application/pdf, text/plain, text/markdown, and .docx
(application/vnd.openxmlformats-officedocument.wordprocessingml.document).
Upload a document
Three steps: start a session, push the chunks, complete.1
Start a session
201 Created
totalChunks must match what you actually send. Target 10 MB per chunk.400 if the file exceeds 100 MB or the MIME type is unsupported.2
Upload each chunk
multipart/form-data with chunk (binary) and chunkIndex (zero-based).400 for a missing chunk, a negative index, or a chunk over 10 MB.
404 if the session does not exist.3
Complete
200 OK
400 if the session is not in the uploading state or is already linked to
a knowledge base.4
Poll until ready
Indexing runs in the background. Poll
GET /v1/knowledge-base/files/{knowledgeBaseId} until status is ready.Full upload, in code
- Python
- Node.js
List files
200 OK
Get one file
data. This is the endpoint you poll after complete.
Delete a collection
collectionName, not by file _id.
Detach it from the assistant first.
Writing documents that retrieve well
- Short, self-contained sections. Retrieval returns fragments, not documents. A fragment that only makes sense with the page around it is a fragment the assistant will read out wrong.
- Put the question in the text. A heading of “Return policy” retrieves worse than a line reading “How do I return an item?”.
- One fact per paragraph. Tables and multi-column PDFs chunk badly — flatten them to prose before uploading.
- Say numbers explicitly. “Returns accepted within 7 days of delivery” is retrievable; “within the standard window” is not.