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:
| Field | Type | Description |
|---|---|---|
count | integer | Total number of items available (across all pages) |
next | string (url), nullable | URL to fetch the next page of results |
previous | string (url), nullable | URL to fetch the previous page of results |
results | array | Array of objects for the current page |
Example Request
GET /api/v1/accounts/?page=2&page_size=50Example 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=CUST001Comparison Filters
Use suffixes for advanced filtering:
| Suffix | Meaning | Example |
|---|---|---|
__lt | Less than | amount__lt=100 |
__lte | Less than or equal | created_date__lte=2025-12-31 |
__gt | Greater than | amount__gt=50 |
__gte | Greater than or equal | created_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-01Combining Filters and Pagination
You can combine filtering with pagination:
GET /api/v1/invoices/?account=CUST001&page=2&page_size=50The count field in the response shows the total filtered results, and next/previous URLs preserve your filters.
Best Practices
- Use appropriate
page_sizevalues based on your needs (smaller for UI, larger for data exports) - Always check the
nextfield 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