Skip to main content

Work with cursor pagination

HeliumGeek endpoints that return collections use cursor-based pagination. Each response includes the current items plus a pointer you can use to fetch the next page.

Request parameters

ParameterTypeNotes
limitintegerOptional. Defaults to 100. Must be between 1 and 256 unless the endpoint defines a different limit type.
cursorstringOptional. Empty string ('') starts from the most recent records. The server embeds the next cursor inside the response so you never have to construct it manually.

Many time-series endpoints also accept min_time and max_time. Combine time filters with pagination when you need determinate slices (for example, one month at a time).

Response contract

All list responses implement the ListResponse<T> shape:

ListResponse
{
"data": [
{ "/* ... */": "" }
],
"next": "/gateways?cursor=abc123"
}
  • data contains the page of results.
  • next is omitted when no further pages exist. When present, it is a relative path (for example, /v0/gateways?cursor=abc123). Append it to the same host you used for the original request and call it as-is—no cursor parsing or rewriting required.

Iteration example

const BASE_URL = 'https://heliumgeek.com';
let nextPath: string | undefined = '/v0/gateways?limit=100';

while (nextPath) {
const response = await fetch(`${BASE_URL}${nextPath}`, {
headers: { 'x-api-key': process.env.HELIUM_API_KEY! },
});
if (!response.ok) throw new Error(`Request failed: ${response.status}`);

const page = await response.json() as { data: unknown[]; next?: string };
processGateways(page.data);
nextPath = page.next;
}

This approach works for every paginated endpoint—only the request path changes.