1. Docs
  2. API Reference
  3. Rename or re-slug an Environment

Rename or re-slug an Environment

PATCH/portal/v1/accounts/{accountSlug}/applications/{appSlug}/environments/{envSlug}

Authentication

  • Bearer Token Authorization

    JWT access token

Path Parameters

Name Required Type Description
envSlugRequiredstring

Request body

  • namestring
  • slugstring
  • mfaany

    MFA enforcement keys persisted under `env.settings`. Send the subset of keys you want to change; omitted keys retain their prior value.

Code samples

cURLJavaScriptPythonGo
curl -X PATCH "https://api.canopy.dev/portal/v1/accounts/{accountSlug}/applications/{appSlug}/environments/value" \
  -H "Authorization: Bearer $CANOPY_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "string",
    "slug": "string",
    "mfa": {
      "mfa_required": false,
      "mfa_grace_period_days": 0,
      "mfa_trusted_device_days": 0,
      "mfa_factor_allowlist": [
        "totp"
      ]
    }
  }'

Responses

200 Environment updated
{
  "id": "string",
  "application_id": "string",
  "name": "string",
  "slug": "string",
  "settings": {},
  "version": 0,
  "created_at": "2026-04-20T12:00:00.000Z",
  "updated_at": "2026-04-20T12:00:00.000Z"
}

application/json

  • idstring*
  • application_idstring*
  • namestring*
  • slugstring*
  • settingsany object*
  • versionnumber*
  • created_atstring (date-time)*
  • updated_atstring (date-time)*
401 Invalid or expired token
403 This token is not authorized for this endpoint (wrong principal type — e.g., admin token on identity-only endpoint, or vice versa)
404 Environment not found in this Application
409 An Environment with this slug already exists in the Application

Returned object

On this page

Related endpoints

GETList Environments in an Application
POSTCreate a new Environment in an Application
GETGet a single Environment by slug
DELETEDelete an Environment
GETExport an Environment's configuration as JSON
POSTReplace an Environment's configuration from a JSON payload (destructive)
GETGet the Environment's access model
PUTSwitch the Environment's access model
GETGet hierarchy schema for the active Environment
PATCHUpdate hierarchy schema for the active Environment
POSTRevert this Environment from hierarchy to flat