Resources
Pagination
How list endpoints page through results with a cursor.
List endpoints that can return many items — chats, connections — are cursor‑paginated.
How it works
A list response includes a cursor. If it is non‑null, pass it back as the cursor query parameter to get the next page. A null cursor means there are no more items.
# first page
curl "https://api.correctinbox.com/v1/relations?account_id=acc_8f21c0&limit=40" \
-H "X-API-KEY: $CORRECTINBOX_API_KEY"
# next page
curl "https://api.correctinbox.com/v1/relations?account_id=acc_8f21c0&limit=40&cursor=eyJvZmZzZXQiOjQwfQ" \
-H "X-API-KEY: $CORRECTINBOX_API_KEY"
async function* allRelations(accountId) {
let cursor = null;
do {
const qs = new URLSearchParams({ account_id: accountId, limit: "40" });
if (cursor) qs.set("cursor", cursor);
const page = await (
await fetch(`https://api.correctinbox.com/v1/relations?${qs}`, {
headers: { "X-API-KEY": process.env.CORRECTINBOX_API_KEY },
})
).json();
yield* page.relations;
cursor = page.cursor;
} while (cursor);
}
def all_relations(account_id):
cursor = None
while True:
params = {"account_id": account_id, "limit": 40}
if cursor:
params["cursor"] = cursor
page = requests.get(
"https://api.correctinbox.com/v1/relations",
headers={"X-API-KEY": os.environ["CORRECTINBOX_API_KEY"]},
params=params,
).json()
yield from page["relations"]
cursor = page.get("cursor")
if not cursor:
break
Notes
limitis a hint; the API may return fewer items than requested.- Treat the
cursoras opaque — don't construct or parse it yourself. - Search uses
pages(1–3) instead of a cursor, because provider search depth is capped.