Skip to content
API · Pagination

Pagination for list endpoints

Iterating over large lists (orders, products, deliveries).

Pagination model

In MVP, list endpoints use page + limit (offset-based). Each paginated list accepts:

Query paramTypeDefaultMax
pageint1
limitint20100

Response shape

{
  "data": [ /* records */ ],
  "pagination": {
    "page": 1,
    "limit": 20,
    "total": 247
  }
}

Example

curl "https://api.nuvlyx.com/api/v1/external/orders?page=2&limit=50" \
  -H "Authorization: Bearer nvl_live_YOUR_TOKEN"

Walk the full list

let page = 1;
const all = [];
while (true) {
  const r = await fetch(`.../external/orders?page=${page}&limit=100`, {
    headers: { Authorization: `Bearer ${TOKEN}` }
  });
  const { data, pagination } = await r.json();
  all.push(...data);
  if (page * pagination.limit >= pagination.total) break;
  page++;
}

Cursor pagination?

In the future we'll migrate high-volume lists (webhook deliveries, wallet transactions) to cursor pagination (?cursor=...) for consistency on rapidly-changing data. This page will be updated with the exact contract once it ships. Meanwhile, sort by createdAt DESC and use dateFrom / dateTo to bound windows instead of paginating deep.