The API uses cursor-based pagination to efficiently traverse large datasets. This approach is more reliable than offset-based pagination when data may change between requests.
How it works
- Include an optional
limitparameter in the request (default: 100, max: 1000) - Inspect the
paginationobject in the response - If
has_moreistrue, pass thecursorvalue to retrieve the next page
Example
Initial request:
curl -H "x-api-key: sk_live_your_key" \
"https://portal.h2gc.com/api/v1/financials?metric=ggr_annual&country=United+Kingdom&limit=50"Response:
{
"meta": {
"dataset": "ggr_annual",
"metric": "ggr_annual",
"granularity": "annual",
"filters_applied": { "country": ["United Kingdom"] },
"row_count": 50
},
"data": ["...50 rows..."],
"pagination": {
"cursor": "eyJvIjo1MH0",
"has_more": true
}
}Subsequent request — include the same filters along with the cursor:
curl -H "x-api-key: sk_live_your_key" \
"https://portal.h2gc.com/api/v1/financials?metric=ggr_annual&country=United+Kingdom&limit=50&cursor=eyJvIjo1MH0"Pagination fields
| Field | Type | Description |
|---|---|---|
cursor | string | null | Opaque cursor string for the next page. null when no more data. |
has_more | boolean | Indicates whether additional data is available beyond this page. |
Best practices
- Do not decode cursors — cursors should be treated as opaque strings. The internal format may change without notice.
- Maintain consistent parameters — the same query filters should be used when paginating. Changing filters mid-pagination produces undefined results.
- Respect limits — the maximum
limitis 1000 rows per request.