Skip to main content
Once your backend receives a session ID from the client, you exchange it for a verdict by calling Heretic’s explain endpoint server-side. The endpoint returns a structured JSON object containing the overall ruling, a human-readable summary, the evidence families that contributed to the decision, and a flat list of individual signals with stable IDs you can key policy on. Because the call happens on your origin — no DNS changes, no reverse proxy required — the round trip adds only a lightweight server-to-edge fetch to your existing request handling.

Authentication

Pass your Heretic API key as a Bearer token in the Authorization header of every request to the explain endpoint.
Store the key in an environment variable (e.g. HERETIC_API_KEY). Never expose it in client-side code.

Calling the Explain Endpoint

Sample Response

Understanding the Response Fields

string
The overall ruling for the session. One of five values:
boolean
true when the evidence reaches the bar for hard enforcement — either a single absolute signal or multiple composite signals that corroborate each other. false indicates the verdict is directionally informative but not yet absolute.
string
A single English sentence describing the primary reason for the verdict. Suitable for logging; do not display it verbatim to end users.
string[]
The signal families that produced contradictions. Empty when verdict is not contradicted. Use this to tailor UI messaging (for example, surface a regional restriction notice when the list includes network-geometry).
object
Aggregate counts: measured is the number of families the collector attempted; reporting is the number that returned usable data.
Signal[]
Flat list of individual signals the collector gathered. Each signal has:
  • id — stable dot-namespaced identifier (e.g. geo.rtt-below-vacuum). Safe to hard-code in policy rules.
  • tier — evidence strength: composite signals require cross-family corroboration; other tiers indicate standalone or weaker evidence.
  • headline — short human-readable description of what the signal measured.

Error Responses

Handle these three error statuses before attempting to deserialize the response body as a verdict.
The Authorization header was absent, malformed, or the key has been revoked. Verify the key at heretic.quest/dashboard/keys and confirm your environment variable is set correctly in your deployment environment.
The session ID does not exist on the edge — either it was never created, it was already consumed, or it expired. Session IDs have a 15-minute lifetime. If you see frequent 404s, check that the collector’s collect() promise has resolved before you forward the ID to your backend.
Your key has exceeded its request budget for the current window. Back off with exponential jitter and retry. If you consistently hit this limit, review your integration — calling the explain endpoint more than once per session ID is unnecessary.
Session IDs expire 15 minutes after the collector issues them. Call the explain endpoint promptly — ideally within the same request that receives the session ID from the client.