Skip to main content
The Files API is an OpenAI-compatible interface for adding documents to your Ragen knowledge base and managing them over time. Files are scoped to the project the API key is bound to — every file you upload through the API lands in that project’s knowledge base and becomes immediately available to the Chat Completions endpoint once processing completes.

Endpoints

Authentication:

Upload a file

POST /v1/files — multipart form body.
file
required
The document to upload. Supported formats: PDF, DOCX, PPTX, XLSX, CSV, TXT, MD, EPUB, SRT, and common image types.
string
default:"knowledge_base"
Accepts knowledge_base (default) or assistants (OpenAI alias — treated identically). Use either value; both result in the file being added to your project’s knowledge base.
The response returns immediately with status: "uploaded". The parse and embed pipeline runs asynchronously in the background.

Processing status

Poll GET /v1/files/{id} until the file reaches a terminal status:
Do not query the knowledge base for content from a file while its status is still uploaded. The file won’t appear in retrieval results until it reaches processed.

List files

GET /v1/files — returns a paginated list of files in your project.
integer
default:"20"
Number of files to return per page. Between 1 and 100.
string
Cursor for pagination — the file ID to start after (returns files created after the given ID).
string
Filter results by purpose (knowledge_base or assistants).
Returns { "object": "list", "data": [...] } with OpenAI file objects.

Retrieve a file

GET /v1/files/{id} — returns the full OpenAI file object for a single file, or 404 if it doesn’t exist in your project.

Delete a file

DELETE /v1/files/{id} — removes the file and all associated data, including any embeddings from the vector store. Returns:

Examples

Error codes

Rate limits