Pagination
Most list endpoints in the Snapbooks v2 API are paginated with page numbers.
You ask for a page with page and per_page, and the response tells you how
many records and pages exist in total.
Pagination Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
| page | integer | 1 | 1-based page number |
| per_page | integer | 100 on most endpoints, 50 on some | Number of records per page |
The default page size differs per endpoint — each resource page states the
default that applies to it. There is no enforced upper bound on per_page,
but large pages are slower to build and transfer, so keep it to a few hundred
records at most.
page is clamped to the available range: asking for a page past the last one
returns the last page rather than an error or an empty list. Compare
meta.page in the response against the page you asked for to detect that you
have reached the end.
Example Request
GET /api/v2/documents?client_account_id=42&page=1&per_page=25
Response Format
Paginated responses wrap the records in data and the page counters in
meta:
{
"data": [
{ "id": 1001, "...": "..." },
{ "id": 1002, "...": "..." }
],
"meta": {
"page": 1,
"pages": 6,
"per_page": 25,
"records": 145
}
}
| Field | Type | Description |
|---|---|---|
| page | integer | The page that was returned (after clamping) |
| pages | integer | Total number of pages at the current per_page |
| per_page | integer | Page size used for this response |
| records | integer | Total number of records matching the request |
Navigation
- Request the first page, optionally setting
per_page. - Keep requesting
page + 1whilemeta.page < meta.pages. - Stop when
meta.pageequalsmeta.pages, or whenmeta.recordsis0.
Because pagination is offset-based, rows created or deleted while you are
iterating can shift between pages. For a stable sweep, filter on a date range
(most list endpoints support from_date/to_date or an equivalent) so the
result set does not change under you.
Example Usage
# First page
curl -X GET \
'https://api.snapbooks.com/v2/documents?client_account_id=42&per_page=25' \
-H 'Authorization: Bearer your-token-here'
# Next page
curl -X GET \
'https://api.snapbooks.com/v2/documents?client_account_id=42&per_page=25&page=2' \
-H 'Authorization: Bearer your-token-here'
Endpoints That Are Not Paginated
A few endpoints return small, bounded reference collections as a plain JSON
array with no meta object — for example GET /tax-codes
and GET /client-accounts/{id}/users.
These ignore page and per_page. The response shape is documented on each
resource page.
Polling for Changes
The API does not currently offer webhooks, so integrations that need to stay in sync poll the relevant list endpoints. Guidelines:
- Poll on a sensible interval for your use case (minutes, not seconds) and page through results with the parameters above.
- Most resources expose
created_atandupdated_attimestamps — compare them against the high-water mark from your previous sync to detect new and changed rows. - Use each endpoint’s filters (date ranges, status) to narrow the window you re-read, rather than re-listing entire resources.
If your integration needs push-style delivery, tell us at hei@snapbooks.no — it helps us prioritize.