Parameters
By default, results are sorted by
id descending (newest first).
Offset pagination
The simplest approach is page-based. Request successive pages until you receive fewer items thanlimit.
Cursor pagination
Cursor pagination uses thelt (“less than”) parameter with the id of the last item you saw. Because results default to descending id order, passing the last id returns the next, older page. This is stable even as new records are created.
1
Fetch the first page
2
Take the last id
Read the
id of the final item in the data array.3
Request the next page
Pass that
id as lt.4
Repeat until empty
Continue until a page returns fewer than
limit items.Example loop
Sorting
Override the default order withsort and direction:
When sorting by a field other than
_id, prefer offset pagination. The lt cursor is based on id ordering and is most reliable with the default sort.
