Rename or re-slug an Environment
/portal/v1/accounts/{accountSlug}/applications/{appSlug}/environments/{envSlug}Updates an Environment's lifecycle fields, identified by :envSlug: name, slug, and the one-way is_production promotion. Omitted fields are left unchanged. Sign-in settings are a separate authority and live on the auth-settings endpoint. Re-slugging to a value already used by another Environment in the Application returns 409, and a missing slug returns 404. Emits an environment.updated audit event.
Authentication
AuthorizationJWT access token. Never send alongside X-API-Key: a request carrying both is refused.
applications.manageDeveloper ConsoleCreate, edit, and delete Applications and Environments. 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 Request body
application/json
namestring Optional slugstring Optional is_productionboolean Optional Mark this Environment as holding real end users. One-way: `true` promotes it and is permanent; sending `false` for an Environment already marked production is rejected with 400. Demotion is the only change that would expose real people to anyone with Console access.
Responses
application/json
data *EnvironmentResponseDto
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 PATCH "https://auth.canopy-io.com/portal/v1/accounts/value/applications/value/environments/value" \ -H "Authorization: Bearer $CANOPY_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "name": "string", "slug": "string", "is_production": false }'
{ "data": { "id": "string", "application_id": "string", "name": "string", "slug": "string", "is_production": false, "settings": {}, "version": 0, "created_at": "2026-04-20T12:00:00.000Z", "updated_at": "2026-04-20T12:00:00.000Z" } }
Tell us how we can improve this guide.