List Files

List the files belonging to the authenticated user.

List the files owned by the authenticated API key.

GET /v1/files

Query parameters

purposestringoptional

Only return files with this purpose.

Allowed values:user_data
limitintegeroptionalDefault 10000

Maximum number of files to return per page.

orderstringoptionalDefault desc

Sort order by created_at.

Allowed values:ascdesc
afterstringoptional

Cursor for pagination. Pass the id of the last file from the previous page.

Response

object'list'optional

Always list.

dataFileObject[]optional

Array of FileObject entries.

has_morebooleanoptional

true when more pages exist. Use last_id as the after cursor for the next page.

first_idstringoptional

id of the first item on this page.

last_idstringoptional

id of the last item on this page.

The response shape is compatible with the OpenAI SDK's CursorPage, so async iteration (for await (const file of client.files.list())) works out of the box.