RAG
POST /rag/upload
Upload and index documents for retrieval-augmented generation
POST
Overview
Uploads one or more files, extracts their text, splits it into chunks, generates embeddings, and stores everything in the workspace’s RAG index so it can be queried via/rag/query.
Authentication
Bearer token from an authenticated Supabase session. See the note on RAG auth.
Request
Content type:multipart/form-data
One or more files to upload, as
files[] form fields.UUID of the workspace to associate the documents with. The workspace’s RAG index is auto-provisioned on first upload if it doesn’t already exist.
Supported File Types
| Type | MIME type | Max size |
|---|---|---|
| Plain text | text/plain (or .txt) | 100 MB |
| Markdown | text/markdown (or .md) | 100 MB |
| CSV | text/csv | 100 MB |
| JSON | application/json | 100 MB |
application/pdf | 100 MB | |
| Word | application/vnd.openxmlformats-officedocument.wordprocessingml.document | 100 MB |
Documents are split into ~1000-character chunks along sentence boundaries. CSV files are converted to structured text (with column headers preserved) before chunking.
Response
"success"e.g.
"Processed 3 files"ISO 8601
Errors
| Status | Error | Cause |
|---|---|---|
| 400 | workspace_id is required | Missing workspace_id field |
| 400 | At least one file is required | No files in files[] |
| 400 | File {name} exceeds maximum size of 100MB | File too large |
| 400 | File type {type} not supported for {name} | Unsupported MIME type |
| 401 | Authentication required | Missing/invalid session |
| 403 | Access denied to workspace | Caller isn’t a member of the workspace |
| 500 | Failed to upload files | Processing error (see details in response) |
Partial success is allowed — some files can fail while others succeed. Check
results.details[].status for each file.