Set the App's default Environment
/portal/v1/accounts/{accountSlug}/applications/{appSlug}/default-environmentAuthentication
- Bearer Token
AuthorizationJWT access token
Request body
slug *stringSlug of the Environment in this Application that should become the new default.
Code samples
curl -X PUT "https://api.canopy.dev/portal/v1/accounts/{accountSlug}/applications/{appSlug}/default-environment" \
-H "Authorization: Bearer $CANOPY_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"slug": "string"
}'const response = await fetch("https://api.canopy.dev/portal/v1/accounts/{accountSlug}/applications/{appSlug}/default-environment", {
method: "PUT",
headers: {
"Authorization": "Bearer $CANOPY_TOKEN",
"Content-Type": "application/json"
},
body: JSON.stringify({
"slug": "string"
}),
});
const data = await response.json();import requests
response = requests.put(
"https://api.canopy.dev/portal/v1/accounts/{accountSlug}/applications/{appSlug}/default-environment",
headers={
"Authorization": "Bearer $CANOPY_TOKEN",
"Content-Type": "application/json"
},
json={
"slug": "string",
},
)
data = response.json()package main
import (
"bytes"
"encoding/json"
"net/http"
)
func main() {
payload := map[string]interface{}{
"slug": "string",
}
body, _ := json.Marshal(payload)
req, _ := http.NewRequest("PUT", "https://api.canopy.dev/portal/v1/accounts/{accountSlug}/applications/{appSlug}/default-environment", 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 Application updated — `default_environment_id` repointed to the supplied env
{
"id": "string",
"account_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 *stringaccount_id *stringname *stringslug *stringsettings *any objectversion *numbercreated_at *string (date-time)updated_at *string (date-time)
400 `default_environment_id` does not point at an Environment in this Application
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)