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

Pagination

Page through list endpoints with offset and limit.

All list endpoints in the Chargeflow API use page-based pagination via the offset and limit query parameters. offset is a zero-based page index, not an item count: increment it by 1 to move to the next page.

Parameters

ParameterTypeDefaultMinMaxDescription
offsetinteger00-Zero-based page index to retrieve.
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

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 current zero-based page index.
pagination.limitThe number of items requested per page.
pagination.totalPagesTotal number of pages available for this query.

Paginating through all results

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;
}

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