Requests and responses
Pagination
Read long lists a page at a time with cursors.
Cursor pagination
List endpoints return one page at a time. The response's links object has self, next and prev. To get the next page, request the next link exactly as it is. It repeats your filter, sort and fields and adds a page[cursor]. On the last page next is null, and on the first page so is prev.
json
"links": {
"self": "https://email.growthdept.ai/api/profiles?page[size]=20",
"next": "https://email.growthdept.ai/api/profiles?page[size]=20&page[cursor]=eyJ2Ijoi...",
"prev": null
}Page size
Set page[size] to choose how many resources come back, within each endpoint's range. Out of range returns 400 invalid on page[size].
About cursors
- Treat a cursor as opaque. It encodes where the page ends and is signed, so an edited cursor returns 400
invalidonpage[cursor]. - A cursor belongs to the sort it was made with. Changing
sortwhile keeping the cursor is refused the same way. - Pages are keyed on the sort value and the id, so resources added or removed while you page through do not make you skip or repeat others.
Reading every page
Node
let url = "https://email.growthdept.ai/api/profiles?page[size]=100";
const headers = {
Authorization: `Klaviyo-API-Key ${process.env.GD_EMAIL_PRIVATE_KEY}`,
accept: "application/vnd.api+json",
revision: "2026-10-15",
};
while (url) {
const res = await fetch(url, { headers });
if (!res.ok) throw new Error(`${res.status}: ${await res.text()}`);
const page = await res.json();
for (const profile of page.data) {
// use profile.id and profile.attributes
}
url = page.links.next;
}