Create a subaccount
This command allows you to create a subaccount.
All subaccounts will be created under the specified parent account.
The token performing the command must belong to the parent account under which the subaccount will be created, or to an ancestor account higher in the hierarchy.
For example, if Partner A provisions Customer Company B, they can also provision Employee C as a child of B by specifying B's account ID as the parent_account_id for C.
When a subaccount is created, a user (primary token) is created. During the subaccount creation, it is optional to indicate the password for the user. The activation email is sent when there was no password indicated. In case the password was set, then no activation email is sent.
API Request
Method POST
/users/{parent_account_id}/users
Elements schema
element user_create { element login { text } & element password { text } ? & element acl { text } ? & element product { text } ? & element fullname { text } ? & element email { text } ? & element country { text } ? & element vatnumber { text } ? & element city { text } ? & element workstreetaddress { text } ? & element companyname { text } ? & element zipcode { text } ? & element language { text } ? & element phone { text } ? & element captcha { text } ? }
Field names and descriptions
login - Primary user email. If no separate email is supplied, login will be used for primary email as well.
password - Primary user password. The activation email is sent in case no password is set.
ACL - User role. Determines the token access and permissions. The list of user roles can be found here.
Product - ID of product assigned to account
fullname - Primary contact full name
email - Primary contact email address
country - Country format in ISO 3166-1 alpha-2
companyname - Primary contact company name
zipcode - Primary contact ZIP code
language - Language in RFC 1766 format
phone - Primary contact phone
captcha - Captcha response token. May be required for certain user roles.
Create a subaccount with email authentication required for account activation
This command creates a subaccount without a password. If no password is set during account creation, an activation link will be sent to the customer's email for account activation.
Example
Method POST
https://dk-co.keepit.com/users/nq2v51-5mx23m-qb7sah/users
Body
<user_create> <login>test@keepit.com</login> <fullname>TestAccount</fullname> <acl>MasterAdmin</acl> <language>en-GB</language> <product>a9y02y-qngj1m-yvh5r8</product> </user_create>
PowerShell script
try { # Define the API credentials and user ID $username = '<API Token username>' $password = '<API Token password>' $userID = '<Account GUID>' # Create the Basic Authentication header $basicauth = [Convert]::ToBase64String([System.Text.Encoding]::ASCII.GetBytes("${username}:${password}")) $headers = @{ "User-Agent" = "PowerShell-Keepit-API-Agent-1.0" "Authorization" = "Basic $basicauth" "Content-Type" = "application/xml" } # Construct the URL with the user ID $url = "https://dk-co.keepit.com/users/$userID/users" # Define the XML body for creating a new user $xmlBody = @" <user_create> <login>test@keepit.com</login> <fullname>TestAccount</fullname> <acl>MasterAdmin</acl> <language>en-GB</language> <product>a9y02y-qngj1m-yvh5r8</product> </user_create> "@ # Send the POST request with the XML body Invoke-WebRequest -Uri $url -Method Post -Headers $headers -Body $xmlBody -ErrorAction Stop -TimeoutSec 10 } catch { # Handle errors and provide line number and error message $line = $_.InvocationInfo.ScriptLineNumber Write-Host "Cannot query Keepit API due to: $_" Write-Host "at line $line" }
The most commonly used ACLs:
- PartnerParent
- MSPPartner
- MasterAdmin
- BackupAdmin
- FullSupport
- LimitedSupport
- Audit
- StandardSupport
- SsoAdmin
- PMRAdmin
- ReadOnlySupport
Additional information
- The login supplied (<login> field) will be used to create a user (access token) tied to the newly created account.
- The customer must activate their account using the link in the activation email once it is created. After activation, they will be ready to start setting up their backups.
Create a subaccount without email authentication for account activation
This command creates a subaccount with a password, bypassing the account activation requirement via email.
Example
Method POST
https://dk-co.keepit.com/users/nq2v51-5mx23m-qb7sah/users
Body
<user_create> <login>test@keepit.com</login> <password>12345679</password> <fullname>TestAccount</fullname> <acl>MasterAdmin</acl> <language>en-GB</language> <product>a9y02y-qngj1m-yvh5r8</product> </user_create>
PowerShell script
try { # Define the API credentials and user ID $username = '<API Token username>' $password = '<API Token password>' $userID = '<Account GUID>' # Create the Basic Authentication header $basicauth = [Convert]::ToBase64String([System.Text.Encoding]::ASCII.GetBytes("${username}:${password}")) $headers = @{ "User-Agent" = "PowerShell-Keepit-API-Agent-1.0" "Authorization" = "Basic $basicauth" "Content-Type" = "application/xml" } # Construct the URL with the user ID $url = "https://dk-co.keepit.com/users/$userID/users" # Define the password for the subaccount $PrimaryTokenPassword = @" EnterYourPasswordHere! "@ # Define the XML body for creating a new user $xmlBody = @" <user_create> <login>test@keepit.com</login> <password>$([System.Security.SecurityElement]::Escape($PrimaryTokenPassword))</password> <fullname>TestAccount</fullname> <acl>MasterAdmin</acl> <language>en-GB</language> <product>a9y02y-qngj1m-yvh5r8</product> </user_create> "@ # Send the POST request with the XML body Invoke-WebRequest -Uri $url -Method Post -Headers $headers -Body $xmlBody -ErrorAction Stop -TimeoutSec 10 } catch { # Handle errors and provide line number and error message $line = $_.InvocationInfo.ScriptLineNumber Write-Host "Cannot query Keepit API due to: $_" Write-Host "at line $line" }
Additional information
- The product ID must correspond to a product created in the portfolio of the creating account or one of its parent accounts.
- A primary contact record will be created for the new account, using the provided login as the email address and, if supplied, the full name.
- The password for the primary user (token), defined in the <password> element, should be enclosed with @" and "@ in the script to ensure proper handling of special characters. Replace the string “EnterYourPasswordHere!” with the password you wish to set.