# Pagination

List calls return one page at a time. Ask for a page with `limit` and `offset`, and read the `pagination` block to know how many there are.

```json
{
  "data": [ { "id": "3f9a…", "title": "Future Media Summit" } ],
  "pagination": { "limit": 50, "offset": 0, "total": 132 }
}
```

| Parameter | Default | Meaning |
|---|---|---|
| `limit` | `50` | how many items to return; most lists allow up to `200` |
| `offset` | `0` | how many items to skip |

The reference lists the exact range for each call. A `limit` outside it is rejected with `422`.

## Read every page

Keep asking until `offset` reaches `total`.

```javascript tab=Node group=pages
async function allEvents(key) {
  const events = [];
  for (let offset = 0; ; offset += 200) {
    const res = await fetch(
      `https://api.audiobly.com/v1/events?limit=200&offset=${offset}`,
      { headers: { Authorization: `Bearer ${key}` } },
    );
    const { data, pagination } = await res.json();
    events.push(...data);
    if (offset + data.length >= pagination.total) return events;
  }
}
```

```python tab=Python group=pages
def all_events(session):
    events, offset = [], 0
    while True:
        page = session.get(
            "https://api.audiobly.com/v1/events",
            params={"limit": 200, "offset": offset},
        ).json()
        events += page["data"]
        offset += len(page["data"])
        if offset >= page["pagination"]["total"] or not page["data"]:
            return events
```

Lists are ordered newest first unless the reference says otherwise. Some calls page differently: transcripts over MCP use a `cursor`, and a few small lists return everything in one response.
