Pagination
Lists use cursors, so pages stay consistent while new records arrive.
Every list returns its records in data, most recent first, and a next_cursor. Pass next_cursor back as cursor to get the next page. On the last page, next_cursor is null.
{
"data": [
{ "id": "fv_01m4ra8vqve0xv4yfe92canf5a", "external_id": "FV-2026-004413", "status": "completed" },
{ "id": "fv_01m4ra8vm8ftt8c369qnakj40p", "external_id": "FV-2026-004107", "status": "completed" }
],
"next_cursor": "eyJpZCI6ImZ2XzAxSkE3UFozRDFRVyJ9"
}| Parameter | Meaning |
|---|---|
limit | Records per page, from 1 to 500. Default 100. |
cursor | The next_cursor of the previous page. Treat it as opaque; do not build or edit it. |
| Filters | Each list has its own, such as external_id, status, created_from and created_to. Keep the same filters on every page. |
Read every page
async function* listAll(token, path, params = {}) {
let cursor = null;
do {
const qs = new URLSearchParams({ ...params, limit: '500', ...(cursor && { cursor }) });
const res = await fetch(`https://api.b2b.heru.app/v1${path}?${qs}`, {
headers: { Authorization: `Bearer ${token}` },
});
const page = await res.json();
yield* page.data;
cursor = page.next_cursor;
} while (cursor);
}
for await (const v of listAll(token, '/fiscal-validations', { status: 'completed' })) {
console.log(v.external_id, v.status);
}