Skip to content
SkanPay Docs

Pagination

List endpoints return pages, newest first, and use a cursor to fetch the next one. There is no offset.

Query parameters

limitintegerOptional
Items per page, 1 to 100. Default 25.
starting_afterstringOptional
The next_cursor from the previous page. Returns items older than it.
Page shape
{
  "object": "list",
  "data": [ ... ],
  "has_more": true,
  "next_cursor": "chg_01J9Z3K8Q4W6XK2M7N5P0R3T8V"
}

Keep requesting with starting_after=<next_cursor> until has_more is false (then next_cursor is null). New transactions created while you page do not shift or duplicate items, because the cursor is an id, not a position.

Walking every page

let cursor;
do {
  const url = new URL("https://api.skanpay.website/v1/transactions");
  url.searchParams.set("limit", "100");
  if (cursor) url.searchParams.set("starting_after", cursor);

  const res = await fetch(url, {
    headers: { Authorization: `Bearer ${process.env.SKANPAY_SECRET_KEY}` },
  });
  const page = await res.json();
  for (const t of page.data) console.log(t.id, t.type, t.status, t.amount, t.currency);
  cursor = page.has_more ? page.next_cursor : undefined;
} while (cursor);