> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.livingbrain.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.livingbrain.com/_mcp/server.

# Pagination

Four endpoints return paginated collections:

| Method                      | Returns        |
| --------------------------- | -------------- |
| `workspace.listPages`       | `Page`         |
| `workspace.changes`         | `ChangeEvent`  |
| `workspace.listConnections` | `Connection`   |
| `captures.listSources`      | `IngestSource` |

All four use **offset pagination**: `limit` sets the page size, `offset` counts *items*
skipped (not pages). Responses carry `items`, `total`, `limit`, and `offset`.

## Let the SDK do it

Both SDKs return an iterator that fetches subsequent pages as you consume it, so the common
case needs no pagination code at all:

**`TypeScript`**

```typescript TypeScript
// Fetches more pages transparently as the loop advances
for await (const page of await client.workspace.listPages({ brainId })) {
  console.log(page.title);
}
```

**`Python`**

```python Python
for page in client.workspace.list_pages(brain_id=brain_id):
    print(page.title)

# Async
async for page in await aclient.workspace.list_pages(brain_id=brain_id):
    print(page.title)
```

## Page at a time

When you're rendering a paged UI, step explicitly:

**`TypeScript`**

```typescript TypeScript
let response = await client.workspace.listPages({ brainId, limit: 25 });

while (true) {
  for (const page of response.data) render(page);
  if (!response.hasNextPage()) break;
  response = await response.getNextPage();
}
```

**`Python`**

```python Python
pager = client.workspace.list_pages(brain_id=brain_id, limit=25)

for chunk in pager.iter_pages():
    for page in chunk.items or []:   # `items` is Optional on the pager
        render(page)
```

## Raw offsets

You can always drive it yourself:

**`TypeScript`**

```typescript TypeScript
const first = await client.workspace.listPages({ brainId, limit: 50, offset: 0 });
const second = await client.workspace.listPages({ brainId, limit: 50, offset: 50 });
```

**`Python`**

```python Python
first = client.workspace.list_pages(brain_id=brain_id, limit=50, offset=0)
second = client.workspace.list_pages(brain_id=brain_id, limit=50, offset=50)
```

> **Warn**
>
> Offset pagination isn't stable under concurrent writes — if pages are created while you
> iterate, you can see an item twice or skip one. For sync jobs, prefer the
> [change feed](/docs/changes) with `since`, which doesn't have this problem.