---
title: "Pagination"
description: "How to work with paginated list responses in the Fenerum API"
url: https://www.fenerum.com/en-DK/docs/api/guides/pagination/
updated_at: "2025-12-22T00:00:00"
---
## 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

```bash
<!-- filename: Request GET /api/v1/accounts/ -->
GET /api/v1/accounts/?page=2&page_size=50
```

### Example Response

```json
<!-- filename: 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`:

```python
<!-- filename: iterate_pages.py -->
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](https://www.fenerum.com/en-DK/docs/api/guides/filtering.md) to reduce the total number of results before paginating
- Cache results when possible to reduce API calls

---

## Navigation

Up: [Subscription management & financial insights on autopilot](https://www.fenerum.com/en-DK/index.md) › [Documentation](https://www.fenerum.com/en-DK/docs.md) › [API Documentation](https://www.fenerum.com/en-DK/docs/api.md)

Full site index: https://www.fenerum.com/llms.txt
