Request
Content-Type:multipart/form-data
The POST request should be a multipart form request containing the file to be uploaded.
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
Upload PDF or text files to be processed and chunked for embedding search.
multipart/form-data
The POST request should be a multipart form request containing the file to be uploaded.
| Name | Type | Required | Description |
|---|---|---|---|
| chunk_size | integer | No | The chunk size (in tokens) applied when splitting the document |
| chunk_overlap | integer | No | The chunk overlap (in tokens) applied when splitting the document |
const formData = new FormData();
formData.append("file", files[0]); // Accepts PDF (.pdf) or text (.txt) files
const response = await fetch("https://rag-api-llm.up.railway.app/upload_file", {
method: "POST",
headers: {
"authorization": apiKey,
},
body: formData,
});
{
"success": true,
"message": "PDF file processed successfully",
"file_id": "4db6b5d7-b199-4bfd-9914-6991cb4ba3b6",
"file_name": "elon_musk.txt",
"chunks": 2,
"chunk_size": 1000,
"chunk_overlap": 200
}
{
"success": false,
"error": {
"message": "Invalid file type. Only PDF and TXT files are supported",
"code": "invalid_file_type"
}
}
{
"success": false,
"error": {
"message": "File size exceeds maximum limit of 10MB",
"code": "file_too_large"
}
}
{
"success": false,
"error": {
"message": "Invalid API key provided",
"code": "unauthorized"
}
}
