1. Docs
  2. API Reference
  3. Preview deleting a node

Preview deleting a node

POST/api/v1/nodes/{id}/delete/preview

Reports what deleting the node would remove, without deleting it. blockers lists what would refuse the delete (the root node, or an organization node, which is deleted through the organizations API); when any is listed nothing else is counted. Otherwise: subtree_size, the node and every node beneath it; roles, the role assignments made in the subtree counted by role, and assignments_total; identities_affected, and identities_losing_all_access, those holding no assignment anywhere else in the Environment; invites, the pending invitations there, by email; and directory_groups, the directory groups mapped there, by name. The same sets the delete removes. people is one page of the holders whose assignments go, one row per person by name, with via, their assignments that go as role at node, and pagination; q (name or email), role_id, page and take (up to 5000) narrow the page and never the counts. People are named only for a reader who may see the Environment's people (people_named: env_identities.view in the Console, and production_identities.access in a production Environment; identity.view for an API key; access administration at the node for a tenant's administrator); anyone else gets the counts and an empty page, whatever the query. Read-only. Send version as If-Match on the delete. Gated as the delete is: hierarchy.manage on the node. Returns 404 when the node is not found in this Environment.

Authentication

Bearer TokenAuthorization Option A

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

API KeyX-API-Key Option B

API key for management-tier access. Never send alongside an Authorization header: a request carrying both is refused.

Path Parameters

idstring Required

Query Parameters

pagenumber Optional

Page of people (1-based)

min 1

takenumber Optional

People per page (1-5000, default 20)

range 1–5000

qstring Optional

Only people whose name or email contains this, ignoring case

max length 200

role_idstring · uuid Optional

Only the people holding this role in the subtree

Responses

application/json

  • dataNodeDeletePreviewDto*

application/json

  • errorApiErrorBodyDto*

application/json

  • errorApiErrorBodyDto*

application/json

  • errorApiErrorBodyDto*

application/json

  • errorApiErrorBodyDto*

Returned object

Request
curl -X POST "https://auth.canopy-io.com/api/v1/nodes/value/delete/preview?page=0&take=0&q=value&role_id=value" \
  -H "X-API-Key: $CANOPY_API_KEY"
Response
{
  "data": {
    "node_id": "string",
    "version": 0,
    "people_named": false,
    "blockers": [
      {
        "code": "hierarchy.reparent_cycle",
        "message": "string"
      }
    ],
    "subtree_size": 0,
    "identities_affected": 0,
    "identities_losing_all_access": 0,
    "roles": [
      {
        "role": {
          "id": "string",
          "name": "string"
        },
        "assignments": 0,
        "identities": 0
      }
    ],
    "assignments_total": 0,
    "people": {
      "items": [
        {
          "identity": {
            "id": "string",
            "first_name": "string",
            "last_name": "string",
            "name": "string",
            "email": "string",
            "avatar_url": "string"
          },
          "via": [
            {
              "role": {},
              "node": {}
            }
          ]
        }
      ],
      "pagination": {
        "page": 0,
        "take": 0,
        "item_count": 0,
        "page_count": 0,
        "has_previous_page": false,
        "has_next_page": false
      }
    },
    "invites": {
      "total": 0,
      "names": [
        "string"
      ]
    },
    "directory_groups": {
      "total": 0,
      "names": [
        "string"
      ]
    }
  }
}
Related endpoints
GETList hierarchy nodes (scoped, paged)
POSTCreate a hierarchy node
GETList the hierarchy as parent edges
GETGet a hierarchy node
PATCHUpdate a hierarchy node
DELETEDelete a hierarchy node
GETGet subtree from a node
GETGet ancestor chain for a node
GETGet direct children of a node
POSTMove (reparent) a node
POSTPreview moving a node
GETList identities at a node
GETList who holds a permission at a node
GETGet identity summary for a node
Was this page helpful?

Tell us how we can improve this guide.