Skip to main content

Pagination

List endpoints return a pagination envelope alongside the data:

{
"data": [...],
"pagination": {
"page": 1,
"per_page": 20,
"total": 142,
"total_pages": 8
}
}

Query parameters

ParameterTypeDefaultMax
pageinteger1
per_pageinteger20100

Iterating

async function* iterateAll(path, token) {
let page = 1;
while (true) {
const res = await fetch(`https://perks.founderpass.com${path}?page=${page}&per_page=100`, {
headers: { Authorization: `Bearer ${token}` },
}).then((r) => r.json());

yield* res.data;
if (page >= res.pagination.total_pages) break;
page++;
}
}

:::tip Pick the largest page size your job tolerates Larger pages mean fewer round trips. per_page=100 is the maximum and is the right choice for nightly syncs. :::