LIVE
$7.62 min profit is yours / per trade
Get the bot

Definition

Cursor pagination

A pagination strategy that uses opaque tokens instead of numeric offsets.

Cursor pagination

Cursor pagination is a pagination strategy that uses an opaque token (a "cursor") to mark a position in a result set instead of relying on numeric offsets like page=2 or offset=100. Clients pass the cursor back to the server (for example via an after_cursor parameter) to request the next page. The server returns a new cursor for the following page in its response.

In context

Polymarket's Gamma /markets endpoint requires cursor-based pagination: calls must use the after_cursor value returned by a previous request rather than an offset parameter. This keyset-style approach improves performance and consistency on large or frequently-updated result sets because the server can resume from a stable position without scanning from the start for each page. Gamma returns a next_cursor in each paginated response; supply that value as after_cursor to fetch the subsequent page.

Practical notes

  • Opaque token: Treat the cursor as an uninspected string. Do not attempt to parse or construct it client-side.
  • No numeric offset: The Gamma API rejects numeric offset; use after_cursor for pagination with /markets. The endpoint supports limit (max 1000) alongside after_cursor.
  • Ordering matters: Cursor pagination is tied to the query's ordering. If you change the order fields you may not be able to resume using a previous cursor.
  • Robust clients: Save cursors if you intend to resume a long scan, and handle the case where a previously issued cursor becomes stale or yields no results.

See also

  • /glossary/gamma-api

Related terms