Replace the roles an organization's directory may grant
/portal/v1/accounts/{accountSlug}/applications/{appSlug}/environments/{envSlug}/organizations/{id}/directory/grantable-rolesReplaces the whole list in one act. Withdrawing a role unmaps the groups that name it and releases the grants those mappings produced. An empty list removes the organization's own list: it then holds the Environment's identity-provider arrival roles when those are set, and otherwise directory sync is disabled for it, which is refused with 409 while its directory is live.
Authentication
AuthorizationJWT access token. Never send alongside X-API-Key: a request carrying both is refused.
env_organizations.manageDeveloper ConsoleSwitch the organizations container on and off and create, rename, and delete organizations. Granted through an administrator role in the Admin Workspace; a valid token without it is refused with 403.
Path Parameters
accountSlugstring Required The Account's slug. An unknown one answers 404.
appSlugstring Required The Application's slug within the Account.
envSlugstring Required The Environment's slug within the Application.
idstring Required Request body
application/json
role_idsstring[] Required The roles this organization's directory may grant. An empty list disables directory sync for the organization.
default_role_idstring Optional The role somebody arrives with when no mapped group says otherwise. Required unless the list is empty, and must be one of `role_ids`.
Responses
application/json
items *DirectoryGrantableRoleResponseDto[]
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.
account.capability_requiredForbiddenThe signed-in user's administrator roles do not grant the capability this endpoint requires.
Ask an account administrator to grant a role carrying the capability named in the Authentication section, then retry.
Returned object
curl -X PUT "https://auth.canopy-io.com/portal/v1/accounts/value/applications/value/environments/value/organizations/value/directory/grantable-roles" \ -H "Authorization: Bearer $CANOPY_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "role_ids": [ "string" ], "default_role_id": "string" }'
{ "items": [ { "id": "string", "name": "string", "description": "string", "is_default": false } ] }
Tell us how we can improve this guide.