1. Docs
  2. API Reference
  3. Replace permissions on a role

Replace permissions on a role

PUT/portal/v1/accounts/{accountSlug}/applications/{appSlug}/environments/{envSlug}/roles/{id}/permissions

Replaces 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

Bearer TokenAuthorization

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

Requires capability env_roles.manageDeveloper Console

Create, 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

  • dataMessageResponseDto*

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 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"
    ]
  }'
Response
{
  "data": {
    "message": "string"
  }
}
Related endpoints
GETList roles
POSTCreate a custom role
GETGet a role
PATCHUpdate a role
DELETEDelete a role
GETGet permissions for a role
Was this page helpful?

Tell us how we can improve this guide.