Basker Docs

Pagination and sorting

Page through collection results and control their order

Collection endpoints use sort, page, limit, and pagination to control result order and paging.

Sort results

Pass a field name for ascending order or prefix it with - for descending order:

?sort=startDate
?sort=-startDate

Separate fields with commas to add tie-breakers. This example orders events by latest start date, then alphabetically by title when dates match:

?sort=-startDate,title

Sort only by fields exposed as sortable by the collection. A populated relationship object cannot be used as a sort value.

Choose a page

limit sets the maximum records per page and page selects a page, starting from 1:

curl -s \
  -H "Authorization: users API-Key YOUR_API_KEY" \
  "https://api.basker.app/partners/2026-02/remarkable-theatre/events?limit=5&page=3&sort=-startDate"

A paginated response includes:

{
  "docs": [],
  "totalDocs": 47,
  "limit": 5,
  "totalPages": 10,
  "page": 3,
  "pagingCounter": 11,
  "hasPrevPage": true,
  "hasNextPage": true,
  "prevPage": 2,
  "nextPage": 4
}
FieldMeaning
totalDocsRecords matching the filters across all pages
limitMaximum records on this page
totalPagesNumber of available pages
pageCurrent page number
pagingCounterOne-based position of the first record on this page
hasPrevPage, hasNextPageWhether another page exists in that direction
prevPage, nextPageAdjacent page number, or null at the boundary

Requesting a page beyond totalPages returns an empty docs array.

Disable pagination

Set pagination=false when you deliberately need every matching record in one response:

?pagination=false&sort=title

Pagination metadata may be absent in this mode. For large or growing collections, keep pagination enabled and follow nextPage to avoid oversized responses.

On this page