v3

latestOpenAPI 3.1.0raw.githubusercontent.com2025-10-0174039.9 KB

Initiate an upload session with specified file metadata

post/uploads

Headers

X-API-Version'1.0.0'

Request body

bytesinteger required

The number of bytes in the file you are uploading

filenamestring required

The name of the file to upload

mime_type'image/jpeg' | 'image/jpg' | 'image/png' | 'image/gif' | 'image/webp' | 'image/x-icon' | 'audio/mp3' | 'audio/mpeg' | 'audio/wav' | 'audio/x-wav' | 'application/jsonl' | 'application/json' | 'text/plain' | 'video/mp4' | 'application/pdf' required

The MIME type of the file. Must be one of the supported MIME type for the given purpose.

purpose'attachment' | 'ephemeral_attachment' | 'image_generation_result' | 'messages_finetune' | 'messages_eval' | 'metadata' required

Intended purpose of the uploaded file.

Response

Response for initiating an upload session

idstring required

The unique upload session identifier to use for uploading the file

bytesinteger required

The number of bytes in the file you are uploading

filenamestring required

The name of the file to upload

mime_type'image/jpeg' | 'image/jpg' | 'image/png' | 'image/gif' | 'image/webp' | 'image/x-icon' | 'audio/mp3' | 'audio/mpeg' | 'audio/wav' | 'audio/x-wav' | 'application/jsonl' | 'application/json' | 'text/plain' | 'video/mp4' | 'application/pdf' required

The MIME type of the file. Must be one of the supported MIME type for the given purpose.

purpose'attachment' | 'ephemeral_attachment' | 'image_generation_result' | 'messages_finetune' | 'messages_eval' | 'metadata' required

Intended purpose of the uploaded file.