Pagination

Most of the endpoints of the API returning a large number of resources are paginated. For example Read all customers, Read all subscriptions, etc. These API endpoints share common request parameters and response structures.


Cursor-based pagination

Loop's v2026.04 uses cursor-based pagination to retrieve large datasets in manageable chunks. Instead of specifying a page number, you use a cursor returned by the previous response to fetch the next set of records.

This approach is useful when you need to iterate through a large or frequently changing dataset because the cursor points to a specific position in the result set.

How it works

  1. Make the first API request without a cursor.
  2. The API returns a set of records along with pagination information containing a cursor for the next page.
  3. Use the returned cursor in your next request.
  4. Continue making requests using the new cursor until there are no more records to retrieve.

Request Parameters

ParameterTypeDescription
afterCursorstringA cursor returned by the previous API response. Use this value to retrieve the next page of results. Omit this parameter when making the first request.
pageSizeint32The maximum number of records to return in each request

Response Parameters

ParameterTypeDescription
successbooleanIndicates whether the API request was successful.
messagestringA message detailing the result of the request (e.g., success message).
dataarrayThe actual data returned by the API (e.g., list of subscriptions).
codestringA code representing the result of the request, such as "SUCCESS".
pageInfoobjectObject containing pagination-related information.
pageInfo.hasNextPagebooleanIndicates whether more records are available.
pageInfo.nextCursorstringThe cursor to pass as afterCursor in the next request.

Request Example

For the first request, omit the cursor parameter:

GET /subscriptions?pageSize=10

For subsequent requests, pass the nextCursor returned in the previous response:

GET /subscriptions?pageSize=10&afterCursor=<nextCursor>

Response Example

{
    "success": true,
    "message": "Subscriptions fetched successfully",
    "data": [....],
    "code": "SUCCESS",
    "pageInfo": {
        "hasNextPage": true,
        "nextCursor": "eyJpZCI6MTIzNDV9"
    }
}

When hasNextPage is false, there are no more records to retrieve and you can stop making requests.