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

# Pagination

> Navigate large collections of resources with page-based pagination.

All list endpoints in the TRXN API return paginated results. The default page size is 25 items per page.

## Request parameters

<ParamField query="page" type="integer" default="1">
  The page number to retrieve. Pages are 1-indexed.
</ParamField>

## Making a paginated request

```bash theme={null}
curl https://api.gettrxn.com/v1/customers?page=2 \
  -H "Authorization: Bearer $TRXN_TOKEN"
```

## Response format

Every paginated response includes a `pagination` object alongside the resource array:

```json theme={null}
{
  "customers": [
    {"id": "cust_abc123", "email": "alice@example.com", "...": "..."},
    {"id": "cust_def456", "email": "bob@example.com", "...": "..."}
  ],
  "pagination": {
    "page": 2,
    "pages": 5,
    "count": 112
  }
}
```

<ResponseField name="page" type="integer">
  The current page number.
</ResponseField>

<ResponseField name="pages" type="integer">
  The total number of pages available.
</ResponseField>

<ResponseField name="count" type="integer">
  The total number of items across all pages.
</ResponseField>

## Page size

All endpoints return **25 items per page**. This is not configurable.

## Iterating through all pages

To retrieve all records, increment the `page` parameter until `page` equals `pages`:

<CodeGroup>
  ```ruby Ruby theme={null}
  page = 1
  all_customers = []

  loop do
    response = api_client.list_customers(page: page)
    all_customers.concat(response["customers"])

    break if page >= response["pagination"]["pages"]
    page += 1
  end
  ```

  ```javascript Node.js theme={null}
  let page = 1;
  let allCustomers = [];

  while (true) {
    const response = await fetch(
      `https://api.gettrxn.com/v1/customers?page=${page}`,
      { headers: { "Authorization": `Bearer ${token}` } }
    );
    const data = await response.json();
    allCustomers.push(...data.customers);

    if (page >= data.pagination.pages) break;
    page++;
  }
  ```

  ```python Python theme={null}
  import requests

  page = 1
  all_customers = []

  while True:
      response = requests.get(
          f"https://api.gettrxn.com/v1/customers?page={page}",
          headers={"Authorization": f"Bearer {token}"}
      )
      data = response.json()
      all_customers.extend(data["customers"])

      if page >= data["pagination"]["pages"]:
          break
      page += 1
  ```
</CodeGroup>

## Paginated endpoints

All list endpoints support pagination:

| Endpoint                        | Resource key            |
| ------------------------------- | ----------------------- |
| `GET /v1/customers`             | `customers`             |
| `GET /v1/products`              | `products`              |
| `GET /v1/prices`                | `prices`                |
| `GET /v1/invoices`              | `invoices`              |
| `GET /v1/subscriptions`         | `subscriptions`         |
| `GET /v1/wallets`               | `wallets`               |
| `GET /v1/crypto_addresses`      | `crypto_addresses`      |
| `GET /v1/crypto_transactions`   | `crypto_transactions`   |
| `GET /v1/crypto_payment_claims` | `crypto_payment_claims` |
| `GET /v1/payment_claim_links`   | `payment_claim_links`   |
| `GET /v1/webhook_endpoints`     | `webhook_endpoints`     |

<Note>
  An empty page (no results) still returns a valid pagination object with `count: 0` and `pages: 0`.
</Note>
