1. Docs
  2. API Reference
  3. Explain a node-scoped authorization decision

Explain a node-scoped authorization decision

POST/portal/v1/accounts/{accountSlug}/applications/{appSlug}/environments/{envSlug}/permissions/evaluate/explain

Returns 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

Bearer TokenAuthorization

JWT access token. Never send alongside X-API-Key: a request carrying both is refused.

Requires capability env_permissions.viewDeveloper Console

View 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

  • dataPermissionTraceDto*

application/json

  • errorApiErrorBodyDto*

application/json

  • errorApiErrorBodyDto*

application/json

  • errorApiErrorBodyDto*

Errors

When the request can't be completed, the response body includes a stable error code you can branch on.

403account.capability_requiredForbidden
When it happens

The signed-in user's administrator roles do not grant the capability this endpoint requires.

Remediation

Ask an account administrator to grant a role carrying the capability named in the Authentication section, then retry.

Returned object

Request
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"
  }'
Response
{
  "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
          }
        ]
      }
    ]
  }
}
Related endpoints
GETList permission catalog
POSTRegister new permission(s)
GETGet a permission
PATCHUpdate permission metadata
DELETERemove a permission
GETGet where a permission is used
Was this page helpful?

Tell us how we can improve this guide.