GET
/filesList files
Lists uploaded files, with optional filtering, sorting, and cursor-based pagination. Use purpose to filter the results, and use after with the last file ID from a page to retrieve the next page.
purposestringoptional
Filter the list to files with the specified purpose.
limitintegeroptional
Maximum number of files to return, from 1 to 10,000. Defaults to 10,000 when omitted.
orderstringoptional
Sort by creation time in ascending (`asc`) or descending (`desc`) order. Defaults to `desc` when omitted.
afterstringoptional
File ID cursor that marks the position after which to return results; use the last file ID from the previous page.
200Returns a page of file objects with the first and last file IDs and a `has_more` flag indicating whether more results are available.
objectstringrequired
dataarray<OpenAIFile>required
first_idstringrequired
last_idstringrequired
has_morebooleanrequired
400Returned when a file listing parameter is invalid.
errorobjectrequired
404Returned when the file specified by the `after` cursor is not found.
errorobjectrequired
429Returned when too many file requests are made; reduce the request rate and try again later.
errorobjectrequired
Error handling
A 400 is returned when a listing parameter is invalid; limit must be between 1 and 10,000, and order must be asc or desc. A 404 is returned when the file specified by the after cursor is not found. A 429 is returned when too many file requests are made.