POST
Upload a file

Authorizations

Authorization
string
header
required

Provide your API key in the Authorization header using Bearer auth

Body

multipart/form-data

Multipart form for uploading a file (documentation only)

file
file
required

The file (png / jpeg / webp / gif only for now, up to 20 MB)

purpose
enum<string>
required

Purpose: vision (image understanding, image edit references) / user_data

Available options:
vision,
user_data
expires_after[anchor]
string

Form field expires_after[anchor]: only created_at

expires_after[seconds]
integer<int64>

Form field expires_after[seconds]: seconds until expiry (3600 to 2592000)

Response

OK

File (OpenAI File object)

id
string

File ID (file- prefix)

object
string

Always file

Example:

"file"

bytes
integer<int64>

Size in bytes

created_at
integer<int64>

Created at (Unix seconds)

expires_at
integer<int64>

Expires at (Unix seconds); null if it never expires

filename
string

File name

purpose
enum<string>

Purpose: vision / user_data

Available options:
vision,
user_data
status
enum<string>

Status: uploaded / processed / error

Available options:
uploaded,
processed,
error
status_details
string

Status details (deprecated as in OpenAI, always null)