Skip to main content
POST
Upload a file
Infery’s Files API mirrors OpenAI’s Files API exactly. Upload a file, get back a file_id, reference it in chat completions.

Upload

Response:

Purposes

Reference in chat

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.

Idempotency

Same key within 24 h returns the original 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 upload
  • max_files_per_workspace — total count
  • max_storage_bytes_per_workspace — total size
Response headers show your current usage: X-Storage-Used-Bytes, X-Storage-Limit-Bytes, X-Files-Used, X-Files-Limit.

Authorizations

Authorization
string
header
required

API key in format: Bearer inf_***

Headers

Idempotency-Key
string

Same key within 24h returns the originally created file instead of uploading twice. Format: [A-Za-z0-9_.-:]{1,255}

Body

multipart/form-data
file
file
required

Binary file contents.

purpose
enum<string>
required

Intended use of the file.

Available options:
assistants,
vision,
user_data,
batch

Response

File uploaded successfully.

id
string
Example:

"file_1hR9xTPZqK4mVLc2nJ7fY5wB"

object
string
Example:

"file"

bytes
integer
Example:

245192

created_at
integer
Example:

1713204900

filename
string
Example:

"report.pdf"

purpose
enum<string>
Available options:
assistants,
vision,
user_data,
batch
Example:

"assistants"

status
string
Example:

"processed"