OptionalapiKey?: stringAPI key for authentication. Required unless x402 is enabled.
OptionalapiKeyLocation?: "header" | "query"Where the API key is sent: 'query' (default) as the api_key query parameter, or
'header' as the X-Api-Key request header, which keeps the key out of URLs (and so out
of access logs, proxies, tracing and transport errors). 'header' is for server-side use:
the Glassnode API's CORS preflight does not allow X-Api-Key, so browsers block it.
With 'header', redirects are not followed (the request is sent with redirect: 'manual'):
fetch would otherwise resend X-Api-Key to whatever origin a 3xx names. A 3xx surfaces as
a non-retried GlassnodeApiError with that status; point apiUrl at the final URL.
'query' keeps fetch's default redirect handling (the URL, key included, goes wherever the
server's Location says, which only the server that already received the key controls).
OptionalapiUrl?: stringBase URL for the Glassnode API. Default https://api.glassnode.com, or
https://x402.glassnode.com when x402 is set. An explicit value always wins over the
x402 preset.
Optionalfetch?: GlassnodeFetchOptional custom fetch function (e.g. an x402-wrapped fetch, or for testing). Called with a
string URL as fetch(url) or fetch(url, init); see GlassnodeFetch.
Optionalhooks?: {Optional structured observability hooks (onRequest, onResponse, onRetry, onError),
called synchronously and never awaited; a failing hook never affects the call. See
GlassnodeHooks.
Optionallogger?: LoggerOptional logger for API call debugging; its own failures (throw/rejection) are ignored.
OptionalmaxRetries?: numberMaximum number of retries for retryable failures: a 429/5xx response, or a transport
failure (GlassnodeNetworkError, including a per-attempt timeout). Default 0 (no retries).
OptionalmaxRetryDelay?: numberUpper bound (ms) for a single retry wait, after exponential growth.
OptionalretryDelay?: numberBase delay in milliseconds between retries (doubles each attempt, then full jitter).
Optionaltimeout?: numberPer-request timeout in milliseconds. When set, each attempt is aborted via
AbortSignal.timeout() after this many ms (a fresh signal per retry). Unset = no timeout.
Optionalx402?: booleanRoute requests through the x402 paid endpoint (https://x402.glassnode.com).
Configuration for the Glassnode API client