Skip to content
On this page

Pagination

All of the index endpoints for bulk fetching support pagination. The paginated API methods share a structure and accept at least the limit parameter. Making a request without specifying limit will use a default page size of 50.

The response of a paginated API method represents a single page, with the page length being set by the limit parameter. By default, most endpoints will use reverse chronological order (newest objects first). Some endpoints allow for sort, order, and filter parameters. See each endpoint for more details on which parameters they support and the values they accept.

All paginated endpoints use a cursor-based pagination system. You will make your first request to the endpoint with the parameters you want to use. The response will contain the first page of results, and and a next URL that you can use to fetch the next page of results. The next URL contains only the cursor parameter, which is an encoded string that contains the parameters you used in your original request and the place from which the next page of results starts. You only need to include the cursor parameter in subsequent requests, any other parameters supplied in subsequent requests will be ignored in favor of the parameters used in your original request. This is to ensure consistency of the result set when paging through large datasets.

The data property will contain an array of objects. Each one of those objects will have some attributes that are unique to the object type. Some objects will only include a subset of attributes in paginated endpoints and you will need to make a request to the object's urls.details property to retrieve the full details of the object. The urls property may contain other keys with links to query for other related objects as well.

Parameters

NameOptionalDefaultDescription
limitoptional50The limit of the number of objects returned in a single page, between 1 and 100.
cursorrequired on subsequent requestsN/AAn encoded string that contains the parameters you used in your original request and the place from which the next page of results starts.

Page response format

NameTypeDescription
objectstringValue is 'array'. A string describing the object type returned
has_morebooleanWhether there are more pages of results available.
nextstringThe URL to request the next page of results. If not set, this is the last page of results.
limitnumberThe limit parameter used in the request
sizenumberThe number of elements inside of data
dataarrayAn array containing the response objects for the requested page of results
Example response
json
{
  "object": "array",
  "has_more": true,
  "next": "/v1/campaigns?cursor=eyJzb3J0IjoibmFtZSIsIm9yZGVyIjoiY...",
  "limit": 5,
  "size": 5,
  "data": [
    {
      "object": "campaign",
      "id": "e76d4cb7-e1e7-4579-ab24-7967377bfdd7",
      "name": "Weekly Newsletter",
      "status": "active",
      "emails_count": 6,
      "urls": {
        "details": "/v1/campaigns/e76d4cb7-e1e7-4579-ab24-7967377bfdd7",
        "emails": "/v1/campaigns/e76d4cb7-e1e7-4579-ab24-7967377bfdd7/emails",
      },
    },
    {...},
    {...},
    {...},
    {...},
  ],
}