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']

Filtering

Many list endpoints support filtering to narrow down results. Filters are applied using query parameters.

Basic Filtering

Filter by a specific field value:

GET /api/v1/invoices/?account=CUST001

Comparison Filters

Use suffixes for advanced filtering:

SuffixMeaningExample
__ltLess thanamount__lt=100
__lteLess than or equalcreated_date__lte=2025-12-31
__gtGreater thanamount__gt=50
__gteGreater than or equalcreated_date__gte=2025-01-01

Example: Date Range

Get invoices created in December 2025:

GET /api/v1/invoices/?created_date__gte=2025-12-01&created_date__lt=2026-01-01

Combining Filters and Pagination

You can combine filtering with pagination:

GET /api/v1/invoices/?account=CUST001&page=2&page_size=50

The count field in the response shows the total filtered results, and next/previous URLs preserve your filters.

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
  • Check endpoint documentation for available filters
Previous
Errors
background logo

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