1. Docs
  2. API Reference
  3. Set the App's default Environment

Set the App's default Environment

PUT/portal/v1/accounts/{accountSlug}/applications/{appSlug}/default-environment

Repoints the active Application's default_environment_id to the Environment named by slug in the body. The default Environment is where an admin lands when navigating to the Application without an explicit :envSlug. The target must belong to this Application — a foreign or unknown slug returns 400. Returns 200 with the updated Application and emits an application.default_environment_set audit event.

Authentication

Bearer TokenAuthorization

JWT access token. Never send alongside X-API-Key: a request carrying both is refused.

Requires capability applications.manageDeveloper Console

Create, 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.

Request body

application/json

slugstring Required

Slug of the Environment in this Application that should become the new default.

Responses

application/json

  • dataApplicationResponseDto*

application/json

  • errorApiErrorBodyDto*

application/json

  • errorApiErrorBodyDto*

application/json

  • errorApiErrorBodyDto*

application/json

  • errorApiErrorBodyDto*

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.

403account.capability_requiredForbidden
When it happens

The signed-in user's administrator roles do not grant the capability this endpoint requires.

Remediation

Ask an account administrator to grant a role carrying the capability named in the Authentication section, then retry.

Returned object

Request
curl -X PUT "https://auth.canopy-io.com/portal/v1/accounts/value/applications/value/default-environment" \
  -H "Authorization: Bearer $CANOPY_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "slug": "string"
  }'
Response
{
  "data": {
    "id": "string",
    "account_id": "string",
    "name": "string",
    "slug": "string",
    "default_environment_id": "string",
    "settings": {},
    "version": 0,
    "created_at": "2026-04-20T12:00:00.000Z",
    "updated_at": "2026-04-20T12:00:00.000Z"
  }
}
Related endpoints
GETGet the current Application
PATCHUpdate the Application name or settings
DELETEDelete an Application
GETGet the admin's resume-state for this Application
PUTUpdate the admin's resume-state for this Application
Was this page helpful?

Tell us how we can improve this guide.