New Chargeflow docs. Everything for merchants, platforms, and the API in one place.
ResourcesAPI Fundamentals

Pagination

Page through list endpoints with offset and limit.

List endpoints in the Chargeflow API paginate with the offset and limit query parameters. What offset counts depends on the resource: on the Disputes endpoints it is a zero-based page index (increment it by 1 to move to the next page), and on the Alerts endpoints it is a zero-based record offset (increment it by limit).

Parameters

ParameterTypeDefaultMinMaxDescription
offsetinteger00-Zero-based page index (Disputes) or record offset (Alerts).
limitinteger251100Number of items to return per page.

Example request

Terminal
curl -X GET "https://api.chargeflow.io/public/2025-04-01/disputes?offset=0&limit=25" \
  -H "x-api-key: YOUR_API_KEY"

Example response shape

Disputes:

Response
{
  "disputes": [{ "id": "66e6ea9ecd94925a9f8060d9" }, { "id": "66e6ea9ecd94925a9f8060da" }],
  "pagination": {
    "totalCount": 342,
    "offset": 0,
    "limit": 25,
    "totalPages": 14
  }
}
FieldDescription
disputesArray of result objects for the current page.
pagination.totalCountTotal number of items matching the query.
pagination.offsetThe page index (Disputes) or record offset (Alerts) of this response.
pagination.limitThe number of items requested per page.
pagination.totalPagesTotal number of pages available for this query. Disputes only.

Paginating through all disputes

On the Disputes endpoints, increment offset by 1 per page and stop once you reach pagination.totalPages:

Node.js
async function fetchAllDisputes(apiKey) {
  const baseUrl = 'https://api.chargeflow.io/public/2025-04-01/disputes';
  const limit = 100;
  let offset = 0;
  let allDisputes = [];

  while (true) {
    const response = await fetch(`${baseUrl}?offset=${offset}&limit=${limit}`, {
      headers: { 'x-api-key': apiKey },
    });
    const { disputes, pagination } = await response.json();

    allDisputes = allDisputes.concat(disputes);

    // Stop once the next page would be past the last one
    if (offset + 1 >= pagination.totalPages) break;
    offset += 1;
  }

  return allDisputes;
}

Paginating through all alerts

The Alerts endpoints count offset in records, so advance it by limit instead of by 1. Their pagination object has no totalPages: read until you have totalCount records.

Response
{
  "alerts": [{ "id": "alert_123456789" }, { "id": "alert_123456790" }],
  "pagination": {
    "totalCount": 342,
    "offset": 0,
    "limit": 25
  }
}
Node.js
async function fetchAllAlerts(apiKey) {
  const baseUrl = 'https://api.chargeflow.io/public/2025-04-01/alerts';
  const limit = 100;
  let offset = 0;
  let allAlerts = [];

  while (true) {
    const response = await fetch(`${baseUrl}?offset=${offset}&limit=${limit}`, {
      headers: { 'x-api-key': apiKey },
    });
    const { alerts, pagination } = await response.json();

    allAlerts = allAlerts.concat(alerts);

    // Stop once every record has been read
    if (allAlerts.length >= pagination.totalCount || alerts.length === 0) break;
    offset += limit;
  }

  return allAlerts;
}

Incrementing the Alerts offset by 1 returns the same records again, shifted by one row. Use offset += limit, and do not expect a totalPages field to stop on.

Set limit=100 when fetching large datasets to minimize the number of requests needed to page through all results.

Next steps

Was this page helpful?

On this page

llms.txt