1. Docs
  2. API Reference
  3. Get where a permission is used

Get where a permission is used

GET/portal/v1/accounts/{accountSlug}/applications/{appSlug}/environments/{envSlug}/permissions/{id}/usage

Returns the roles that grant a permission, each with the number of distinct identities holding that role, plus role_count and the distinct identity_count the permission reaches overall. Because a permission is only ever held through a role, this is the full blast radius of deleting it — the listed roles are exactly the ones a delete would strip it from. Deactivated roles are included; identity_count is not the sum of the per-role counts, since one identity may hold several granting roles. Returns 404 when no permission with that id exists in the Environment. Requires the rbac.view_roles permission.

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.

Path Parameters

idstring Required

Responses

application/json

  • dataPermissionUsageDto*

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 GET "https://auth.canopy-io.com/portal/v1/accounts/{accountSlug}/applications/{appSlug}/environments/{envSlug}/permissions/value/usage" \
  -H "Authorization: Bearer $CANOPY_TOKEN"
Response
{
  "data": {
    "permission_id": "string",
    "role_count": 0,
    "identity_count": 0,
    "roles": [
      {
        "id": "string",
        "name": "string",
        "description": "string",
        "is_system_role": false,
        "is_active": false,
        "member_count": 0
      }
    ]
  }
}
Related endpoints
GETList permission catalog
POSTRegister new permission(s)
POSTExplain a node-scoped authorization decision
GETGet a permission
PATCHUpdate permission metadata
DELETERemove a permission
Was this page helpful?

Tell us how we can improve this guide.