Bootstrap the Environment's permission catalog and roles
/portal/v1/accounts/{accountSlug}/applications/{appSlug}/environments/{envSlug}/setup/access-bootstrapOne-shot first-run setup for the active Environment: creates resource.action permissions from the supplied resources and creates roles, attaching the named permission keys to each. Guarded to run only on an unconfigured Environment — it returns 409 if any custom permission or non-system role already exists. Existing permissions and roles encountered during the run are skipped rather than failing; returns 201 with counts of permissions and roles created and skipped, and emits an access.bootstrapped audit event.
Authentication
AuthorizationJWT access token. Never send alongside X-API-Key: a request carrying both is refused.
env_roles.manageDeveloper ConsoleCreate, edit, and delete roles and set their 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
rolesBootstrapRoleDto[] Required Roles to create with their permission assignments
Responses
application/json
data *AccessBootstrapResponseDto
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.
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/access-bootstrap" \ -H "Authorization: Bearer $CANOPY_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "resources": [ { "name": "notes", "actions": [ "create", "read", "update", "delete" ] } ], "roles": [ { "name": "Admin", "description": "Full access to all resources", "permission_keys": [ "notes.create", "notes.read", "notes.update", "notes.delete" ] } ] }'
{ "data": { "permissions_created": 0, "roles_created": 0, "skipped_permissions": 0, "skipped_roles": 0 } }
Tell us how we can improve this guide.