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
- Make the first API request without a cursor.
- The API returns a set of records along with pagination information containing a cursor for the next page.
- Use the returned cursor in your next request.
- Continue making requests using the new cursor until there are no more records to retrieve.
Request Parameters
| Parameter | Type | Description |
|---|---|---|
afterCursor | string | A 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. |
pageSize | int32 | The maximum number of records to return in each request |
Response Parameters
| Parameter | Type | Description |
|---|---|---|
success | boolean | Indicates whether the API request was successful. |
message | string | A message detailing the result of the request (e.g., success message). |
data | array | The actual data returned by the API (e.g., list of subscriptions). |
code | string | A code representing the result of the request, such as "SUCCESS". |
pageInfo | object | Object containing pagination-related information. |
pageInfo.hasNextPage | boolean | Indicates whether more records are available. |
pageInfo.nextCursor | string | The cursor to pass as afterCursor in the next request. |
Request Example
For the first request, omit the cursor parameter:
GET /subscriptions?pageSize=10For 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.