How Pagination Works
When making requests to list endpoints (like/markets, /events, or /markets/trades), 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. The default and maximum differ by endpoint: for example
/marketsand/markets/tradesdefault to 100 and allow up to 1000, while/eventsdefaults to 200 and allows up to 200. Check each endpoint’s reference page.
Using Cursors
To paginate through results:- Make your initial request without a cursor
- Read the
cursorfield of the response - If the cursor is not empty, make another request with
?cursor={cursor_value}, keeping the same filters - Continue until the cursor is an empty string (no more pages)
/markets, /historical/markets and /markets/trades, a cursor that cannot be decoded (for example a truncated one) is ignored and the first page is returned with no error, so a loop that sends a damaged cursor never ends. /events rejects an invalid cursor with 400.
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. Defaults and maximums differ by endpoint (up to 1000 on/marketsand/markets/trades, up to 200 on/events)
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 Trades -
/markets/trades - Get Fills -
/portfolio/fills - Get Orders -
/portfolio/orders
GET /series is not paginated: it takes no limit or cursor and returns every matching series in one response.
Things to Know
/marketsfiltered only byevent_tickerortickersis not paged. When one of these is the only filter, every matching market is returned in one response in no guaranteed order,limitis not applied, and the returned cursor is empty.- Sort order depends on the filters.
/marketsreturns the most recently created markets first by default. Withmin_updated_tsormax_updated_tsit sorts by last update time (oldest first). When neitherevent_tickernortickersis supplied,status=closed,min_close_tsormax_close_tssorts by close time (latest first), andmin_settled_tsormax_settled_tssorts by settlement time (latest first). A request that suppliesevent_tickerortickerstogether with another filter is sorted by creation time, even with those status or timestamp filters. The unpaged case above, whereevent_tickerortickersis the only filter, has no guaranteed order. - Pages are not a snapshot. Items can be created or change between requests. A market whose close time changes while you page through a listing sorted by close time can be skipped or returned twice, so deduplicate by ticker.
- List responses can be slightly stale. Market data responses are cached for a short time and can lag the exchange by several seconds, longer for filtered listings than for a single market. Use WebSockets when you need current prices or status.
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