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

# Pagination

> How each DialNexa v1 list endpoint paginates results, with the exact response envelope per endpoint.

DialNexa list endpoints do not yet share a single response envelope. This page documents the exact shape each v1 list endpoint returns today, so you can parse responses without guessing. Each endpoint page also shows its full response schema in the panel on the right.

## Request parameters

Most paginated endpoints accept `page` and `limit`, but defaults and maximums are not fully standardized. Use the endpoint contract as the source of truth.

| Parameter | Type    | Default | Description                                                 |
| --------- | ------- | ------- | ----------------------------------------------------------- |
| `page`    | integer | `1`     | The page number to retrieve. Starts at `1`.                 |
| `limit`   | integer | Varies  | Number of records per page. The maximum varies by endpoint. |

### Example request

```bash theme={null}
curl "https://api.dialnexa.com/v1/workflows?page=2&limit=50" \
  -H "Authorization: Bearer YOUR_API_KEY"
```

## Response envelopes by endpoint

| Endpoint                                                                                                                                                                                                                                                                                                      | Records live in | Pagination fields                                                                                              |
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------- | -------------------------------------------------------------------------------------------------------------- |
| [`GET /v1/workflows`](/docs/api-reference/v1/workflows/list)                                                                                                                                                                                                                                                       | `data`          | `meta.totalItems`, `meta.itemsPerPage`, `meta.totalPages`, `meta.currentPage`                                  |
| [`GET /v1/batch-calls`](/docs/api-reference/v1/batches/list)                                                                                                                                                                                                                                                       | `items`         | `total`, `page`, `limit` at the top level                                                                      |
| [`GET /v1/organization-phone-numbers`](/docs/api-reference/v1/phone-numbers/list)                                                                                                                                                                                                                                  | `items`         | `total`, `page`, `limit` at the top level                                                                      |
| [`GET /v1/voices`](/docs/api-reference/v1/voices/list)                                                                                                                                                                                                                                                             | `voices`        | `total`, `page`, `limit`, `totalPages` at the top level                                                        |
| [`GET /v1/user-webhooks`](/docs/api-reference/v1/webhooks/list)                                                                                                                                                                                                                                                    | `webhooks`      | `total`, `page`, `limit`, `totalPages` at the top level; default limit is `10`                                 |
| [`GET /v1/agents`](/docs/api-reference/v1/agents/list)                                                                                                                                                                                                                                                             | `agents`        | None. The full list is returned.                                                                               |
| [`GET /v1/voices/s2s`](/docs/api-reference/v1/voices/s2s)                                                                                                                                                                                                                                                          | `voices`        | None. The full list is returned.                                                                               |
| [`GET /v1/workflows/{workflowId}/leads`](/docs/api-reference/v1/workflow-leads/list)                                                                                                                                                                                                                               | `data`          | `count` at the top level                                                                                       |
| [`GET /v1/calls`](/docs/api-reference/v1/calls/list)                                                                                                                                                                                                                                                               | Root JSON array | Accepts `page` and `limit`, but the response body carries no pagination metadata; documented maximum is `200`. |
| [`GET /v1/knowledge-base`](/docs/api-reference/v1/knowledge-base/list)                                                                                                                                                                                                                                             | `items`         | `meta.totalItems`, `meta.itemsPerPage`, `meta.totalPages`, `meta.currentPage`                                  |
| [`GET /v1/languages`](/docs/api-reference/v1/languages/list), [`GET /v1/llms`](/docs/api-reference/v1/llms/list), [`GET /v1/llms/fallback`](/docs/api-reference/v1/llms/fallback), [`GET /v1/transcribers`](/docs/api-reference/v1/transcribers/list), [`GET /v1/transcribers/fallback`](/docs/api-reference/v1/transcribers/fallback) | Root JSON array | None. These are small catalogs returned in full.                                                               |

Three practical rules follow from the table:

1. **Check the endpoint page before parsing.** The records key differs per endpoint (`data`, `items`, `voices`, `webhooks`, `agents`, or the root array).
2. **For calls, which accept `page` and `limit` without returning pagination metadata**, page forward until a request returns fewer records than `limit`.
3. **Catalog endpoints** (languages, LLMs, transcribers) return the full list. Fetch them once at startup or deploy time instead of paging.

## Example: the workflows envelope

`GET /v1/workflows` wraps records in `data` and reports pagination in `meta`:

```json theme={null}
{
  "statusCode": 200,
  "message": "Workflows fetched successfully",
  "data": [
    { "id": "workflow_abc123", "status": "active" },
    { "id": "workflow_def456", "status": "paused" }
  ],
  "meta": {
    "totalItems": 320,
    "itemsPerPage": 50,
    "totalPages": 7,
    "currentPage": 2
  }
}
```

## Iterating through all pages

For endpoints with a `totalPages` style field, iterate until you pass the last page. This example uses workflows:

```typescript theme={null}
async function fetchAllWorkflows(apiKey: string) {
  const workflows = [];
  let page = 1;

  while (true) {
    const response = await fetch(
      `https://api.dialnexa.com/v1/workflows?page=${page}&limit=100`,
      { headers: { Authorization: `Bearer ${apiKey}` } }
    );
    const { data, meta } = await response.json();

    workflows.push(...data);

    if (page >= meta.totalPages) {
      break;
    }
    page++;
  }

  return workflows;
}
```

```python theme={null}
import requests

def fetch_all_workflows(api_key: str) -> list:
    workflows = []
    page = 1

    while True:
        response = requests.get(
            "https://api.dialnexa.com/v1/workflows",
            headers={"Authorization": f"Bearer {api_key}"},
            params={"page": page, "limit": 100}
        )
        payload = response.json()
        workflows.extend(payload["data"])

        if page >= payload["meta"]["totalPages"]:
            break
        page += 1

    return workflows
```

For calls, which return a root array while accepting `page` and `limit`, stop when a page comes back with fewer records than `limit`:

```python theme={null}
import requests

def fetch_all_calls(api_key: str) -> list:
    calls = []
    page = 1
    limit = 100

    while True:
        batch = requests.get(
            "https://api.dialnexa.com/v1/calls",
            headers={"Authorization": f"Bearer {api_key}"},
            params={"page": page, "limit": limit}
        ).json()
        calls.extend(batch)

        if len(batch) < limit:
            break
        page += 1

    return calls
```

## Related pages

* [Errors](/docs/api-reference/errors): the standard error format returned when a request fails.
