How Organizations nest into a tree, and how roles, deletion and deactivation follow it.
Organizations can be nested inside other Organizations. Each Organization has an optional parent, and an Organization without a parent is a root. The result is one tree per root, inside the account:
Portfolio (root, tags: ["portfolio"])
└── Building (tags: ["building"])
└── Floor (tags: ["floor"])
└── Space (tags: ["space"], properties: {"space_type": "room"})In these pages, parent and child name the direct relation; ancestor and descendant any distance along a branch; and a subtree is an Organization with all its descendants.
Levels
The platform does not store a node type. The level of an Organization is a convention of the client:
- Mark the level with a tag, for example
"tags": ["building"]. Get Organization Hierarchy filters bytags__contains, the Organization filters bytags, and Get all Devices of Organization byorganization__tags__contains. - Keep attributes such as the type of space in
properties, for example{"space_type": "room"}.
Nothing enforces that a floor sits under a building, and a level can be skipped, so the same kind of node may be at different depths. Filter by tag, not by depth.
Rules of the tree
| Rule | What happens |
|---|---|
| Same account | The parent must belong to the same account. |
| At most 7 levels | The tree can have at most 7 levels, the root included. A create or move that goes deeper returns 400 Bad Request: An organization hierarchy cannot be deeper than 7 levels. |
| No cycles | An Organization cannot be nested under itself or under one of its descendants. |
| Unique labels | label is unique in the whole account, not only among siblings: two buildings cannot both have a floor-1. Use labels such as north-tower-floor-1 and keep the readable name in name. |
| Same App | A nested Organization takes the App of its parent. |
| Active ancestors | An Organization cannot be active while one of its ancestors is inactive. See Deactivation. |
A rule that is not met returns 400 Bad Request and leaves the tree as it was.
Roles
A role assigned to a user on an Organization applies to that Organization and every descendant, including the ones created later. It never applies to the ancestors.
- Assign the role with Assign Organizations to User. The response includes
descendantsAffectedfor each Organization: how many descendants the role reaches. - The role reaches the existing descendants a few seconds after the response. A client that assigns a role and reads a descendant right away should tolerate a transient
404 Not Foundor an empty list. - Removing the role from the Organization removes it from every descendant that inherited it.
- Permissions given directly on a single entity, such as one Device, do not propagate.
An End User assigned to a building can use any active floor or space below it where the API asks for an Organization: as organization_key in Get all Devices of Organization, and in the organization field of Devices, Events and Users. Other nested lists, such as the Events or Users of an Organization, still require a direct assignment: for those, query the top-level list, which already reflects the inherited roles.
Moving a subtree
Update Organization with a new parent moves the Organization with its whole subtree, in one transaction. Roles that reached the subtree only through the old ancestors are removed, and the roles of the new ancestors are applied. Send "parent": null to turn it into a root.
Deletion
Deleting an Organization deletes every Organization nested below it. Their Devices, Events and Incidents are not deleted: they stay in the account without an Organization. Move the nested Organizations, or reassign their Devices, before deleting a building whose data must stay visible to its users.
Deactivation
- Updating an Organization with
"isActive": falsedeactivates it and every active descendant, in the same request. Users left without any active Organization are deactivated. - Reactivation does not cascade: each descendant is activated on its own.
- An Organization cannot be activated, created active or moved while active under an inactive ancestor:
400 Bad Request,An organization cannot be active while one of its ancestors is inactive. - An inactive Organization hides only itself. For an End User, an inactive floor returns
404 Not Foundand drops out ofscope=subtree, but an active space below it is still reachable directly.
Counts
In Get all Organizations, devicesCount and usersCount include every descendant. A Device or a User is counted once, even when it belongs to several Organizations of the same subtree.
Endpoints
| To | Use |
|---|---|
| Read the tree the current user can see, flat or nested | Get Organization Hierarchy |
| List the children, or the whole subtree, of an Organization | Get all Organizations with the parent or descendant_of filters |
| Create a nested Organization | Create Organization with parent |
| Move a subtree | Update Organization with parent |
| List the Devices of a building, floors and spaces included | Get all Devices of Organization with scope=subtree |
