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
after
andbefore
parameters - For subsequent pages:
- Next page: Use the
nextCursor
value as theafter
parameter - Previous page: Use the
prevCursor
value as thebefore
parameter
- Next page: Use the
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’