Docs
Search the docs
Find a page in the docs

Concepts

Pagination

List endpoints return a page of results and a cursor for the next one.

List endpoints return results newest first, a page at a time. The response has the page in data and a next_cursor to continue:

Response
{
  "data": [ … ],
  "next_cursor": "WyIyMDI2LTExLTEyVDE1OjA0OjA1WiIsInBheV8wMUpC…"
}

Parameters

ParameterDescription
limitResults per page, from 1 to 100. Defaults to 25.
cursor The next_cursor of the previous page. Leave it out for the first page.

When next_cursor is null, you're on the last page. Cursors are opaque: pass them back as they are. Results created while you page through don't shift the pages.

Fetch every page

Node.js
let cursor = null;
do {
  const url = new URL('https://api.camelpayment.com/v1/payments');
  url.searchParams.set('limit', '100');
  if (cursor) url.searchParams.set('cursor', cursor);

  const response = await fetch(url, {
    headers: { Authorization: `Bearer ${process.env.CAMEL_API_KEY}` }
  });
  const page = await response.json();
  for (const payment of page.data) console.log(payment.id, payment.status);
  cursor = page.next_cursor;
} while (cursor);