addAccount

Creates a new Account and an Account Owner.

addAccount

Creates a new Account and an Account Owner.

Top ↑

Syntax

array addAccount(
    string api_key,
    array account_details,
    array user_details 
);

Parameters

api_key (string)

The key required to access the API. See Getting Started for more information.

account_details (array)

An associative array of Account details. See remarks below for a description of the values in the account_details array.

user_details (array)

An associative array of User details for the User who owns the Account. See remarks below for a description of the values in the user_details array.

Return Value

Returns an array containing the new Account ID and the new User ID on success.

Examples

$api = new Api($url, 'YOURAPIKEY');

// setup vars
$account_details = array(
    'company_name'           => 'Example Company',
    'billing_email'          => 'billing@example.com',
    'referal_code'           => 'kjDfn5ijgw2iorY4spmF',
    'company_adress'         => '123 Smith St',
    'company_suburb'         => 'Brisbane CBD',
    'company_state'          => 'QLD',
    'company_country'        => 'Australia',
    'company_zip'            => '4000',
    'company_industry'       => 'Sales & Marketing',
    'website'                => 'http://example.com',
    'branding'               => 'default',
    'virtual_host'           => 'virtualhost.example.com',
    'packages'               => 33,
    'sub_packages'           => 1,
    'contact_limit'          => 10,
    'email_send_limit'       => 30,
    'sms_send_limit'         => 30,
    'send_cap'               => 10,
    'expiry_time'            => 1361772000,
    'account_type'           => 1,
    'allow_login_to_under'   => true,
    'allow_login_from_above' => true,
    'is_trial'               => true,
    'is_free'                => false,
);

$user_details = array(
    'phone'        => '(07) 3257 3906',
    'username'     => 'johndoe',
    'password'     => 'MnfkjH32k34089dkjg9t',
    'first_name'   => 'John',
    'last_name'    => 'Doe',
    'email'        => 'johndoe@example.com',
    'mobile'       => '0412345678',
    'position'     => 'Software Developer',
    'timezone'     => 'Australia/Brisbane',
    'is_confirmed' => false,
);

$return_ids = $api->invokeMethod('addAccount', $account_details, $user_details);
{
    "id": 1,
    "method": "addAccount",
    "params": [
        "YOURAPIKEY",
        {
            "company_name": "Example Company",
            "billing_email": "billing@example.com",
            "referal_code": "kjDfn5ijgw2iorY4spmF",
            "company_adress": "123 Smith St",
            "company_suburb": "Brisbane CBD",
            "company_state": "QLD",
            "company_country": "Australia",
            "company_zip": "4000",
            "company_industry": "Sales & Marketing",
            "website": "http://example.com",
            "branding": "default",
            "virtual_host": "virtualhost.example.com",
            "packages": 33,
            "sub_packages": 1,
            "contact_limit": 10,
            "email_send_limit": 30,
            "sms_send_limit": 30,
            "send_cap": 10,
            "expiry_time": 1361772000,
            "account_type": 1,
            "allow_login_to_under": true,
            "allow_login_from_above": true,
            "is_trial": true,
            "is_free": false
        },
        {
            "phone": "(07) 3257 3906",
            "username": "johndoe",
            "password": "MnfkjH32k34089dkjg9t",
            "first_name": "John",
            "last_name": "Doe",
            "email": "johndoe@example.com",
            "mobile": "0412345678",
            "position": "Software Developer",
            "timezone": "Australia/Brisbane",
            "is_confirmed": false
        }
    ]
}
{
    "id": 1,
    "result": {
        "account_id":123,
        "user_id":456
    },
    "error": null
}

Remarks

Account Details

The following table shows the structure of the account_details array.

Key Type Mandatory Default Description
company_name string Yes The company name of the Account.
billing_email string Yes The billing contact's Email address.
referral_code string No The Account's user referred code.
company_address string No The company address of the Account.
company_suburb string No The suburb of the company address.
company_state string No The state of the company address.
company_country string No The country of the company address.
company_zip string No The postcode of the company address.
company_industry string No The Company's industry type.
website string No The company's website.
branding string No current The Account's branding name. Defaults to the API Users Branding.
virtual_host string No current The virtual host name. Defaults to the API Users Virtual Host.
packages string No home,account The comma separated list of packages the Account has access to.
sub_packages string No The comma separated list of sub-packages the Account has access to. Default depends on those applied to current API Users Account.
contact_limit int No unlimited The maximum number of Contacts allowed in the Account.
email_send_limit int No unlimited The maximum number of Emails that the Account can send per month.
sms_send_limit int No unlimited The maximum number of SMS Messages that the Account can send per month.
send_cap int No unlimited The maximum number of Emails that can be sent at one time. For trial Accounts the the default value of 10 is not editable.
expiry_time int No 30 days The the expiry time of the Account. For trial Accounts the default of 30 days is not editable.
account_type string No single The type of the Account. Valid values are:
* single
* reseller
* partner
* corporate
allow_login_to_under bool No true Value indicating whether the Account can log into sub-Accounts.
allow_login_from_above bool No true Value indicating whether the parent Account can log into this Account
is_trial bool No false Value indicating whether the Account as a trial Account. If you are currently using a trial Account, you can only create trial Accounts.
is_free bool No false Value indicating whether the Account is free.
is_security_check_enabled bool No true Whether or not to perform IP/host name checking of session requests (in addition to checking the user agent).

User Details

The following table shows the structure of the user_details array.

Key Type Mandatory Default Description
username string Yes The username
password string Yes The password
first_name string Yes The User's first name
last_name string Yes The User's last name
email string Yes The User's email address
phone string Yes The User's phone number
mobile string No The User's mobile number
position string No The title of the User's position
timezone string No API User's timezone The User's timezone in tz database format (area/location). For example, Australia/Brisbane. See getTimezoneList.
is_confirmed bool No false Value indicating whether the email address of this User has been confirmed.

Error Codes

This method may return the following error codes in addition to the standard error codes:

Code Error Description
302 Undefined Method Error The account cannot be saved for some reason. Please try again later.
310 Missing mandatory information Some of the required information in the Account data and/or the User data are missing.
317 Invalid Email Address Specified The email address in the Account data and/or the User data is invalid.
322 Username unavailable The username in the User data is not available.

See Also