Console

Upload File

POST/v1/files

Upload 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

ScenarioHow to use the file
Audio transcriptionUpload audio, then pass its file_id to POST /v1/audio/transcriptions
Multimodal understandingUpload an image or video, then pass its file_id in a content item for POST /v1/responses
Direct uploadIf a business endpoint accepts a multipart file, you can upload it directly without creating it in advance

Request parameters

FieldTypeRequiredDescription
file: multipart fileRequired

The multipart file field. The maximum file size is 512 MB; the file is streamed into assets without reading the whole file into memory.

purpose: stringRequired

File purpose.

Return value

FieldTypeDescription
id: string

The file id, i.e. the file_id used by subsequent endpoints.

object: string

Always file.

bytes: integer

File size in bytes.

created_at: integer

Creation time, a Unix timestamp in seconds.

filename: string

The original file name.

purpose: string

The purpose marker passed in on upload.

status: string

File status, for example processed / active; failed may be returned on failure, subject to the actual server response.