How Pagination Works
When making requests to list endpoints (like/markets, /events, or /series), the API returns results in pages to keep response sizes manageable. Each page contains:
- Data array: The actual items for the current page (markets, events, etc.)
- Cursor field: A token that points to the next page of results
- Limit: The maximum number of items per page (default: 100)
Using Cursors
To paginate through results:- Make your initial request without a cursor
- Check if the response includes a
cursorfield - If a cursor exists, make another request with
?cursor={cursor_value} - Continue until the cursor is
null(no more pages)
Example: Paginating Through Markets
Pagination Parameters
Most list endpoints support these pagination parameters:cursor: Token from previous response to get the next pagelimit: Number of items per page (typically 1-100, default: 100)
Best Practices
- Handle rate limits: When paginating through large datasets, be mindful of rate limits
- Set appropriate limits: Use smaller page sizes if you only need a few items
- Cache results: Store paginated data locally to avoid repeated API calls
- Check for changes: Data can change between requests, so consider implementing refresh logic
Endpoints Supporting Pagination
The following endpoints support cursor-based pagination:- Get Markets -
/markets - Get Events -
/events - Get Series -
/series - Get Trades -
/markets/trades - Get Portfolio History -
/portfolio/history - Get Fills -
/portfolio/fills - Get Orders -
/portfolio/orders
Common Patterns
Fetching Recent Items
If you only need recent items, you can limit results without pagination:Filtering While Paginating
You can combine filters with pagination:Detecting New Items
To check for new items since your last fetch:- Store the first item’s ID or timestamp from your previous fetch
- Paginate through results until you find that item
- Everything before it is new