Skip to main content
POST
/
api
/
v1
/
rag
/
upload
curl -X POST https://suite.sundaypyjamas.com/api/v1/rag/upload \
  -H "Authorization: Bearer <supabase_access_token>" \
  -F "workspace_id=9d4c1a2e-..." \
  -F "[email protected]" \
  -F "[email protected]"
{
  "status": "success",
  "message": "Processed 2 files",
  "results": {
    "successful": 2,
    "failed": 0,
    "details": [
      { "documentId": "doc_1a2b...", "chunks": 14, "status": "completed" },
      { "documentId": "doc_3c4d...", "chunks": 6, "status": "completed" }
    ]
  },
  "workspace_id": "9d4c1a2e-...",
  "timestamp": "2026-07-08T10:00:00Z"
}

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

Authorization
string
required
Bearer token from an authenticated Supabase session. See the note on RAG auth.

Request

Content type: multipart/form-data
files
File[]
required
One or more files to upload, as files[] form fields.
workspace_id
string
required
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

TypeMIME typeMax size
Plain texttext/plain (or .txt)100 MB
Markdowntext/markdown (or .md)100 MB
CSVtext/csv100 MB
JSONapplication/json100 MB
PDFapplication/pdf100 MB
Wordapplication/vnd.openxmlformats-officedocument.wordprocessingml.document100 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

status
string
"success"
message
string
e.g. "Processed 3 files"
results
object
workspace_id
string
timestamp
string
ISO 8601
curl -X POST https://suite.sundaypyjamas.com/api/v1/rag/upload \
  -H "Authorization: Bearer <supabase_access_token>" \
  -F "workspace_id=9d4c1a2e-..." \
  -F "[email protected]" \
  -F "[email protected]"
{
  "status": "success",
  "message": "Processed 2 files",
  "results": {
    "successful": 2,
    "failed": 0,
    "details": [
      { "documentId": "doc_1a2b...", "chunks": 14, "status": "completed" },
      { "documentId": "doc_3c4d...", "chunks": 6, "status": "completed" }
    ]
  },
  "workspace_id": "9d4c1a2e-...",
  "timestamp": "2026-07-08T10:00:00Z"
}

Errors

StatusErrorCause
400workspace_id is requiredMissing workspace_id field
400At least one file is requiredNo files in files[]
400File {name} exceeds maximum size of 100MBFile too large
400File type {type} not supported for {name}Unsupported MIME type
401Authentication requiredMissing/invalid session
403Access denied to workspaceCaller isn’t a member of the workspace
500Failed to upload filesProcessing error (see details in response)
Partial success is allowed — some files can fail while others succeed. Check results.details[].status for each file.