Skip to main content
POST
Upload a document file and optionally process it for embedding into a knowledge base. The file is chunked, embedded, and stored in the vector database for semantic search.

Request

Form Data

file
required
The document file to upload. Supported formats depend on your configuration (PDF, DOCX, TXT, Markdown, etc.)
string | object
JSON string or object with additional metadata about the file. Can include custom fields for your application.

Query Parameters

boolean
default:"true"
Whether to process the file for RAG (extract text, chunk, and embed)
boolean
default:"true"
Whether to process the file asynchronously in the background

Headers

string
required
Bearer token for authentication

Response

boolean
Whether the upload was successful
string
Unique identifier for the uploaded file
string
Original filename of the uploaded file
string
Storage path of the uploaded file
object
File processing data
string
Processing status: “pending”, “completed”, or “failed”
string
Extracted text content (after processing)
string
Error message if processing failed
object
File metadata
string
Display name of the file
string
MIME type of the file
integer
File size in bytes
object
Custom metadata provided during upload
string
ID of the user who uploaded the file
integer
Unix timestamp when the file was uploaded
integer
Unix timestamp when the file was last updated

Add File to Knowledge Base

After uploading a file, add it to a knowledge base:

Request Body

string
required
ID of the uploaded file to add to the knowledge base

Batch Upload Files

Upload multiple files to a knowledge base at once:

Request Body

Processing Pipeline

  1. Upload: File is stored and assigned a unique ID
  2. Extraction: Text content is extracted based on file type (PDF, DOCX, etc.)
  3. Chunking: Content is split into chunks (configured via CHUNK_SIZE and CHUNK_OVERLAP)
  4. Embedding: Each chunk is embedded using the configured embedding model
  5. Storage: Embeddings are stored in the vector database for retrieval

Monitoring Processing Status

Check the processing status of a file:
This returns a Server-Sent Events (SSE) stream with status updates:

Notes

  • Supported file types are configurable via ALLOWED_FILE_EXTENSIONS
  • Maximum file size is controlled by FILE_MAX_SIZE setting
  • Processing extracts text using various engines (PyMuPDF, Tika, Docling, etc.)
  • Audio files are transcribed using the configured STT engine
  • Files are automatically chunked and embedded if process=true