Skip to main content

Files API

Upload and manage files.

Files are now Nodes

Files in the Paradigm SDK are stored and managed as nodes. File-specific permissions (file_permissions) have been removed. Access to file data is controlled through tag permissions and schema permissions on the user's exposure profile, just like any other node.

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" \
-F 'metadata={"category":"reports"}'

Form Fields:

FieldTypeRequiredDescription
filefileYesFile to upload
tag_idsstringNoComma-separated tag IDs
metadatastringNoJSON string of metadata
data_typestringNoOptional; inferred if omitted (document/image/audio/video/text)
formatstringNoOptional; inferred from filename/MIME type if omitted (pdf, jpg, ...)
structure_typestringNoOptional; defaults to unstructured

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
data_typestringFilter by data type (document, image, audio, video, text)
content_typestringFilter by MIME type
tag_idstringFilter by single tag ID
tag_idsstringComma-separated tag IDs (match ANY)
pageintegerPage number (optional)
per_pageintegerItems per page (optional)
limitintegerLimit (optional, alternative pagination)
offsetintegerOffset (optional, alternative pagination)

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