# Pagination

> Page through a zone's version history and the audit log with limit and before; most other lists come whole.

Most list methods answer the whole list in `items`. The two that grow without bound page with `limit` and `before`, newest first:

| Method (TypeScript / Python) | `limit` | `before` |
|---|---|---|
| `listZoneVersions` / `list_zone_versions` | Default 50, maximum 500. | A version number: only older versions. |
| `listAudit` / `list_audit` | Default 100, maximum 500. | An entry `id`: only older entries. |

Pass the last item's `version` or `id` as `before` to get the next page. An empty `items` means you have reached the end.

**TypeScript**

```ts
let before: number | undefined;
for (;;) {
  const { items = [] } = await owf.listAudit({ limit: 500, before });
  if (items.length === 0) break;
  for (const e of items) console.log(e.at, e.actor, e.action);
  before = items[items.length - 1].id;
}
```
**Python**

```py
before = None
while True:
    items = owf.list_audit(limit=500, before=before)["items"]
    if not items:
        break
    for e in items:
        print(e["at"], e["actor"], e["action"])
    before = items[-1]["id"]
```


The same loop works for a zone's history with `listZoneVersions({ zone, limit, before })` and the `version` of the last item.

`listCachePurges` / `list_cache_purges` takes a `limit` (default 20, maximum 100) but no `before`: it covers the last 7 days.
