Pagination

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.no/snapbooks/api/v2/documents?limit=25’
-H ‘Authorization: Bearer your-token-here’

Next page

curl -X GET
‘https://api.snapbooks.no/snapbooks/api/v2/documents?limit=25&after=next_cursor_value’
-H ‘Authorization: Bearer your-token-here’

Relaterte artikler