Add resource permissions to existing roles
/portal/v1/accounts/{accountSlug}/applications/{appSlug}/environments/{envSlug}/setup/resource-permissionsAdds more resource.action permissions to the active Environment after initial setup and maps them onto existing roles via role_permissions. Unlike the bootstrap endpoint this runs against an already-configured Environment and has no unconfigured guard; permissions that already exist are skipped and role-permission mappings that already exist are not duplicated. Each referenced role must exist in this Environment (404 otherwise). Returns 201 with counts of permissions created and skipped and roles updated, and emits a resource_permissions.added audit event.
Authentication
AuthorizationJWT access token. Never send alongside X-API-Key: a request carrying both is refused.
env_permissions.manageDeveloper ConsoleCreate, edit, and delete permissions. Granted through an administrator role in the Admin Workspace; a valid token without it is refused with 403.
Request body
application/json
resourcesBootstrapResourceDto[] Required Resources to generate permissions for
role_permissionsResourcePermissionRoleDto[] Required Permission assignments for existing roles. Empty array creates the permissions without binding them to any role.
Responses
application/json
data *ResourcePermissionsResponseDto
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.
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 POST "https://auth.canopy-io.com/portal/v1/accounts/{accountSlug}/applications/{appSlug}/environments/{envSlug}/setup/resource-permissions" \ -H "Authorization: Bearer $CANOPY_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "resources": [ { "name": "notes", "actions": [ "create", "read", "update", "delete" ] } ], "role_permissions": [ { "role_id": "string", "permission_keys": [ "invoices.create", "invoices.read" ] } ] }'
{ "data": { "permissions_created": 0, "skipped_permissions": 0, "roles_updated": 0 } }
Tell us how we can improve this guide.