Skip to content

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:

ParameterTypeDescription
pageintegerPage number to retrieve
perPageintegerNumber of items returned per page

Example request:

http
GET /v1/subscription/subscribers?perPage=50&page=2

This request returns the second page of subscribers with 50 items per page.

Response format โ€‹

List endpoints return a JSON object containing:

  • a data array with the resources for the current page
  • a meta object with pagination information

Example response:

json
{
  "data": [
    ...
  ],
  "meta": {
    "page": 2,
    "perPage": 50,
    "totalPages": 180,
    "totalCount": 8997,
    "hasNext": true,
    "hasPrevious": true
  }
}

meta fields โ€‹

FieldDescription
pageCurrent page number
perPageNumber of items returned per page
totalPagesTotal number of available pages
totalCountTotal number of resources available
hasNextIndicates whether another page exists after the current one
hasPreviousIndicates whether a previous page exists

Default values โ€‹

If pagination parameters are not provided, default values are applied.

ParameterDefaultMaximum
perPage20100
page1โ€”

Example:

http
GET /v1/subscription/subscribers

is equivalent to:

http
GET /v1/subscription/subscribers?page=1&perPage=20

Some 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 hasNext to determine if additional requests are required
  • Avoid requesting unnecessarily large perPage values
  • Cache results when possible to reduce repeated pagination queries