Skip to content

Pagination

List endpoints use cursor pagination. Pass limit (default 50, at most 200) and, for later pages, the cursor you were given.

Terminal window
curl "https://api.sandbox.halvorai.com/v1/events?limit=100" \
-H "Authorization: Bearer $HALVOR_API_KEY"
{ "data": [ { "id": "evt_01JA8Q..." } ], "next_cursor": "eyJ0IjoiMjAyNi0xMC0xN..." }

When next_cursor is null, there are no more pages. Otherwise pass it back unchanged:

Terminal window
curl "https://api.sandbox.halvorai.com/v1/events?limit=100&cursor=eyJ0IjoiMjAyNi0xMC0xN..." \
-H "Authorization: Bearer $HALVOR_API_KEY"
  • Treat the cursor as opaque. Do not parse it or build one yourself.
  • Keep the same filters on every page of one listing.
  • Results are ordered newest first, and new items arriving during a listing do not shift pages you have not read.
let cursor: string | null = null;
do {
const url = new URL('https://api.sandbox.halvorai.com/v1/alerts');
url.searchParams.set('limit', '200');
if (cursor !== null) url.searchParams.set('cursor', cursor);
const res = await fetch(url, { headers: { Authorization: `Bearer ${process.env.HALVOR_API_KEY}` } });
const page = (await res.json()) as { data: unknown[]; next_cursor: string | null };
// handle page.data
cursor = page.next_cursor;
} while (cursor !== null);