Set the App's default Environment
/portal/v1/accounts/{accountSlug}/applications/{appSlug}/default-environmentRepoints 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
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.
Request body
application/json
slugstring Required Slug of the Environment in this Application that should become the new default.
Responses
application/json
data *ApplicationResponseDto
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.
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 PUT "https://auth.canopy-io.com/portal/v1/accounts/{accountSlug}/applications/{appSlug}/default-environment" \ -H "Authorization: Bearer $CANOPY_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "slug": "string" }'
{ "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" } }
Tell us how we can improve this guide.