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

# Pagination

> Cursor pagination conventions for list endpoints.

## Overview

List endpoints use cursor pagination (Stripe-style). You request a page using cursors; the API returns a list envelope with `has_more`.

## Authentication

Pagination applies to any list endpoint, regardless of auth mode. Use the auth header required by the route you’re calling (for example, `x-api-key` for merchant invoice lists or `x-commerce-api-key` for commerce lists).

## Request

Query parameters:

* `limit` (default `10`, max `100`)
* `starting_after` (cursor)
* `ending_before` (cursor)

Example request:

```bash theme={null}
BASE_URL=${PEPAY_API_URL}

curl "$BASE_URL/api/v1/invoices?limit=10&starting_after=550e8400-e29b-41d4-a716-446655440000" \
  -H "x-api-key: sk_live_..."
```

## Response

Response envelope:

```json theme={null}
{
  "object": "list",
  "data": [],
  "has_more": false
}
```

## Errors

* `400` invalid cursor or limit values
* `401/403` invalid credentials for the endpoint

## Examples

Example (expansions + payments page size):

```bash theme={null}
BASE_URL=${PEPAY_API_URL}

curl "$BASE_URL/api/v1/invoices?limit=10&expand=latest_payment,payments&payments_limit=5" \
  -H "x-api-key: sk_live_..."
```

Next: [Errors](/api-spec/errors)
