Pagination
How list endpoints split results into pages.
GET /codes and GET /leads return results in pages of 100, newest first.
Pass page (starting at 1) to choose a page. The response says which page it is and how many items match in total:
{
"data": [],
"page": 2,
"total": 187
}
There are ceil(total / 100) pages. Keep requesting the next page until you've read total items or a page comes back empty:
async function allCodes(apiKey) {
const codes = [];
for (let page = 1; ; page++) {
const response = await fetch(
`https://dynaqr.app/api/v1/codes?page=${page}`,
{ headers: { Authorization: `Bearer ${apiKey}` } },
);
const { data, total } = await response.json();
codes.push(...data);
if (data.length === 0 || codes.length >= total) return codes;
}
}
The page size is fixed. Filters such as search or codeId apply before paging, so total counts only matching items.
GET /bio-pages returns every bio page in one response and has no pages.