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

# Pagination

Cursor pagination with auto-walking listAll() iterators.

# Pagination

Every list endpoint returns:

```ts
{ data: T[], cursor: string | null, has_more: boolean }
```

Pass the returned `cursor` to the next call to walk the page chain.

## Manual paging

```ts
let cursor: string | undefined;
while (true) {
  const page = await roger.conversations.list({ status: "open", cursor });
  for (const conv of page.data) {
    console.log(conv.id, conv.subject);
  }
  if (!page.has_more) break;
  cursor = page.cursor ?? undefined;
}
```

## Auto-walking — `listAll()`

Most list resources expose an async iterator that handles paging for you:

```ts
for await (const conv of roger.conversations.listAll({ status: "open" })) {
  console.log(conv.id, conv.subject);
}

for await (const contact of roger.contacts.listAll({ q: "@acme.com" })) {
  console.log(contact.email);
}
```

Each call to `next()` lazily fetches the next page only when the current
one is exhausted. Stop iterating early to avoid the next request.

## Limits

| Endpoint | Default `limit` | Max |
|----------|---------------:|----:|
| Conversations | 50 | 100 |
| Messages | 100 | 100 |
| Contacts | 50 | 100 |
| KB articles | 50 | 100 |
| Forms | (no pagination yet) | — |
| Beacons | (no pagination yet) | — |

## Sorting

```ts
await roger.conversations.list({
  status: "open",
  // Underlying API supports `sort` + `order` parameters. Pass them via
  // the resource client when you need them:
} as any);
```

For full sort flexibility on edge cases, drop to a raw fetch with the
SDK's `http` client or use the v1 API directly.