Files API
Upload and manage files.
Endpoints
POST /raw-files
POST Upload a file.
curl -X POST "https://api.ofself.ai/api/v1/raw-files" \
-H "X-API-Key: your-key" \
-H "X-User-ID: user-123" \
-F "file=@document.pdf" \
-F "tag_ids=tag_documents,tag_work"
Form Fields:
| Field | Type | Required | Description |
|---|---|---|---|
file | file | Yes | File to upload |
tag_ids | string | No | Comma-separated tag IDs |
metadata | string | No | JSON string of metadata |
Response: 201 Created
{
"id": "file_a1b2c3d4",
"filename": "document.pdf",
"content_type": "application/pdf",
"size": 102400,
"owner_id": "user_123",
"tag_ids": ["tag_documents", "tag_work"],
"created_at": "2024-01-15T10:30:00Z"
}
GET /raw-files
GET List files.
curl -X GET "https://api.ofself.ai/api/v1/raw-files?content_type=application/pdf" \
-H "X-API-Key: your-key" \
-H "X-User-ID: user-123"
Query Parameters:
| Parameter | Type | Description |
|---|---|---|
tag_ids | string | Comma-separated tag IDs |
content_type | string | Filter by MIME type |
search | string | Search filename |
page | integer | Page number |
per_page | integer | Items per page |
GET /raw-files/:file_id
GET Get file metadata.
curl -X GET "https://api.ofself.ai/api/v1/raw-files/file_abc" \
-H "X-API-Key: your-key" \
-H "X-User-ID: user-123"
GET /raw-files/:file_id/download
GET Download file content.
curl -X GET "https://api.ofself.ai/api/v1/raw-files/file_abc/download" \
-H "X-API-Key: your-key" \
-H "X-User-ID: user-123" \
-o downloaded_file.pdf
Response: File binary content with appropriate Content-Type header.
PUT /raw-files/:file_id
PUT Update file metadata.
curl -X PUT "https://api.ofself.ai/api/v1/raw-files/file_abc" \
-H "X-API-Key: your-key" \
-H "X-User-ID: user-123" \
-H "Content-Type: application/json" \
-d '{
"filename": "renamed_document.pdf",
"metadata": {"category": "reports"}
}'
DELETE /raw-files/:file_id
DELETE Delete a file.
curl -X DELETE "https://api.ofself.ai/api/v1/raw-files/file_abc" \
-H "X-API-Key: your-key" \
-H "X-User-ID: user-123"
POST /raw-files/:file_id/tags
POST Add a tag to a file.
curl -X POST "https://api.ofself.ai/api/v1/raw-files/file_abc/tags" \
-H "X-API-Key: your-key" \
-H "X-User-ID: user-123" \
-H "Content-Type: application/json" \
-d '{"tag_id": "tag_work"}'
DELETE /raw-files/:file_id/tags/:tag_id
DELETE Remove a tag from a file.
curl -X DELETE "https://api.ofself.ai/api/v1/raw-files/file_abc/tags/tag_work" \
-H "X-API-Key: your-key" \
-H "X-User-ID: user-123"
File Size Limits
| Plan | Max File Size |
|---|---|
| Free | 10 MB |
| Pro | 100 MB |
| Enterprise | 1 GB |