Pagination โ
When listing resources, the API returns results in pages. Pagination ensures responses stay fast and predictable, even when dealing with large datasets.
All collection endpoints implement a consistent pagination model.
Offset-based pagination โ
By default, the API uses offset-based pagination with the following query parameters:
| Parameter | Type | Description |
|---|---|---|
page | integer | Page number to retrieve |
perPage | integer | Number of items returned per page |
Example request:
http
GET /v1/subscription/subscribers?perPage=50&page=2This request returns the second page of subscribers with 50 items per page.
Response format โ
List endpoints return a JSON object containing:
- a
dataarray with the resources for the current page - a
metaobject with pagination information
Example response:
json
{
"data": [
...
],
"meta": {
"page": 2,
"perPage": 50,
"totalPages": 180,
"totalCount": 8997,
"hasNext": true,
"hasPrevious": true
}
}meta fields โ
| Field | Description |
|---|---|
page | Current page number |
perPage | Number of items returned per page |
totalPages | Total number of available pages |
totalCount | Total number of resources available |
hasNext | Indicates whether another page exists after the current one |
hasPrevious | Indicates whether a previous page exists |
Default values โ
If pagination parameters are not provided, default values are applied.
| Parameter | Default | Maximum |
|---|---|---|
perPage | 20 | 100 |
page | 1 | โ |
Example:
http
GET /v1/subscription/subscribersis equivalent to:
http
GET /v1/subscription/subscribers?page=1&perPage=20Some endpoints may override the maximum perPage value depending on resource constraints.
Best practices โ
When consuming paginated endpoints:
- Always assume responses may contain multiple pages
- Use
hasNextto determine if additional requests are required - Avoid requesting unnecessarily large
perPagevalues - Cache results when possible to reduce repeated pagination queries