---
title: "Pagination and cursors"
url: "https://coldagentai.com/docs/pagination.md"
canonical_url: "https://coldagentai.com/docs/pagination"
last_updated: "2026-11-04"
type: "conceptual"
summary: "How list routes return pages with limit and cursor, which routes page, and how to walk every page of campaigns, leads, replies and webhooks."
related: ["https://coldagentai.com/docs/rate-limits.md", "https://coldagentai.com/docs/api.md", "https://coldagentai.com/docs/api/campaigns.md", "https://coldagentai.com/docs/api/leads.md", "https://coldagentai.com/docs/api/replies.md", "https://coldagentai.com/docs/api/webhooks.md"]
install: "claude mcp add --transport http coldagentai-free https://coldagentai.com/api/mcp"
---

# Pagination and cursors

> **For AI agents:** the complete index of ColdAgentAI pages is [llms.txt](https://coldagentai.com/llms.txt). Every page is also served as markdown at its URL plus .md.

How list routes return pages with limit and cursor, which routes page, and how to walk every page of campaigns, leads, replies and webhooks.

List routes return one page at a time. You ask for a page size with `limit` and walk forward with the `next_cursor` each response gives you.

## How paging works

Paged routes take two query parameters. `limit` is the page size, from 1 to 100, and it defaults to 20 when you leave it out. `cursor` is the value of `next_cursor` from the previous response; leave it out to start at the beginning.

A page:

```
{
  "data": [ { "id": "..." } ],
  "next_cursor": "..."
}
```

`next_cursor` is a string while more items remain and `null` on the last page. Treat the cursor as opaque: pass it back exactly as you received it and never build one yourself. A value that is not in the cursor format is refused with `400 invalid_input` naming the `cursor` field.

The last page:

```
{
  "data": [ { "id": "..." } ],
  "next_cursor": null
}
```

A cursor continues from the last item you saw. The key that holds the items is `data` on some routes and `items` on others; the tables below name it for each route.

## Routes that page

These routes accept `limit` and `cursor`. The filters narrow the list and can be combined with paging; keep the same filters on every request of one walk.

| Route | Filters | Items are in |
| --- | --- | --- |
| GET /v1/mailboxes | none | `data` |
| GET /v1/campaigns | `status` | `data` |
| GET /v1/campaigns/{id}/leads | `status` | `data` |
| GET /v1/blocklist | `kind` | `data` |
| GET /v1/replies | `category`, `campaign_id` | `data` |
| GET /v1/autopilot/runs | `status` | `items` |
| GET /v1/orders | none | `items` |
| GET /v1/icps | none | `items` |
| GET /v1/webhooks | none | `items` |
| GET /v1/webhooks/{id}/deliveries | `status` | `items` |

## Routes that return everything at once

These list routes have no `limit` or `cursor`. One call returns the whole list, and there is no `next_cursor` to follow.

| Route | Filters | Items are in |
| --- | --- | --- |

## Walking every page

Ask for the largest page size, read the items, and repeat with `next_cursor` until it is `null`. Both examples walk `GET /v1/campaigns`; change the path and the key for another route.

cURL:

```
cursor=""
while :; do
  page=$(curl -s "https://api.coldagentai.com/v1/campaigns?limit=100${cursor:+&cursor=$cursor}" \
    -H "Authorization: Bearer $COLDAGENTAI_API_KEY")
  echo "$page" | jq -c '.data[]'
  cursor=$(echo "$page" | jq -r '.next_cursor // empty')
  [ -z "$cursor" ] && break
done
```

Node:

```
const base = 'https://api.coldagentai.com';
const headers = { Authorization: `Bearer ${process.env.COLDAGENTAI_API_KEY}` };

async function* walk(path, key = 'data', params = {}) {
  let cursor = null;
  do {
    const query = new URLSearchParams({ limit: '100', ...params });
    if (cursor) query.set('cursor', cursor);
    const res = await fetch(`${base}${path}?${query}`, { headers });
    const body = await res.json();
    if (!res.ok) throw new Error(`${body.error.code}: ${body.error.fix}`);
    yield* body[key];
    cursor = body.next_cursor;
  } while (cursor);
}

for await (const item of walk('/v1/campaigns')) console.log(item.id);
```

> A walk is a series of ordinary requests, so each page counts against your key's budget. See [rate limits](https://coldagentai.com/docs/rate-limits.md) for the headers to watch and how to back off.

## Related

- [Rate limits and backoff](https://coldagentai.com/docs/rate-limits.md)
- [API reference](https://coldagentai.com/docs/api.md)
- [Campaigns API reference](https://coldagentai.com/docs/api/campaigns.md)
- [Leads API reference](https://coldagentai.com/docs/api/leads.md)
- [Replies API reference](https://coldagentai.com/docs/api/replies.md)
- [Webhook endpoints API reference](https://coldagentai.com/docs/api/webhooks.md)
