Pagination
The Snapbooks API uses cursor-based pagination for list endpoints. This provides consistent results when navigating through large datasets.
Pagination Parameters
limit: Maximum number of items to return (default: 25, max: 100)after: Cursor for the next pagebefore: Cursor for the previous page
Example Request
GET /api/v2/documents?limit=25&after=cursor_value
Response Format
Paginated responses include:
{
"data": [...],
"pagination": {
"hasMore": true,
"nextCursor": "next_cursor_value",
"prevCursor": "previous_cursor_value"
}
}
Navigation
- For the first request, omit both
afterandbeforeparameters - For subsequent pages:
- Next page: Use the
nextCursorvalue as theafterparameter - Previous page: Use the
prevCursorvalue as thebeforeparameter
- Next page: Use the
Example Usage
```bash
First page
curl -X GET
‘https://api.snapbooks.com/v2/documents?limit=25’
-H ‘Authorization: Bearer your-token-here’
Next page
curl -X GET
‘https://api.snapbooks.com/v2/documents?limit=25&after=next_cursor_value’
-H ‘Authorization: Bearer your-token-here’
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 cursor 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.