Method Signature
Parameters
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 to fetch the next page of the list.A limit on the number of objects to be returned.
- Range: 1 to 10,000
- Default: 10,000
Sort order by the
created_at timestamp of the objects.asc- Ascending order (oldest first)desc- Descending order (newest first)
Only return files with the given purpose.Valid purposes:
assistantsbatchfine-tunevisionuser_dataevals
Response
Returns a paginated list ofFileObject instances.
Examples
List All Files
List Fine-tuning Files Only
Paginate Through Files
List Files in Ascending Order
Auto-pagination
Filter and Process Files
Async Usage
Pagination Details
Thelist() method returns a SyncCursorPage object that supports:
- Iteration: Automatically fetches pages as you iterate
- Manual pagination: Use
afterparameter with the last object ID - Page size control: Use
limitto control how many objects per page
Notes
- Default limit is 10,000 files per request
- Files are sorted by
created_attimestamp - Use pagination for large file lists to avoid memory issues
- The response includes all file metadata except the actual file contents
- Use the retrieve content endpoint to download file contents