Replace permissions on a role
/portal/v1/accounts/{accountSlug}/applications/{appSlug}/environments/{envSlug}/roles/{id}/permissionsReplaces the role's entire permission set with the supplied permission_keys (a full overwrite, not a merge). Every key must exist in the Environment's catalog or the call returns 404, and system-source permissions cannot be attached to a custom role (400). Returns 200 with a { message } confirmation, requires the rbac.manage_roles permission, and emits a role.permissions_updated audit event.
Authentication
AuthorizationJWT access token. Never send alongside X-API-Key: a request carrying both is refused.
env_roles.manageDeveloper ConsoleCreate, edit, and delete roles and set their permissions. Granted through an administrator role in the Admin Workspace; a valid token without it is refused with 403.
Path Parameters
idstring Required Request body
application/json
permission_keysstring[] Required Responses
application/json
data *MessageResponseDto
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 PUT "https://auth.canopy-io.com/portal/v1/accounts/{accountSlug}/applications/{appSlug}/environments/{envSlug}/roles/value/permissions" \ -H "Authorization: Bearer $CANOPY_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "permission_keys": [ "string" ] }'
{ "data": { "message": "string" } }
Tell us how we can improve this guide.