Subaccounts — organizing dedicated flespi accounts for telematics projects

Building a flexible and safe hierarchical accounts structure for enterprise-level solutions.

Following are the rules describing relations in the accounts hierarchy:

  1. Each flespi object (channel, device, subaccount etc.) has ONE owner defined by cid parameter (which corresponds to a particular customer_id).

  2. Each account has ONE parent defined by owner_id parameter. Master account’s owner_id=0. Each account (except the fourth level accounts) can have multiple child accounts.

  3. Parent account can MANAGE all its child accounts’ objects.

  4. Child accounts objects can USE parent account objects.

Rule 1 establishes the position of each object relative to the subaccounts hierarchy. It also states that from the parent's point of view subaccount is a flespi object with cid equals to parent's customer_id which is equal to owner_id for subaccount's customer.

Rule 2 defines the tree-like structure of subaccounts which in general case looks like:

Rules 3 and 4 define the rights of accounts going downward and upward through the hierarchy. Note that rules 3 and 4 use “parent-child” notation, which means that account can manage object from its “branch” of hierarchy “tree” only, and child object can use parent’s objects from it’s “chain” of parents up to the master account only.

flespi parent child accounts

See also
The structured collection of main flespi MQTT topics grouped by the entity.
An API method to change the owner of the registered flespi device.