Get Your API Key
- Sign in at heretic.quest/dashboard.
- Navigate to heretic.quest/dashboard/keys.
- Locate the site you want to configure, then copy the key shown next to it.
Use Your Key
Collector Initialisation
Pass your key as theapiKey option when you create a Collector instance. The collector is a client-side library — the key is intentionally visible in your front-end bundle for this purpose.
The collector
apiKey is client-side by design. It identifies your site to Heretic’s edge so measurements are attributed correctly. It only authorises the collector to submit measurements — it does not grant access to verdict results, which require a server-side explain call.Explain Endpoint Calls
Your backend exchanges a session ID for a full verdict by calling the explain endpoint. Pass your API key as aBearer token in the Authorization header.
Best Practices
Store your explain-endpoint key in environment variables
Store your explain-endpoint key in environment variables
The key you use in server-side explain calls must never appear in client-side code or be committed to version control. Inject it at runtime via an environment variable — for example
HERETIC_API_KEY — and read it in your backend handler.Keep client and server uses separate
Keep client and server uses separate
Your
apiKey in the collector is expected to be public. Your Authorization header key in explain calls is a server secret. Do not reuse the same variable name or configuration path for both — keep them explicitly separated so you do not accidentally expose the server key in a bundle.
