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
| Parameter | Type | Notes |
|---|---|---|
limit | integer | Optional. Defaults to 100. Must be between 1 and 256 unless the endpoint defines a different limit type. |
cursor | string | Optional. 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"
}
datacontains the page of results.nextis 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.