Skip to content
Commitwise
Menu

Cursor pagination

Also called: Keyset pagination

Loading the next page by saying where the last page ended, such as 'posts older than this one', instead of using a page number or offset.

Definition

The server returns an opaque cursor with each page, usually encoding the sort key and a tie-breaking id of the last item. The next request asks for items after that cursor. Unlike offsets, cursors don't produce duplicates or skipped items when new items are inserted or old ones deleted while the user is scrolling.

In practice

GET /feed?cursor=eyJ0IjoxNzMx... returns the next 20 posts older than the last one the app received.

Related terms

Esc

Type to search the whole site.