Files

files

Methods

Retrieve File Content -> unknown
get/files/{file_id}/content

Returns the contents of the specified file.

Upload File ->
post/files

Upload a file that can be used across various endpoints. Individual files can be up to 512 MB, and the size of all files uploaded by one organization can be up to 100 GB.

The Assistants API supports files up to 2 million tokens and of specific file types. See the Assistants Tools guide for details.

The Fine-tuning API only supports .jsonl files. The input also has certain required formats for fine-tuning chat or completions models.

The Batch API only supports .jsonl files up to 100 MB in size. The input also has a specific required format.

Please contact us if you need to increase these storage limits.

Delete File ->
delete/files/{file_id}

Delete a file.

List Files -> CursorPage<>
get/files

Returns a list of files.

Security
Bearer Auth

Example: Authorization: Bearer My API Key

Parameters
after?: string

A cursor for use in pagination. after is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list.

limit?: number

A limit on the number of objects to be returned. Limit can range between 1 and 10,000, and the default is 10,000.

order?:

Sort order by the created_at timestamp of the objects. asc for ascending order and desc for descending order.

"asc"
"desc"
purpose?: string

Only return files with the given purpose.

Response fields
data: Array<>
first_id: string
has_more: boolean
last_id: string
object: string
Request example
200Example
Retrieve File ->
get/files/{file_id}

Returns information about a specific file.

Retrieve File Content ->
get/files/{file_id}/content

Returns the contents of the specified file.

Domain types

FileContent = string
FileDeleted = { id, deleted, object }
FileObject = { id, bytes, created_at, 5 more... }
FilePurpose = "assistants" | "batch" | "fine-tune" | 1 more...