> ## Documentation Index
> Fetch the complete documentation index at: https://docs.verial.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Pagination

> Cursor-based iteration across SDK list endpoints.

Every `list()` method returns a `Page<T>`. Pages are async-iterable, so the simplest consumer iterates across every item across every page transparently.

## Auto-iterate

```typescript theme={null}
for await (const env of await verial.environments.list()) {
  console.log(env.id)
}
```

The iterator fetches successive pages lazily as you consume items.

## One Page at a Time

```typescript theme={null}
let page = await verial.environments.list({ limit: 50 })

do {
  for (const env of page.data) {
    console.log(env.id)
  }
  const next = await page.getNextPage()
  if (!next) break
  page = next
} while (true)
```

## Page Surface

| Member          | Type                             | Description                              |
| --------------- | -------------------------------- | ---------------------------------------- |
| `data`          | `T[]`                            | Items in this page                       |
| `hasNextPage()` | `() => boolean`                  | `true` if another page is available      |
| `getNextPage()` | `() => Promise<Page<T> \| null>` | Fetches the next page, or `null` if none |
| `toJSON()`      | `() => { data, _meta }`          | Serializable snapshot                    |
| `_meta.next`    | `string \| null`                 | Next cursor                              |
| `_meta.prev`    | `string \| null`                 | Previous cursor                          |
| `_meta.limit`   | `number`                         | Page size                                |

## Options

All list methods accept:

| Option   | Type   | Description                   |
| -------- | ------ | ----------------------------- |
| `cursor` | string | Resume from a specific cursor |
| `limit`  | number | Items per page                |

## Early Exit

Stop iteration whenever you want — the SDK doesn't prefetch pages.

```typescript theme={null}
for await (const run of await verial.runs.list()) {
  if (run.verdict === 'pass') {
    return run
  }
}
```
