1. Docs
  2. API Reference
  3. Replace an organization role's permissions

Replace an organization role's permissions

PUT/api/v1/organizations/{id}/roles/{roleId}/permissions

Replaces the permissions of a role the organization owns. A permission the role already carries may stay or go; one being added must be held by the caller at the organization node when the caller is an identity (403 organization.role_permission_not_held). Adding canopy:roles.manage to a role held beneath the organization node is refused (400 rbac.roles_manage_below_organization). The role's version moves with the change; send If-Match to refuse a stale write. Requires rbac.manage_roles or the organization's roles delegation.

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
roleIdstring Required

Headers

  • If-Match

    Optimistic-lock version of the resource. Send the `version` field returned on read; the server rejects with 409 if the row has changed since.

Request body

application/json

permission_keysstring[] Required

Responses

application/json

  • itemsPermissionResponseDto[]*

application/json

  • errorApiErrorBodyDto*

application/json

  • errorApiErrorBodyDto*

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, and a correlation_id (also sent as the X-Correlation-Id header). Quote the correlation id when you contact support: it identifies the exact request in Canopy's logs.

400rbac.roles_manage_below_organizationBad request
When it happens

A role carrying <code>canopy:roles.manage</code> would be held beneath the organization node: granted at an office or team, moved there, or given the key while someone holds it there. The organization's roles belong to the whole organization, so the key counts only at its node.

Remediation

Grant the role at the organization node, or use a role without <code>canopy:roles.manage</code> beneath it.

403organization.role_permission_not_heldForbidden
When it happens

The role would carry a permission the editor does not hold at the organization node. <code>data.permission_keys</code> names each one. A permission the role already carries may stay; only one being added must be held.

Remediation

Leave those permissions out, or ask someone who holds them, or the developer, to add them.

403organization.role_not_ownedForbidden
When it happens

The role is one of the Environment's, which every organization uses and only the developer changes. An organization changes, re-permissions or deletes only the roles it owns.

Remediation

Copy the role (<code>POST /api/v1/organizations/{org_id}/roles</code> with <code>copy_from_role_id</code>) and change the copy.

409version_mismatchConflict
When it happens

The request sent <code>If-Match</code> with a version older than the resource's current one: somebody changed it since it was read. The error's <code>data</code> carries the resource as it now stands under <code>current</code>.

Remediation

Read the resource again, show the reader what changed, and retry with the current <code>version</code>.

Returned object

Request
curl -X PUT "https://auth.canopy-io.com/api/v1/organizations/value/roles/value/permissions" \
  -H "If-Match: "3"" \
  -H "X-API-Key: $CANOPY_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "permission_keys": [
      "string"
    ]
  }'
Response
{
  "items": [
    {
      "id": "string",
      "application_id": "string",
      "key": "string",
      "name": "string",
      "description": "string",
      "category": "string",
      "source": "system",
      "created_at": "2026-04-20T12:00:00.000Z",
      "version": 0
    }
  ]
}
Related endpoints
GETWhat the caller administers in an organization
GETList the organization's tree as the caller sees it
GETList who holds a role at a node in the organization
GETSummarize who holds a role at a node in the organization
GETList the roles the caller may grant at a node
GETList the organization's members, for granting a role at a node
POSTGrant a role at a node beneath the organization
PATCHChange a grant in the organization
DELETETake a grant in the organization away
GETList organizations
POSTCreate an organization
DELETEDelete every organization
GETGet an organization
PATCHUpdate an organization
DELETEDelete an organization
GETGet an organization's authentication policy
PATCHUpdate an organization's authentication policy
POSTRegenerate the organization's SSO recovery codes
POSTStart a test sign-in on the organization's connection
GETRead the organization's test sign-in
GETList the organization's domain claims
POSTClaim a domain for the organization
POSTVerify one of the organization's domains
DELETERemove one of the organization's domain claims
GETList an organization's SSO connections
POSTBind an SSO connection to an organization
DELETEUnbind an SSO connection from an organization
GETList an organization's members
POSTAdd a member to an organization
DELETERemove a member from an organization
POSTReset a member's multi-factor authentication
GETList an organization's invitations
POSTInvite a member into an organization
GETList the roles an organization may assign
POSTCreate an organization's own role
DELETERevoke an organization invitation
GETGet an organization's SSO connection
POSTSet up an organization's SSO connection
PATCHChange an organization's SSO connection
DELETERemove an organization's SSO connection
POSTActivate an organization's SSO connection
POSTDisable an organization's SSO connection
POSTImport the identity provider's SAML metadata
GETList the connection's recent sign-ins
GETList the roles the organization's SSO sign-ins may arrive with
GETGet the service-provider values for an organization's SSO connection
GETGet an organization's directory connection
POSTCreate an organization's directory connection
DELETERemove an organization's directory connection
GETList an organization's directory-sync tokens
POSTMint a directory-sync token for an organization
POSTReplace a directory-sync token without an outage
DELETERevoke a directory-sync token
GETRecent directory-sync activity for an organization
GETList the roles an organization's directory may grant
PUTReplace the roles an organization's directory may grant
GETList an organization's integrations
POSTCreate an integration
GETList the roles an organization may give its integrations
GETGet one of an organization's integrations
PATCHRename, disable or enable an integration
DELETEDelete an integration
POSTRotate an integration's secret
GETList an integration's roles
POSTGive an integration a role
PATCHChange one of an integration's roles
DELETETake one of an integration's roles away
GETCount an organization's own roles
GETList the permissions a role editor may attach
GETGet one role an organization can use
PATCHRename or describe an organization's own role
DELETEDelete an organization's own role
GETList the groups an organization's provider has pushed
PUTMap a pushed group to one of the available roles
DELETEClear a pushed group's role mapping
Was this page helpful?

Tell us how we can improve this guide.