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=-startDateSeparate fields with commas to add tie-breakers. This example orders events by latest start date, then alphabetically by title when dates match:
?sort=-startDate,titleSort 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
}| Field | Meaning |
|---|---|
totalDocs | Records matching the filters across all pages |
limit | Maximum records on this page |
totalPages | Number of available pages |
page | Current page number |
pagingCounter | One-based position of the first record on this page |
hasPrevPage, hasNextPage | Whether another page exists in that direction |
prevPage, nextPage | Adjacent 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=titlePagination metadata may be absent in this mode. For large or growing collections, keep pagination enabled and follow nextPage to avoid oversized responses.