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 page
  • before: 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"
  }
}
  1. For the first request, omit both after and before parameters
  2. For subsequent pages:
    • Next page: Use the nextCursor value as the after parameter
    • Previous page: Use the prevCursor value as the before parameter

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_at and updated_at timestamps — 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.