Lists and pages
Every list answers { "data": [...], "nextCursor": "..." }. Ask for up to 100 at a time with limit (50 when left out). When nextCursor isn’t null, send it back as cursor for the next page.
curl "https://api.paieday.com/v1/companies/cmp_Xq2b9Lr0aKsT/employees?limit=100&cursor=ZW1wX..." \ -H "Authorization: Bearer $PAIE_API_KEY"Keep going until nextCursor is null:
let cursor = null;const people = [];do { const url = new URL( "https://api.paieday.com/v1/companies/cmp_Xq2b9Lr0aKsT/employees", ); url.searchParams.set("limit", "100"); if (cursor) url.searchParams.set("cursor", cursor); const res = await fetch(url, { headers: { Authorization: `Bearer ${key}` } }); const page = await res.json(); people.push(...page.data); cursor = page.nextCursor;} while (cursor);Treat a cursor as opaque text: don’t build one yourself, and don’t keep one for later.