Rename or re-slug an Environment
/portal/v1/accounts/{accountSlug}/applications/{appSlug}/environments/{envSlug}Authentication
- Bearer Token
AuthorizationJWT access token
Path Parameters
| Name | Required | Type | Description |
|---|---|---|---|
envSlug | string |
Request body
namestringslugstringmfaanyMFA enforcement keys persisted under `env.settings`. Send the subset of keys you want to change; omitted keys retain their prior value.
Code samples
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"
]
}
}'const response = await fetch("https://api.canopy.dev/portal/v1/accounts/{accountSlug}/applications/{appSlug}/environments/value", {
method: "PATCH",
headers: {
"Authorization": "Bearer $CANOPY_TOKEN",
"Content-Type": "application/json"
},
body: JSON.stringify({
"name": "string",
"slug": "string",
"mfa": {
"mfa_required": false,
"mfa_grace_period_days": 0,
"mfa_trusted_device_days": 0,
"mfa_factor_allowlist": [
"totp"
]
}
}),
});
const data = await response.json();import requests
response = requests.patch(
"https://api.canopy.dev/portal/v1/accounts/{accountSlug}/applications/{appSlug}/environments/value",
headers={
"Authorization": "Bearer $CANOPY_TOKEN",
"Content-Type": "application/json"
},
json={
"name": "string",
"slug": "string",
"mfa": {
"mfa_required": False,
"mfa_grace_period_days": 0,
"mfa_trusted_device_days": 0,
"mfa_factor_allowlist": [
"totp",
],
},
},
)
data = response.json()package main
import (
"bytes"
"encoding/json"
"net/http"
)
func main() {
payload := map[string]interface{}{
"name": "string",
"slug": "string",
"mfa": map[string]interface{}{
"mfa_required": false,
"mfa_grace_period_days": 0,
"mfa_trusted_device_days": 0,
"mfa_factor_allowlist": []interface{}{
"totp",
},
},
}
body, _ := json.Marshal(payload)
req, _ := http.NewRequest("PATCH", "https://api.canopy.dev/portal/v1/accounts/{accountSlug}/applications/{appSlug}/environments/value", bytes.NewBuffer(body))
req.Header.Set("Authorization", "Bearer $CANOPY_TOKEN")
req.Header.Set("Content-Type", "application/json")
resp, _ := http.DefaultClient.Do(req)
defer resp.Body.Close()
}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
id *stringapplication_id *stringname *stringslug *stringsettings *any objectversion *numbercreated_at *string (date-time)updated_at *string (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