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

# Pagination

> Navigate through large result sets

# Pagination

List endpoints that may return large result sets support page-based pagination.

## Query Parameters

| Parameter   | Type    | Default | Range | Description               |
| ----------- | ------- | ------- | ----- | ------------------------- |
| `page`      | integer | `1`     | 1+    | The page number to return |
| `page_size` | integer | `50`    | 1–200 | Number of items per page  |

## Response Format

Paginated endpoints wrap results in a standard envelope:

```json theme={null}
{
  "data": [ ... ],
  "pagination": {
    "total": 142,
    "page": 1,
    "page_size": 50,
    "total_pages": 3
  }
}
```

| Field         | Description                              |
| ------------- | ---------------------------------------- |
| `total`       | Total number of items matching the query |
| `page`        | Current page number                      |
| `page_size`   | Items per page                           |
| `total_pages` | Total number of pages                    |

## Example: Iterating Through All Pages

```javascript theme={null}
async function fetchAllAttendees(eventId, apiKey) {
  const attendees = [];
  let page = 1;
  let totalPages = 1;

  while (page <= totalPages) {
    const response = await fetch(
      `https://www.gomry.com/api/v1/events/${eventId}/attendees?page=${page}&page_size=200`,
      { headers: { "X-API-KEY": apiKey } }
    );

    const result = await response.json();
    attendees.push(...result.data);
    totalPages = result.pagination.total_pages;
    page++;
  }

  return attendees;
}
```

<Note>
  Not all list endpoints are paginated. Endpoints that always return a bounded number of items (like ticket classes for an event) return a flat `{ "data": [...] }` response without pagination metadata.
</Note>
