> ## Documentation Index
> Fetch the complete documentation index at: https://developer.plugchoice.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Pagination

> Navigate large result sets with page-based pagination.

List endpoints return paginated results with 25 items per page by default.

## Request

Use the `page` query parameter to navigate through pages:

```bash theme={null}
curl https://app.plugchoice.com/api/v3/chargers?page=2 \
  -H "Authorization: Bearer YOUR_API_TOKEN"
```

## Response format

Paginated responses include `data`, `links`, and `meta` fields:

```json theme={null}
{
  "data": [
    { "uuid": "abc-123", "identity": "CHARGER-001", ... },
    { "uuid": "def-456", "identity": "CHARGER-002", ... }
  ],
  "links": {
    "first": "https://app.plugchoice.com/api/v3/chargers?page=1",
    "last": null,
    "prev": "https://app.plugchoice.com/api/v3/chargers?page=1",
    "next": "https://app.plugchoice.com/api/v3/chargers?page=3"
  },
  "meta": {
    "current_page": 2,
    "from": 26,
    "path": "https://app.plugchoice.com/api/v3/chargers",
    "per_page": 25,
    "to": 50
  }
}
```

## Fields

| Field               | Description                                              |
| ------------------- | -------------------------------------------------------- |
| `data`              | Array of resources for the current page                  |
| `links.first`       | URL to the first page                                    |
| `links.last`        | URL to the last page (may be `null`)                     |
| `links.prev`        | URL to the previous page, or `null` if on the first page |
| `links.next`        | URL to the next page, or `null` if on the last page      |
| `meta.current_page` | Current page number                                      |
| `meta.from`         | Index of the first item on this page                     |
| `meta.to`           | Index of the last item on this page                      |
| `meta.per_page`     | Number of items per page                                 |

## Iterating through pages

To fetch all results, follow the `links.next` URL until it returns `null`:

```javascript theme={null}
let url = 'https://app.plugchoice.com/api/v3/chargers';
const allChargers = [];

while (url) {
  const response = await fetch(url, {
    headers: { 'Authorization': 'Bearer YOUR_API_TOKEN' }
  });
  const json = await response.json();
  allChargers.push(...json.data);
  url = json.links.next;
}
```
