Overview
The Files API lets you upload files that can be referenced by chat-completion requests, batch jobs, agents, and sessions. Files are stored in the gateway database with a purpose and a detected content type. Retrieval returns the file metadata plus the base64-encoded bytes.Base URL
Endpoints
Upload a file
Uploads use a JSON body with a base64-encodedfile field so clients can upload binary content without a multipart dependency.
Request body
Valid purposes
Example request
Example response
List files
Retrieve a file
data field.
Delete a file
Content types
The gateway detects the MIME type from the filename extension:Using files in completions
Reference an uploaded file by id in a chat-completion message part:file_id references to inline data before forwarding the request to the runtime.
Error codes
Related pages
- Chat Completions — reference files in messages
- Batches — use files as batch inputs
- Embeddings — embed text from files