> ## Documentation Index
> Fetch the complete documentation index at: https://direct-api.reap.global/llms.txt
> Use this file to discover all available pages before exploring further.

# Pagination

> List endpoints take page and limit and return items plus a meta block. Follow meta.totalPages, not a short page.

List endpoints take two query parameters:

| Param | Default | Range |
| - | - | - |
| `page` | 1 | 1+ |
| `limit` | 20 | 1–100 |

and return the same envelope:

```json theme={"system"}
{
  "items": [ ... ],
  "meta": {
    "totalItems": 57,
    "itemCount": 20,
    "itemsPerPage": 20,
    "totalPages": 3,
    "currentPage": 1
  }
}
```

## Iterate until `totalPages`

> [!WARNING]
>
> A page can return fewer items than `meta.itemsPerPage` even when more pages
> exist. Loop until `currentPage == totalPages`; never stop at a short page.

```javascript theme={"system"}
const items = [];
let page = 1;
let totalPages = 1;
while (page <= totalPages) {
  const res = await fetch(`${API}/cards?page=${page}&limit=100`, {
    headers: { "x-api-key": KEY },
  }).then((r) => r.json());
  items.push(...res.items);
  totalPages = res.meta.totalPages;
  page++;
}
```

```python theme={"system"}
items = []
page, total_pages = 1, 1
while page <= total_pages:
    res = requests.get(
        f"{API}/cards", params={"page": page, "limit": 100},
        headers={"x-api-key": KEY},
    ).json()
    items += res["items"]
    total_pages = res["meta"]["totalPages"]
    page += 1
```

New items appear while you paginate, so expect minor overlap or shifts in
live data.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.