1. Docs
  2. API Reference
  3. Change a grant in the organization

Change a grant in the organization

PATCH/api/v1/organizations/{id}/assignments/{assignmentId}

Changes the role or the window of an assignment at the organization node or beneath it. A new role meets the grant ceiling; dates alone do not. The last administrator's role at the organization node cannot be changed away (409 organization.last_admin). Requires the same as creating one.

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
assignmentIdstring 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

role_idstring Required
effective_fromstring Optional
effective_tostring Optional

Responses

application/json

  • dataAssignmentResponseDto*

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.

403assignment.grant_ceilingForbidden
When it happens

The caller is an identity (a customer's own administrator, acting with its session token) granting a role it may not: the role carries a permission the caller does not hold at the target node or above. Applies to creating an assignment (the organization's assignments route included), changing an assignment's role, and creating an invitation that carries a role. Console users, API keys, and the organization's own administrator inside its organization are never bounded; removing an assignment never is.

Remediation

Grant a role whose every permission the caller holds at that node, read the roles the caller may grant from <code>GET /api/v1/organizations/{id}/nodes/{nodeId}/grantable-roles</code> and offer only those, or make the change with your API key.

409assignment.version_mismatchConflict
When it happens

The request sent <code>If-Match</code> with a version older than the assignment's current one: somebody changed the assignment since it was read.

Remediation

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

409organization.last_adminConflict
When it happens

The change would leave the organization with no active holder of <code>canopy:organization.manage</code> at its node: removing the last administrator, taking that role from them, or changing it to one without the key.

Remediation

Make someone else an administrator of the organization first, then make the change.

Returned object

Request
curl -X PATCH "https://auth.canopy-io.com/api/v1/organizations/value/assignments/value" \
  -H "If-Match: "3"" \
  -H "X-API-Key: $CANOPY_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "role_id": "string",
    "effective_from": "string",
    "effective_to": "string"
  }'
Response
{
  "data": {
    "id": "string",
    "identity_id": "string",
    "oauth_client_id": "string",
    "application_node_id": "string",
    "role_id": "string",
    "role_name": "string",
    "node_name": "string",
    "effective_from": "2026-04-20T12:00:00.000Z",
    "effective_to": "2026-04-20T12:00:00.000Z",
    "created_at": "2026-04-20T12:00:00.000Z",
    "updated_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
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
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 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.