Files API
The Files API enables uploading source documents to S3, listing files within a container, generating presigned URLs from S3 keys, and proxying presigned URLs through the backend.List Files
Retrieve all files in a specific container (folder) for your organization.Path Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
container | string | Yes | Container/folder name (e.g., ‘templates’, ‘documents’, ‘input’) |
Request Example
Response
Response Fields
| Field | Type | Description |
|---|---|---|
files | array | Array of file objects |
files[].name | string | File name |
files[].url | string | Time-limited presigned S3 URL for the file (typically expires after 1 hour). |
Status Codes
- 200 OK: Successfully retrieved file list
- 400 Bad Request: Authentication failed
- 401 Unauthorized: Missing or invalid Bearer token
- 500 Internal Server Error: S3 operation failed
Upload File
Upload a file to S3. Automatically converts DOCX to PDF (except in templates container). Validates file type by extension and MIME type.Request
Content-Type:multipart/form-data
| Parameter | Type | Required | Description |
|---|---|---|---|
file_name | string | Yes | Name to give the uploaded file |
file_content | file | Yes | Binary file content |
container | string | Yes | Container/folder name for upload |
Supported File Types
.docx- Word documents.pdf- PDF documents.csv- CSV files.xlsx- Excel spreadsheets.rtf- Rich Text Format
Request Example
Python Example
Response
Status Codes
- 200 OK: File uploaded successfully
- 400 Bad Request: File validation failure (invalid type, size, etc.)
- 401 Unauthorized: Missing or invalid Bearer token
- 500 Internal Server Error: S3 upload failed
Error Examples
Invalid File Type:Auto-Conversion: DOCX to PDF
Files uploaded as.docx are automatically converted to PDF (except in the templates container):
- Input:
document.docx - Output:
document.pdf - Exception: Files uploaded to
templatescontainer are not converted
Container Types
Common container names and their purposes:| Container | Purpose |
|---|---|
documents | Processed documents |
templates | Template files (not auto-converted) |
input | Source documents for ingestion |
output | Generated output files |
Downloading Files
GET /api/v1/files/{container} now returns presigned S3 URLs directly in files[].url. You can:
- Open/download the presigned URL directly
- Stream it through the backend proxy (
GET /api/v1/proxy/file) for browser/VPN-restricted environments
Proxy Presigned URL Through Backend
| Parameter | Type | Required | Description |
|---|---|---|---|
presigned_url | string | Yes | Fully-qualified AWS S3 presigned URL (URL-encoded in query string) |
Request Example
Notes
- Proxy route accepts only AWS S3 hosts (
amazonaws.com) - Expired presigned URLs return
410 Gone - Response is streamed binary content with the file content-type
Generate Presigned URL from S3 Key (Optional)
Use this endpoint when another API returns a raw S3 key (instead of a presigned URL).Generate Presigned URL
| Parameter | Type | Required | Description |
|---|---|---|---|
key | string | Yes | S3 object key from the file listing |
Request Example
Response
- Expires after 1 hour
- Requires no authentication to use — download directly
- Is scoped to your organization’s S3 path