Skip to main content
Upload a batch input file as a multipart form, keep the id it returns, and read the file’s metadata and bytes back by that ID. The examples use a client created as in Installation.

Upload a file

TypeScript and Python upload with an SDK method, which sends POST /v1/batches/files. The other SDKs can’t send multipart, so they post the form to POST /v1/files with the standard HTTP client.

Upload options

These apply to the TypeScript and Python upload methods. In the raw multipart requests, send purpose and file as form fields.

Read a file back

Replace file_123 with the ID the upload returned. In Python you can also reach these through client.files: create(params) uploads like upload_file, list() lists, retrieve(id) reads the metadata and content(id) reads the bytes. Rust has no file methods.
The file endpoints are in beta and need an enabled batch provider.

Keep the file ID: you can’t list files

Save each uploaded file’s id. The list methods call GET /v1/files, which returns 400 with code not_supported and reason file_list_not_supported_with_shared_gateway_key. The full contract is in the Files API reference.

Response

FileObject, from the upload and the metadata methods:
Last modified on November 5, 2026