1. Docs
  2. API Reference
  3. Update hierarchy schema for the active Environment

Update hierarchy schema for the active Environment

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

Authentication

  • Bearer Token Authorization

    JWT access token

Path Parameters

Name Required Type Description
envSlugRequiredstring

Headers

  • if-match required

Request body

  • node_typesstring[]*

    Allowed node types (e.g. ['organization', 'region', 'team']). Order is informational, not structural — parent/child rules are governed by `allowed_children`.

  • allowed_childrenany object*

    Map from node type to allowed child node types. Empty array means leaf-only.

  • max_depthnumber*

    Maximum nesting depth (root counts as depth 1).

  • root_node_typestring*

    Node type used when the root node is auto-created. Must be one of `node_types`.

Code samples

cURLJavaScriptPythonGo
curl -X PATCH "https://api.canopy.dev/portal/v1/accounts/{accountSlug}/applications/{appSlug}/environments/value/hierarchy-schema" \
  -H "if-match: value" \
  -H "Authorization: Bearer $CANOPY_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "node_types": [
      "string"
    ],
    "allowed_children": {
      "organization": [
        "region"
      ],
      "region": [
        "team"
      ],
      "team": []
    },
    "max_depth": 0,
    "root_node_type": "string"
  }'

Responses

200 Hierarchy schema updated
{
  "node_types": [
    "string"
  ],
  "allowed_children": {},
  "max_depth": 0,
  "root_node_type": "string"
}

application/json

  • node_typesstring[]*
  • allowed_childrenany object*
  • max_depthnumber*
  • root_node_typestring
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 Version mismatch — the resource was modified since the version supplied in If-Match. Refresh and retry.

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
PATCHRename or re-slug an Environment
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
POSTRevert this Environment from hierarchy to flat