Pagination
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.
For AI agents: the docs index is at /llms.txt, and every page is also served as markdown at its URL plus .md.
#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.
{
"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.
{
"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.
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
doneconst 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 for the headers to watch and how to back off.