Docs
Pagination
List endpoints use opaque cursors, so pages stay stable even while new data arrives.
Request
Parameters
limitintegeroptionalItems per page, 1–200. Defaults to 50.cursorstringoptionalThenext_cursorvalue from the previous page. Omit for the first page.
Response
GET /v1/contacts?limit=2
{
"data": [
{ "id": "b1e7…", "name": "Ananya Rao", "phone": "+919812345678" },
{ "id": "c9a2…", "name": "Rahul Mehta", "phone": "+919876543210" }
],
"next_cursor": "eyJjIjoiMjAyNi0xMS0xMVQxMDo0MjowMFoiLCJpIjoiYzlhMiJ9"
}When next_cursor is null you have reached the last page. Treat cursors as opaque strings — don't parse or construct them. Filters (e.g. q, tag) must be repeated unchanged on every page.
Iterating all pages
async function* allContacts() {
let cursor = null;
do {
const url = new URL("https://api.engage.swastik.ai/v1/contacts");
url.searchParams.set("limit", "200");
if (cursor) url.searchParams.set("cursor", cursor);
const res = await fetch(url, { headers: { Authorization: `Bearer ${process.env.ENGAGE_API_KEY}` } });
const page = await res.json();
yield* page.data;
cursor = page.next_cursor;
} while (cursor);
}
for await (const c of allContacts()) console.log(c.name);