# API pagination

> Page through lists in the Privatus Analytics API with page and per_page (up to 100), read the meta object, and page through ranked stats breakdowns with limit.

List operations take `page` (from 1) and `per_page` (default 25, maximum
100) and return a `meta` object:

```sh
curl "https://privatusanalytics.com/sites/pa_7Q2K9XH3AB/goals.json?page=2&per_page=50" \
  -H "Authorization: Bearer $PRIVATUS_TOKEN"
```

```json
{
  "data": [ … ],
  "meta": { "page": 2, "per_page": 50, "total": 132, "total_pages": 3 }
}
```

Loop until `page` equals `total_pages`.

## Breakdowns

Stats breakdowns page differently, because they're ranked results rather
than records: use `limit` (rows per page, up to 1,000) and `page`:

```text
GET /sites/pa_7Q2K9XH3AB/breakdown/page.json?limit=1000&page=3
```

Keep requesting pages until a page returns fewer rows than `limit`.
