Offset paging for lists
Owner, AdminLast checked 25 November 20261 min readArticle ID:
developers-offset-pagingOn this page
Browse a page of records at a time with page and per_page. Newest first, with a total.
Every list endpoint (GET /customers, /contacts, /jobs, /visits, /invoices, /estimates, /payments, /credit-notes) pages in offset mode unless you ask for sync mode. Use it to show or browse records.
GET /api/v1/invoices?status=paid&page=2&per_page=50
{ "data": [ … ], "meta": { "page": 2, "per_page": 50, "total": 137 } }
The rules
pagecounts from 1.per_pageis 1 to 100 (default 25). A value outside that is clamped, not refused.- Newest first.
meta.totalis the number of records, so you can show "page 2 of 3" and know when to stop.- Filters work too.
job_id,customer_id,invoice_idandstatus(depending on the resource) combine with paging. Astatusthat isn't valid, or an id that isn't a ULID, is422 validation_failed. - Unknown query parameters are ignored.
- Archived records are left out of most lists. See Are archived records included in lists?.
Read every page
let page = 1, total = Infinity;
const all = [];
while (all.length < total) {
const res = await call(`/jobs?page=${page}&per_page=100`);
all.push(...res.data);
total = res.meta.total;
if (res.data.length === 0) break;
page++;
}
When not to use it
If records are created while you page, a later page can repeat or skip a record. That doesn't matter for a screen someone is looking at. For a copy of the data that has to be exact, use sync mode: it follows changes in order and never misses one. See Keep your system in sync.
Reading many pages in a loop uses your rate limit: take 100 at a time.