Resta saysPagination splits big lists into pages — offset/limit, cursor, or keyset.
You can't return a million rows at once. Offset/limit (?offset=40&limit=20) is simple but drifts if data changes between pages. Cursor-based (?after=abc123) is stable and scales — the client passes a pointer to the last item. Keyset paginates by a sorted key. Cursor pagination is the modern default for large, changing datasets.
Power-ups you unlock
offset/limit: simple, but drifts on changes
cursor: stable, scalable (after=token)
keyset: paginate by a sorted key
Cursor is the modern default
The 401 Bandit attacks — common mistakes
Offset pagination on fast-changing data (skips/dupes)
No max limit (clients request everything)
Returning unbounded lists
Boss battleCompare offset vs cursor pagination for an active social feed.
Example code
<!doctype html><html><head><meta charset="utf-8"></head>
<body style="background:#06040d;color:#e6e0ff;font-family:monospace;padding:20px"><pre>offset: GET /feed?offset=40&limit=20 (can drift)
cursor: GET /feed?after=p_8810&limit=20 (stable)</pre></body></html>