Upload a file
Upload a file to the caller's storage. The body is
multipart/form-data with a required file field and optional
purpose label.
The upload is streamed straight into object storage (no gateway
buffering). Hard cap: 500 MB per file. Any MIME is accepted;
the server classifies the row as image, video, audio, or
file based on the Content-Type.
Uploads count against the account's 5 GB storage quota. Overages still upload successfully but are retained only 24 h.
Authorization
BearerAuth API key authentication (OpenAI format). Pass in the Authorization header:
Authorization: Bearer tr-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
In: header
Request Body
multipart/form-data
TypeScript Definitions
Use the request body type in TypeScript.
Response Body
application/json
application/json
application/json
application/json
application/json
curl -X post "https://api.xrtoken.ai/v1/files" \ -F file="string"{
"id": "string",
"object": "file",
"bytes": 0,
"created_at": 0,
"filename": "string",
"purpose": "string",
"mime_type": "string",
"type": "image",
"url": "string",
"expires_at": 0
}{
"error": "model field is required",
"type": "invalid_request_error"
}{
"error": "invalid or missing API key",
"type": "auth_error"
}{
"error": "string",
"type": "invalid_request_error"
}{
"error": "string",
"type": "invalid_request_error"
}