Skip to main content
POST
/
files
Upload a file
curl --request POST \
  --url https://openrouter.ai/api/v1/files \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: multipart/form-data' \
  --form file='@example-file'
{
  "created_at": "2025-01-01T00:00:00Z",
  "downloadable": false,
  "filename": "document.pdf",
  "id": "file_011CNha8iCJcU1wXNR6q4V8w",
  "mime_type": "application/pdf",
  "size_bytes": 1024000,
  "type": "file"
}

Authorizations

Authorization
string
header
required

API key as bearer token in Authorization header

Query Parameters

workspace_id
string<uuid>

Workspace to scope the request to. Defaults to the caller’s default workspace.

Example:

"a103d8b6-42f0-4e50-9a3c-bf41e2c3c1a7"

Body

multipart/form-data
file
file
required

Response

The uploaded file metadata.

Metadata describing a stored file.

created_at
string
required
downloadable
boolean
required
filename
string
required
id
string
required
mime_type
string
required
size_bytes
integer
required
type
enum<string>
required
Available options:
file