File Upload
Directly upload files
Configure via UI
Configure via API / Client
- Python Client
- TypeScript Client
- curl
with open('<file-path>', 'rb') as f:
file = client.files.upload_file(upload_file=f)
import fs from "fs"
const filePath = "node_modules/llamaindex/examples/abramov.txt";
file = await client.files.uploadFile(project.id, fs.createReadStream(filePath))
# Step 1: Generate a presigned URL for file upload
curl -X POST "https://api.cloud.llamaindex.ai/api/v1/files/presigned-url" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $LLAMA_CLOUD_API_KEY" \
-d '{
"name": "example.txt"
}'
# Step 2: Use the presigned URL to upload the file to S3 within 30 seconds
curl -X PUT "https://your-presigned-url-from-step-1" \
-H "Content-Type: text/plain" \
-F 'file=@path/to/your/example.txt'
# Step 3: Confirm the file upload with LlamaCloud
curl -X PUT "https://api.cloud.llamaindex.ai/api/v1/files/sync" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $LLAMA_CLOUD_API_KEY"