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

For local development:

Endpoints

Upload a file

Uploads use a JSON body with a base64-encoded file field so clients can upload binary content without a multipart dependency.

Request body

Valid purposes

Example request

Example response

List files

Retrieve a file

The response includes the base64-encoded file content in the 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:
The gateway resolves file_id references to inline data before forwarding the request to the runtime.

Error codes