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

# Pagination

> List endpoints in the DFNS API use cursor-based pagination via limit and paginationToken query parameters.

List endpoints return a page of results and an optional token to fetch the next page.

## Request parameters

| Parameter         | Type    | Default | Description                                         |
| ----------------- | ------- | ------- | --------------------------------------------------- |
| `limit`           | integer | 50      | Maximum number of items to return.                  |
| `paginationToken` | string  | —       | Opaque token returned by the previous page request. |

## Response shape

```json theme={null}
{
  "items": [...],
  "nextPageToken": "eyJhb..."
}
```

`nextPageToken` is only present when there are more results. When absent, you have reached the last page.

## Fetching all pages

Pass `nextPageToken` from each response as `paginationToken` in the next request until no `nextPageToken` is returned.

```typescript theme={null}
async function fetchAll<T>(listFn: (token?: string) => Promise<{ items: T[], nextPageToken?: string }>): Promise<T[]> {
  const all: T[] = []
  let token: string | undefined

  do {
    const page = await listFn(token)
    all.push(...page.items)
    token = page.nextPageToken
  } while (token)

  return all
}
```
