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
| Parameter | Type | Default | Min | Max | Description |
|---|---|---|---|---|---|
offset | integer | 0 | 0 | - | Zero-based page index to retrieve. |
limit | integer | 25 | 1 | 100 | Number of items to return per page. |
Example request
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": [
{ "id": "66e6ea9ecd94925a9f8060d9" },
{ "id": "66e6ea9ecd94925a9f8060da" }
],
"pagination": {
"totalCount": 342,
"offset": 0,
"limit": 25,
"totalPages": 14
}
}| Field | Description |
|---|---|
disputes | Array of result objects for the current page. |
pagination.totalCount | Total number of items matching the query. |
pagination.offset | The current zero-based page index. |
pagination.limit | The number of items requested per page. |
pagination.totalPages | Total number of pages available for this query. |
Paginating through all results
Increment offset by 1 per page and stop once you reach pagination.totalPages:
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?