Overview
Every list endpoint in the Parallel AI API uses page-based pagination. You control which page of results to return and how many items appear per page using two query parameters:Paginated Response Format
All paginated responses include the result items alongside metadata to help you navigate through the full dataset:Example Request
Fetch the second page of agents, with 20 items per page:Example Response
Use
hasNext rather than comparing page to pages to determine whether to continue — it accounts for edge cases where the total changes between requests.Fetching All Pages
To retrieve all items across every page, loop untilhasNext is false. The example below uses pageSize=100 to minimise the number of requests:
Tips for Large Datasets
Filter before paginating
Filter before paginating
Use any available filter parameters (e.g.
status, search, date ranges) to narrow the result set before paginating. Fewer total items means fewer pages to traverse and faster response times.Handle rate limits gracefully
Handle rate limits gracefully
If you’re iterating through many pages in a tight loop, add a short delay between requests and implement retry logic for
429 Too Many Requests responses. See Errors for a retry example.Cache total counts
Cache total counts
The
total and pages fields are useful for displaying progress indicators or estimating job duration. Cache them from the first response rather than re-fetching metadata on every page.