Upload File
POST
/v1/filesUpload a file and obtain a file_id. The multipart field must be named file, and purpose is required; the returned file_id can be used with audio transcription, multimodal understanding, and other endpoints.
Usage
| Scenario | How to use the file |
|---|---|
| Audio transcription | Upload audio, then pass its file_id to POST /v1/audio/transcriptions |
| Multimodal understanding | Upload an image or video, then pass its file_id in a content item for POST /v1/responses |
| Direct upload | If a business endpoint accepts a multipart file, you can upload it directly without creating it in advance |
Request parameters
FieldTypeRequiredDescription
The multipart file field. The maximum file size is 512 MB; the file is streamed into assets without reading the whole file into memory.
File purpose.
Return value
FieldTypeDescription
The file id, i.e. the file_id used by subsequent endpoints.
Always file.
File size in bytes.
Creation time, a Unix timestamp in seconds.
The original file name.
The purpose marker passed in on upload.
File status, for example processed / active; failed may be returned on failure, subject to the actual server response.