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

# Pagination

> How pagination works in the Journeybee API

# Pagination

List endpoints return paginated results using offset-based pagination.

## Query parameters

| Parameter  | Type    | Default | Description              |
| ---------- | ------- | ------- | ------------------------ |
| `page`     | integer | `1`     | Page number (1-indexed)  |
| `per_page` | integer | `25`    | Items per page (max 100) |

## Response format

Paginated responses include a `pagination` object alongside the `data` array:

```json theme={null}
{
  "data": [
    {
      "uuid": "abc-123",
      "name": "Acme Corp"
    }
  ],
  "pagination": {
    "page": 1,
    "per_page": 25,
    "total": 42,
    "total_pages": 2
  }
}
```

## Example

Fetch the second page with 10 items per page:

```bash theme={null}
curl "https://api.journeybee.io/v1/partners?page=2&per_page=10" \
  -H "Authorization: Bearer YOUR_API_KEY"
```

## Iterating through all results

Increment `page` until it exceeds `total_pages`:

```javascript theme={null}
let page = 1;
let totalPages = 1;

do {
  const response = await fetch(
    `https://api.journeybee.io/v1/partners?page=${page}&per_page=100`,
    { headers: { Authorization: "Bearer YOUR_API_KEY" } },
  );
  const { data, pagination } = await response.json();

  // Process data...

  totalPages = pagination.total_pages;
  page++;
} while (page <= totalPages);
```

## Non-paginated endpoints

Some list endpoints (stages, tiers, categories, tags, custom fields) return all records without pagination since these collections are typically small.
