API Reference

REST endpoints support page-based pagination. This guide illustrates how to request paginated data from the REST Admin API and access each page of results.

How it works

When you send a request to a REST endpoint that supports page-based pagination, the response body includes page information. You can use these details to manage your subsequent API calls for pagination.


Pagination

ParameterDescription
page_infoAn array containing page information. This object appears in every endpoint that returns more than one set of data in the response. expand
limitThe maximum number of results to show on the page:
- The default limit value is 100.

Pagination parameters

ParameterTypeDescription
totalintegerThe total field represents the total number of items across all pages in the dataset.
countintegerThe count field indicates the total number of items available in the current dataset.
current_pageintegerThe current_page field indicates the current page number in the paginated dataset. This helps clients track their position within the pagination sequence.
total_pagesintegerThe total_pages field specifies the total number of pages available for the current dataset. This helps clients understand the full extent of the paginated data.
has_previous_pagebooleanThe has_previous_page field indicates if there are preceding pages of data. If true, there are previous pages available; if false, there are no earlier pages.
has_next_nagebooleanIndicates if additional pages of data are available. If true, more pages exist; if false, no further pages are available.

Supported endpoints

You can use page-based pagination on most REST Admin API GET endpoints that retrieve a list of resources.

If the REST resource includes the limit parameter on the GET endpoint, then you can use the endpoint to request paginated data. For example, the Plans resource includes the limit parameter on the GET endpoint that retrieves a list of plans.


Make a request for paginated data

When you make a request to an endpoint that supports paginated results, you can set the number of results to return per page using the limit parameter. If you don't specify a limit, then the endpoint will use its default page limit. You can also set other parameters in this request to narrow down your results.

The following example request asks the subscriber endpoint for all subscribers, with a limit of 3 subscribers per page of results:

Request:
GET https://{shop}.recurpay.com/admin/api/{api_version}/subscribers?limit=3

Response:
{
  "success": true,
  "data": {
    "subscribers": [{
        "id": "6964807663890",
        ...
      },
      {
        "id": "6964807663890",
        ...
      },
      {
        "id": "6964807663890",
        ...
      }
    ]
  },
  "page_info": {
    "total": 21000,
    "count": 3,
    "current_page": 1,
    "total_pages": 7000,
    "has_previous_page": false,
    "has_next_nage": true
  }
}

The response body includes a page_info object containing detailed information about the next page of results. Send a parameter page with a value of 2 to retrieve the subsequent data set, repeating this process until has_next_page returns false.