Skip to main content

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:

FieldTypeRequiredDescription
filefileYesFile to upload
tag_idsstringNoComma-separated tag IDs
metadatastringNoJSON 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:

ParameterTypeDescription
tag_idsstringComma-separated tag IDs
content_typestringFilter by MIME type
searchstringSearch filename
pageintegerPage number
per_pageintegerItems 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

PlanMax File Size
Free10 MB
Pro100 MB
Enterprise1 GB