# Pagination

List endpoints don't share a single pagination style — check the table below for the parameters and response shape of each one.

## Overview

Aurea's list endpoints use one of three parameter styles — `page` + `limit`, `limit` + `offset`, or `limit` + `skip` — and put the results under different fields. None uses cursors. Read the endpoint's own page before writing a generic paginator.

## List Endpoints

| Endpoint | Parameters | Response |
| --- | --- | --- |
| GET /v1/wallets/ | `limit` (default 50, max 100), `offset` (default 0) | `{ data, pagination: { total, limit, offset, hasMore } }` |
| GET /v1/users/ GET /v1/users/advanced-search | `limit`, `offset` | `{ data, pagination: { total, limit, offset, hasMore } }` |
| GET /v1/transactions/ GET /v1/transactions/aggregated/ | `page` (default 1), `limit` (default 20, max 100) | `{ data, pagination: { page, limit, total, totalPages } }` |
| GET /v1/ramp/bank/payin/deposits | `limit` (default 20), `offset` (default 0) | `{ deposits, total, limit, offset }` |
| GET /v1/ramp/bank/payin/transactions | `limit` (default 20), `offset` (default 0) | `{ transactions, total, limit, offset }` |
| GET /v1/ramp/bank/payout/transactions | `page` (default 1), `limit` (default 20) | `{ payouts, total, page, limit, totalPages }` |
| GET /v1/notifications/inbox | `limit` (default 20, max 100), `skip` (default 0) | `{ notifications, total }` |
| GET /v1/agent-payments/agents | `limit` (max 200), `offset` | `{ data }` |

## Page and Limit

For endpoints that return `pagination.totalPages` (on payouts, `totalPages` is at the top level):

```javascript
async function* pagesByNumber(url, token, limit = 50) {
  for (let page = 1; ; page++) {
    const res = await fetch(`${url}?page=${page}&limit=${limit}`, {
      headers: { Authorization: `Bearer ${token}` }
    });
    if (!res.ok) throw new Error(`HTTP ${res.status}`);
    const { data, pagination } = await res.json();
    yield data;
    if (page >= pagination.totalPages) return;
  }
}

// for await (const transactions of pagesByNumber('https://api.aureahub.com/v1/transactions/', token)) { ... }
```

## Limit and Offset

For endpoints that return `pagination.hasMore`. Where there is no `hasMore` (the bank ramp deposits and transactions), stop when `offset + limit` reaches `total`; the inbox uses `skip` instead of `offset`.

```javascript
async function* pagesByOffset(url, token, limit = 50) {
  for (let offset = 0; ; offset += limit) {
    const res = await fetch(`${url}?limit=${limit}&offset=${offset}`, {
      headers: { Authorization: `Bearer ${token}` }
    });
    if (!res.ok) throw new Error(`HTTP ${res.status}`);
    const { data, pagination } = await res.json();
    yield data;
    if (!pagination.hasMore) return;
  }
}

// for await (const wallets of pagesByOffset('https://api.aureahub.com/v1/wallets/', token)) { ... }
```

---

Web version: https://docs.aureahub.com/#pagination
