Pagination
Every list endpoint speaks one pagination contract. You may page with limit / offset or with page / pageSize — both are accepted everywhere, and every list answers with the same pagination block.
Query Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
limit | number | 50 | Page size. Clamped to 1–200. |
offset | number | 0 | Row offset to start from. |
page | number | 1 | 1-based page number. Converted to an offset. |
pageSize | number | 50 | Alias of limit. |
When both spellings are sent, pageSize wins over limit, and an explicit offset wins over page — the unambiguous value is the one that is honoured. A size above 200 is clamped to 200 rather than rejected.
Response Format
The rows are in data and the window is described in pagination, in both dialects:
{
"data": [
"..."
],
"pagination": {
"total": 500,
"limit": 50,
"offset": 0,
"hasMore": true,
"page": 1,
"pageSize": 50,
"totalPages": 10
}
}Legacy keys are still there. Each list also keeps the keys it has always returned —
products and totalCount on /products, documents, total, page and pageSize on /documents. Same rows, two spellings; nothing was removed.Lists That Do Not Paginate
Not every list takes a window. These return the whole set and ignore limit, offset and page entirely — a request for page 2 silently serves page 1 again:
GET /purchase— narrow it withstartDate/endDateorvendorIdinsteadGET /retainers,GET /files,GET /warehousesGET /products/id/:id/serials,GET /custom-fieldsGET /grow/tokens,GET /grow/providersGET /document-execution-statuses,GET /reports/documents/saved
Two lists report a page-local total. On
GET /grow/payments/payment-pages and GET /grow/recurring-payments, pagination.total counts the rows in the page you were handed rather than the rows that exist, and hasMore is derived from that same number. Page those two until a short page comes back rather than trusting the total.Iterating All Pages
let offset = 0;
const limit = 200;
while (true) {
const { data, pagination } = await glance.clients.list({ limit, offset });
process(data);
if (!pagination.hasMore) break;
offset += limit;
}async function* paginate(endpoint, token) {
let offset = 0;
const limit = 200;
while (true) {
const res = await fetch(
`https://api.glance.co.il${endpoint}?limit=${limit}&offset=${offset}`,
{ headers: { Authorization: `Bearer ${token}` } },
);
const json = await res.json();
yield* json.data;
if (!json.pagination.hasMore) break;
offset += limit;
}
}Paging a moving set. Offsets describe positions, not rows: if documents change while you page, an offset-based sweep can repeat or skip them. To follow changes rather than read a snapshot, use the cursor feed described in Incremental Sync.