Page-based pagination
Endpoints using page-based pagination commonly acceptpage[number] and page[size]:
page[number] requests the first page. Endpoint references define default and maximum page sizes.
A paginated response can include:
total_pages is present, continue until page_number reaches it. Otherwise, follow the endpoint’s documented links, cursors, or termination condition. Do not hard-code a global maximum page size.
Filtering
Filter syntax is endpoint-specific. An endpoint can expose scalar filters:Sorting
Endpoints that support sorting declare asort parameter and allowed fields. A leading - commonly selects descending order:
Encode query parameters
Square brackets are part of the parameter name. HTTP clients normally percent-encode them automatically. When constructing a URL manually, preserve the equivalent encoded form:Operational guidance
- Preserve a stable sort where supported so records are not skipped or repeated as a collection changes.
- Bound concurrent page requests to remain within endpoint rate limits.
- Restart pagination when filters or sorting change.
- Treat pagination metadata as response data rather than predicting totals locally.