Delete an organization's own role
/api/v1/organizations/{id}/roles/{roleId}Deletes a role the organization owns. Everyone holding it loses it, and the pending invitations that offer it are revoked. Refused while it is a role directory sync or single sign-on gives new people. The Environment's roles are refused (403 organization.role_not_owned). Send If-Match with the role's version to refuse a stale delete. Requires rbac.manage_roles or the organization's roles delegation.
Authentication
Authorization Option A JWT access token. Never send alongside X-API-Key: a request carrying both is refused.
X-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-MatchOptimistic-lock version of the resource. Send the `version` field returned on read; the server rejects with 409 if the row has changed since.
Responses
The role is deleted
application/json
error *ApiErrorBodyDto
application/json
error *ApiErrorBodyDto
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, 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.
organization.role_not_ownedForbiddenThe 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.
Copy the role (<code>POST /api/v1/organizations/{org_id}/roles</code> with <code>copy_from_role_id</code>) and change the copy.
version_mismatchConflictThe 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>.
Read the resource again, show the reader what changed, and retry with the current <code>version</code>.
curl -X DELETE "https://auth.canopy-io.com/api/v1/organizations/value/roles/value" \ -H "If-Match: "3"" \ -H "X-API-Key: $CANOPY_API_KEY"
HTTP/1.1 204 The role is deleted (empty body)
Tell us how we can improve this guide.