# Accounts

Accounts are a containers that group users, devices, and child accounts together.

# get account

Get account information for the logged in user's account. You can also get child account information based on the "opt" option you choose. Do not include the "opt" value to retrieve the information for the provided accountId. Use "children" "allChildren" or "descendants" to retrieve different amounts and formats of child account information.

# GET /v1/accounts/{AccountId}/{opt?}

# Parameters

Name Type Description
AccountId int id of account for which you are requesting information
opt optional string When opt is missing call returns the account info associated with the AccountId.

opt=children returns a list of all child accounts directly under the AccountId (including parent account) in a single level list.

opt=allChildren returns a list of all descendant accounts under the requesting account (including parent account) in a single level list.

opt=decendants returns a list of all descendant accounts under the AccountId (including parent account) in a hierarchical list.

# Example

curl -X GET "https://api.controlbyweb.cloud/api/v1/accounts/{AccountId}/{opt?}" \
-H "Authorization: Bearer {authToken}"

# Response

{
    "account_id": 7852,
    "device_seats": 5,
    "account_name": "ABC Company",
    "logging": 2,
    "suspended": 0,
    "used_devices": 4,
    "parent_free_devices": 379
}

# update account (create child account)

The account name and device seats can be changed after account creation if the "Edit Accounts" permission exists. Device seats can be moved between parent and child accounts. Overall device seats can be added to an account by using a device seat token. Changing your own device seats is restricted unless applying a device seat token. Changes to device seats must be done by a parent account. Child accounts can also be created under the account with AccountId if "Add Accounts" permission exists.

# POST /v1/accounts/{AccountId}/{opt?}

# Parameters

Name Type Description
AccountId int id of account requesting account info
opt optional string When opt is missing call edits the account associated with the AccountId.

opt=children creates an account directly under the AccountId instead of editing an account.
account_name optional string New Account name
device_seats optional int New number of devices seats on account. Will be taken from parent account if available. Only parent accounts are allowed to edit device_seats.
suspended optional boolean Settings to true will suspend the account. A suspended account does not allow users to log into it.

# Example

curl -X POST "https://api.controlbyweb.cloud/api/v1/accounts/{AccountId?}/{opt?}" \
-H "Authorization: Bearer {authToken}" \
-d "account_name={account_name}" \
-d "device_seats=0" \
-d "suspended=false" \

# Response

{
    "message": "success"
}

# delete account

# DELETE /v1/accounts/{AccountId}

Delete a child account if the "Delete Accounts" permission exists. You cannot delete your own account. An account cannot be deleted if it has child accounts, users, or devices. When an account is deleted all available device seats on that account will be returned to its parent account automatically.

# Parameters

Name Type Description
authToken string Bearer auth Token recieved from call to get Token
AccountId int id of account to be deleted

# Example

curl -X DELETE "https://api.controlbyweb.cloud/api/v1/accounts/{AccountId}" \
-H "Authorization: Bearer {authToken}" \

# Response

{
    "message": "success"
}

#