Files schemas

The full schema and model definitions referenced by the Files endpoints. Each endpoint page links here for the detailed shape of its request and response objects.

Schemas

Create File Request

Request body for uploading a file.

FieldTypeRequiredDescription
filestring (binary)YesThe file to upload.
purposeenum ('user_data', 'batch')YesThe intended purpose of the uploaded file. Only user_data and batch are supported by this endpoint; other values are rejected with a 400 error.
expires_afterFileExpiresAfterNo

Delete File Response

FieldTypeRequiredDescription
idstringYes
objectenum ('file')Yes
deletedbooleanYes

File Expires After

The expiration policy for an uploaded file.

FieldTypeRequiredDescription
anchorenum ('created_at')YesThe timestamp anchor for the expiration policy.
secondsinteger (int64)YesThe number of seconds after the anchor time when the file expires. (minimum: 3600, maximum: 2592000)

File Object

Represents a file uploaded to the Files API.

FieldTypeRequiredDescription
idstringYesIdentifier for the file. Format is file-<numeric>.
bytesinteger (int64)YesSize of the file in bytes.
created_atinteger (int64)YesUnix timestamp (seconds) for when the file was created.
expires_atinteger (int64) | nullYesUnix timestamp (seconds) at which the file expires, or null when no expiration was requested. Set to created_at + expires_after.seconds when expires_after is supplied at upload. Always present in the response — null rather than omitted for non-expiring files.
filenamestringYesName of the file.
objectenum ('file')YesObject type; always file.
purposeenum ('batch', 'fine-tune', 'evals', 'user_data')YesThe intended purpose of the file.
statusenum ('uploaded', 'processed', 'error')YesDeprecated. The current status of the file, which can be either uploaded, processed, or error.
status_detailsstringNoDeprecated. Details about why the file failed validation.

List Files Response

FieldTypeRequiredDescription
objectenum ('list')Yes
dataarray of FileObjectYes
first_idstringYes
last_idstringYes
has_morebooleanYes