Explain API
Turn a policy decision into a plain-language explanation with POST /v1/explain, and retrieve it later with GET /v1/explain/{violation_id}.
Explanations are deterministic: the enforcer builds them from templates and the decision fields, with no model in the loop, so the same input always gives the same text. Use them to tell a user why an action was refused and what to do next. Both endpoints use your unified tenant API base URL and a runtime key; see Authentication.
Create an explanation
POST/v1/explain
Builds an explanation from the decision fields you send, stores it under the
tenant_id and violation_id, and returns it. It does not look the decision
up, so pass the values from the EnforcementDecision you received.
Body parameters
All fields are optional. Unset values fall back to neutral defaults.
tenant_idstring
violation_idstring
violation_id from a BLOCK decision. Used to store and retrieve the explanation.session_idstring
agent_idstring
user_idstring
tool_namestring
decision"ALLOW" | "STEP_UP" | "MODIFY" | "DEFER" | "BLOCK"
BLOCK.decision_reason_codestring
action_classificationstring
risk_scorenumber
severitystring
regulatory_regimesstring[]
matched_rule_idsstring[]
matched_control_idsstring[]
policy_referencesstring[]
approved_scopestring[]
step_up_timeout_secondsinteger
occurred_atstring (ISO 8601)
Returns
what_happenedstring
why_it_was_blockedstring
what_to_do_nextstring
business_impactstring
request_urlstring
severitystring
regulatory_contextstring | null
The response also echoes the identifiers and decision fields you sent
(violation_id, tenant_id, session_id, agent_id, user_id, tool_name,
decision, decision_reason_code, action_classification, risk_score,
regulatory_regimes, matched_rule_ids, matched_control_ids,
policy_references) and a timestamp.
Retrieve an explanation
GET/v1/explain/{violation_id}
Returns a stored explanation. Returns 404 if none exists for that violation
and tenant.
Path parameters
violation_idstringrequired
Query parameters
tenant_idstringrequired
Returns
The same explanation object returned when it was created.