Explain a node-scoped authorization decision
/portal/v1/accounts/{accountSlug}/applications/{appSlug}/environments/{envSlug}/permissions/evaluate/explainReturns a full authorization trace explaining why an identity is or isn't granted a permission at a node_id. In addition to the verdict (copied verbatim from the evaluate engine), the response includes the resolved lineage from the node up its ancestors, each node's role assignments, and which assignments actually grant the permission — useful for debugging inherited access. Returns 404 when the identity or node cannot be found; scoped API keys must carry the evaluate scope (403). Rate-limited to 200 requests/minute.
Authentication
AuthorizationJWT access token. Never send alongside X-API-Key: a request carrying both is refused.
env_permissions.viewDeveloper ConsoleView the permission catalog. Granted through an administrator role in the Admin Workspace; a valid token without it is refused with 403.
Request body
application/json
identity_idstring Required Identity ID (from the `identities` table — the end user being explained, not an admin).
permissionstring Required node_idstring Required The hierarchy node to explain the decision at. The lineage from the root to this node is walked and returned in the trace.
Responses
application/json
data *PermissionTraceDto
application/json
error *ApiErrorBodyDto
application/json
error *ApiErrorBodyDto
application/json
error *ApiErrorBodyDto
Errors
When the request can't be completed, the response body includes a stable error code you can branch on.
account.capability_requiredForbiddenThe signed-in user's administrator roles do not grant the capability this endpoint requires.
Ask an account administrator to grant a role carrying the capability named in the Authentication section, then retry.
Returned object
curl -X POST "https://auth.canopy-io.com/portal/v1/accounts/{accountSlug}/applications/{appSlug}/environments/{envSlug}/permissions/evaluate/explain" \ -H "Authorization: Bearer $CANOPY_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "identity_id": "string", "permission": "string", "node_id": "string" }'
{ "data": { "identity_id": "string", "permission": "string", "node_id": "string", "allowed": false, "denial_reason": "string", "effective_node_id": "string", "granting_role_ids": [ "string" ], "granting_node_ids": [ "string" ], "lineage": [ { "node_id": "string", "name": "string", "node_type": "string", "depth": 0, "is_target": false, "assignments": [ { "assignment_id": "string", "role_id": "string", "role_name": "string", "active": false, "effective_from": "string", "effective_to": "string", "grants_permission": false } ] } ] } }
Tell us how we can improve this guide.