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.
| Field | Type | Required | Description |
|---|---|---|---|
file | string (binary) | Yes | The file to upload. |
purpose | enum ('user_data', 'batch') | Yes | The 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_after | FileExpiresAfter | No |
Delete File Response
| Field | Type | Required | Description |
|---|---|---|---|
id | string | Yes | |
object | enum ('file') | Yes | |
deleted | boolean | Yes |
File Expires After
The expiration policy for an uploaded file.
| Field | Type | Required | Description |
|---|---|---|---|
anchor | enum ('created_at') | Yes | The timestamp anchor for the expiration policy. |
seconds | integer (int64) | Yes | The 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.
| Field | Type | Required | Description |
|---|---|---|---|
id | string | Yes | Identifier for the file. Format is file-<numeric>. |
bytes | integer (int64) | Yes | Size of the file in bytes. |
created_at | integer (int64) | Yes | Unix timestamp (seconds) for when the file was created. |
expires_at | integer (int64) | null | Yes | Unix 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. |
filename | string | Yes | Name of the file. |
object | enum ('file') | Yes | Object type; always file. |
purpose | enum ('batch', 'fine-tune', 'evals', 'user_data') | Yes | The intended purpose of the file. |
status | enum ('uploaded', 'processed', 'error') | Yes | Deprecated. The current status of the file, which can be either uploaded, processed, or error. |
status_details | string | No | Deprecated. Details about why the file failed validation. |
List Files Response
| Field | Type | Required | Description |
|---|---|---|---|
object | enum ('list') | Yes | |
data | array of FileObject | Yes | |
first_id | string | Yes | |
last_id | string | Yes | |
has_more | boolean | Yes |