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

Replace permissions on a role

PUT/api/v1/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 Option A

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

API KeyX-API-Key Option B

API key for management-tier access. Never send alongside an Authorization header: a request carrying both is refused.

Path Parameters

idstring Required

Request body

application/json

permission_keysstring[] Required

Responses

application/json

  • dataMessageResponseDto*

application/json

  • errorApiErrorBodyDto*

application/json

  • errorApiErrorBodyDto*

application/json

  • errorApiErrorBodyDto*

Returned object

Request
curl -X PUT "https://auth.canopy-io.com/api/v1/roles/value/permissions" \
  -H "X-API-Key: $CANOPY_API_KEY" \
  -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.