Core Concepts
Pagination
Cursor-based pagination for list endpoints in the Cresora API.
Cresora list endpoints use cursor-based pagination. This is more reliable than offset pagination for large, frequently-updated datasets — you'll never miss records or see duplicates when iterating.
Request
GET https://api.cresoracommerce.ai/api/v1/transactions?page_size=25
Authorization: Bearer csk_ab12cd34_xxxxxxxxxxxxxxxxxxxxxxxx| Parameter | Default | Description |
|---|---|---|
page_size | 25 | Items per page (1–100 on most endpoints). |
cursor | — | Opaque cursor from the previous response's pagination.next_cursor. Do not parse or construct it — its format is not part of the contract. |
There is no reverse pagination — iterate forward from the first page.
Response shape
Pagination metadata is a nested pagination object, not top-level fields:
{
"data": [
{ "…": "…" },
{ "…": "…" }
],
"pagination": {
"has_more": true,
"next_cursor": "eyJpZCI6IjAxSFhZWi4uLiJ9"
}
}| Field | Description |
|---|---|
data | Array of items for this page — the item shape belongs to each endpoint |
pagination.has_more | true if more pages exist after this one |
pagination.next_cursor | Pass as the cursor query param to fetch the next page. null when has_more is false. |
Iterating all records
async function fetchAll(endpoint) {
const results = [];
let cursor = null;
do {
const url = new URL(`https://api.cresoracommerce.ai${endpoint}`);
url.searchParams.set("page_size", "100");
if (cursor) url.searchParams.set("cursor", cursor);
const res = await fetch(url, {
headers: { Authorization: "Bearer csk_ab12cd34_xxxxxxxxxxxxxxxxxxxxxxxx" }
});
const page = await res.json();
results.push(...page.data);
cursor = page.pagination.has_more ? page.pagination.next_cursor : null;
} while (cursor);
return results;
}💡Tip
Use page_size=100 when iterating large datasets to minimize the number of requests and reduce your chance of hitting rate limits.