Documentation menu

Pagination & sorting

Every list endpoint takes the same two query parameters — page and limit — and returns the same pagination envelope. That is the entire list API surface: there is no filtering and no sort parameter.

Parameters and envelope

curl "https://api.carbon-calculator.eventzero.io/api/v2/events?page=2&limit=50" \
  -H "Authorization: Bearer <accessToken>"

# → { "success": true, "data": {
#      "items": [ … ],
#      "pagination": { "page": 2, "limit": 50, "total": 137, "totalPages": 3 }
#    } }
  • page — 1-based page number; defaults to 1.
  • limit — page size 1–100; defaults to 25.
FieldTypeRequiredDescription
pageintegeroptionalThe 1-based page number that was returned for this list response.
limitintegeroptionalThe page size (maximum number of records) applied to this response, clamped to 1–100 (default 25).
totalintegeroptionalTotal number of records matching the query across all pages.
totalPagesintegeroptionalTotal number of pages available for the query, computed as ceil(total / limit).

No filtering or sorting — plan for it

List endpoints accept no filter parameters, and ordering is fixed (newest records first, by creation order). If your integration needs a subset — events in a date range, records for one supplier — fetch the pages and filter client-side:

Draining a list
let page = 1, totalPages = 1;
const all = [];
while (page <= totalPages) {
  const res = await fetch(`${BASE}/events?page=${page}&limit=100`, { headers });
  const { data } = await res.json();
  all.push(...data.items);
  totalPages = data.pagination.totalPages;
  page += 1;
}
Change detection: There is also no updated-since query and no webhooks yet. Detecting changes means re-paginating the list and diffing against your last sync. Schedule syncs accordingly, and mind the write rate limits when pushing large backfills.