Skip to main content

POST /v1/files

Upload a file that can be used across various endpoints. The file size limit is 512 MB.

Authentication

Requires provider authentication headers:

Request

Headers

string
required
The provider to route the request to (e.g., openai, azure-openai)
string
required
Bearer token for the provider API
string
Optional config for routing, retries, fallbacks

Body (multipart/form-data)

file
required
The file to upload. Supported formats depend on the provider.
string
required
The intended purpose of the uploaded file. Common values:
  • fine-tune - For fine-tuning training data
  • assistants - For use with assistants
  • batch - For batch API requests

Response

string
The file identifier
string
The object type, always “file”
integer
The size of the file in bytes
integer
Unix timestamp of when the file was created
string
The name of the file
string
The purpose of the file

Example

Response Example

Error Handling

object
Error information if the request fails

Best Practices

Files are processed asynchronously. For large files, use the retrieve endpoint to check the file status before using it.
Files have a maximum size limit of 512 MB. Larger files will be rejected.

List Files

View all uploaded files

Retrieve File

Get file metadata

Delete File

Delete an uploaded file