Files API
Manage
List files
/v1/files
List files owned by the authenticated team, paginated. The response
always returns a pagination_token; pass it back as a query parameter
to fetch the next page. The end of the list is reached when the
returned data array is shorter than limit.
Query parameters
limit
integer
The maximum number of objects to be returned in a single response.
order
string
The ordering to sort the returned files. Use `asc` for ascending and `desc` for descending order.
sort_by
string
The field to sort by. Valid options: `created_at`, `filename`, `size`. Defaults to `created_at`.
pagination_token
string
The pagination token returned by the previous list files request.
after
string
Only included for compatibility. Use `pagination_token` instead.
Response Body
data
array
List of files.
Get file metadata
/v1/files/{file_id}
Retrieve metadata for a single file by ID. Errors with 404 if the file
doesn't exist, has been deleted, or has passed its expires_at.
Path parameters
file_id
string
required
The file's `id` returned by upload or list.
Response Body
bytes
integer
The size of the file, in bytes.
created_at
integer
The Unix timestamp (in seconds) for file creation time.
filename
string
The name of the file.
id
string
The file identifier, which can be used in other API requests.
object
string
The object type, which is always file. Only included for compatability.
purpose
string
The intended purpose of the uploaded file. Only included for OAI compatability.
Update a file's metadata or content
/v1/files/{file_id}
Delete a file
/v1/files/{file_id}
Delete a file by ID. After this returns, the file no longer appears in
GET /v1/files, content download returns 404, and the ID can no longer
be referenced in chat attachments.
Path parameters
file_id
string
required
The file's `id` to delete.
Response Body
deleted
boolean
Whether the file was deleted.
id
string
The ID of the file.
object
string
The object type, which is always "file". Only included for compatibility.
Did you find this page helpful?
Last updated: April 28, 2026