Pagination

Pagination

List endpoints in the Fenerum API use page-based pagination to help you efficiently retrieve large datasets. By default, each page contains 20 items.

Pagination Parameters

All list endpoints support the following query parameters:

  • page - The page number to retrieve (default: 1)
  • page_size - Number of results per page (default: 20, max: 100)

Response Format

Paginated responses include these fields:

FieldTypeDescription
countintegerTotal number of items available (across all pages)
nextstring (url), nullableURL to fetch the next page of results
previousstring (url), nullableURL to fetch the previous page of results
resultsarrayArray of objects for the current page

Example Request

GET /api/v1/accounts/?page=2&page_size=50

Example Response

{
  "count": 247,
  "next": "https://app.fenerum.com/api/v1/accounts/?page=3&page_size=50",
  "previous": "https://app.fenerum.com/api/v1/accounts/?page=1&page_size=50",
  "results": [
    {
      "uuid": "123e4567-e89b-12d3-a456-426614174000",
      "code": "CUST001",
      "name": "Example Customer"
    }
    // ... more results
  ]
}

Iterating Through Pages

To retrieve all items, follow the next URL until it becomes null:

url = '/api/v1/accounts/'
all_accounts = []

while url:
    response = requests.get(url, headers=headers)
    data = response.json()
    all_accounts.extend(data['results'])
    url = data['next']

Best Practices

  • Use appropriate page_size values based on your needs (smaller for UI, larger for data exports)
  • Always check the next field to determine if more pages exist
  • Use filters to reduce the total number of results before paginating
  • Cache results when possible to reduce API calls
Previous
Errors
background logo

We invoice 2 billion DKK annually for our customers. Let's put your invoicing on autopilot today!