Upload a file
Files
Upload a file
POST /v1/files — upload a file and get back a reusable file_id.
POST
Upload a file
Infery’s Files API mirrors OpenAI’s Files API exactly. Upload a file, get back a
Response:
The gateway resolves the id, fetches bytes from our storage, and injects them into the provider call as inline content. Workspace-scoped: you only see files uploaded to your own workspace.
Same key within 24 h returns the original
file_id, reference it in chat completions.
Upload
Purposes
| purpose | Used for |
|---|---|
assistants | General-purpose attachment (most common) |
vision | Image inputs |
user_data | Per-user documents (RAG, analysis) |
batch | Batch inference inputs (coming soon) |
Reference in chat
Idempotency
file_id instead of uploading twice. Key format: [A-Za-z0-9_.-:]{1,255}.
Security
- MIME sniffing via magic bytes — we don’t trust
Content-Type. Mismatch → 400. - Workspace isolation — cross-workspace lookup returns 404 (we don’t leak existence).
- Private storage — GCS objects have
Cache-Control: private, max-age=0. Download only via our signed proxy. - Size and count caps — plan-based, see Plans.
- Filename sanitisation — basename stripped, control chars removed, max 255 chars.
Quotas
Your plan caps:max_file_size_bytes— single uploadmax_files_per_workspace— total countmax_storage_bytes_per_workspace— total size
X-Storage-Used-Bytes, X-Storage-Limit-Bytes, X-Files-Used, X-Files-Limit.Authorizations
API key in format: Bearer inf_***
Headers
Same key within 24h returns the originally created file instead of uploading twice. Format: [A-Za-z0-9_.-:]{1,255}
Body
multipart/form-data
Response
File uploaded successfully.
Example:
"file_1hR9xTPZqK4mVLc2nJ7fY5wB"
Example:
"file"
Example:
245192
Example:
1713204900
Example:
"report.pdf"
Available options:
assistants, vision, user_data, batch Example:
"assistants"
Example:
"processed"

