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.

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.

RouteFiltersItems are in
GET /v1/mailboxesnonedata
GET /v1/campaignsstatusdata
GET /v1/campaigns/{id}/leadsstatusdata
GET /v1/blocklistkinddata
GET /v1/repliescategory, campaign_iddata
GET /v1/autopilot/runsstatusitems
GET /v1/ordersnoneitems
GET /v1/icpsnoneitems
GET /v1/webhooksnoneitems
GET /v1/webhooks/{id}/deliveriesstatusitems

#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.

RouteFiltersItems 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 for the headers to watch and how to back off.

Pagination