Get where a permission is used
/portal/v1/accounts/{accountSlug}/applications/{appSlug}/environments/{envSlug}/permissions/{id}/usageReturns 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
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.
Path Parameters
idstring Required Responses
application/json
data *PermissionUsageDto
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 GET "https://auth.canopy-io.com/portal/v1/accounts/{accountSlug}/applications/{appSlug}/environments/{envSlug}/permissions/value/usage" \ -H "Authorization: Bearer $CANOPY_TOKEN"
{ "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 } ] } }
Tell us how we can improve this guide.