Description
This function creates a subaccount.
Examples
Note:
Use cPanel's API Shell interface (Home >> Advanced >> API Shell) to directly test cPanel API calls.
Parameters
Parameter |
Type |
Description |
Possible values |
Example |
alternate_email |
string |
An alternate email address for the subaccount's user. Note: You must use this parameter if you set the send_invite value to 1. This parameter defaults to null. |
A valid email address. |
user@example.com |
avatar_url |
string |
Warning: We reserved this parameter for future use. Do not use this parameter.
The user's subaccount profile photo. This parameter defaults to null. |
A valid HTTPS URL that points to an image file. Note: You must use the HTTPS protocol to prevent mixed content warnings when users view the image from another HTTPS URL. |
|
domain |
string |
Required The subaccount user's associated domain. |
A domain that the cPanel account owns. |
example.com |
password |
string |
Required The subaccount's password. Note: Email, FTP, and Web Disk services use this password. |
A secure password. |
12345luggage |
phone_number |
string |
Warning: We reserved this parameter for future use. Do not use this parameter.
A phone number for the subaccount user. This parameter defaults to null. |
A valid phone number that conforms to ITU-T'sE.164-recommended standard for the representation of telephone numbers. |
+15551234567 |
real_name |
string |
The subaccount user's name. This parameter defaults to null. |
|
John Doe |
send_invite |
Boolean |
Whether to send a reset password email to the subaccount's alternate email address. Note: We introduced this parameter in cPanel & WHM version 56. This parameter defaults to 0.
|
|
0 |
services.email.enabled |
Boolean |
Whether to grant the subaccount email access. This parameter defaults to 0. |
|
1 |
services.email.quota |
string |
The subaccount's email disk space quota. This parameter defaults to 0. |
|
500 |
services.ftp.enabled |
Boolean |
Whether to grant the subaccount FTP access. This parameter defaults to 0. |
|
1 |
services.ftp.homedir |
string |
The subaccount's FTP home directory. Note: This parameter is required if you enabled FTP access. |
A valid path, relative to the cPanel account's home directory. Note: The directory must exist.
|
/subaccount |
services.webdisk.enabled |
Boolean |
Whether to grant the subaccount Web Disk access. This parameter defaults to 0. |
|
1 |
services.webdisk.enabledigest |
Boolean |
Whether to enable the Web Disk Digest Authentication. Notes:
This parameter defaults to 0. |
|
0 |
services.webdisk.private |
Boolean |
Whether to set the directory's permissions to public or private. This parameter defaults to 0. |
|
1 |
services.webdisk.homedir |
string |
The subaccount's Web Disk home directory. This parameter is required if you enable Web Disk access. |
A valid path, relative to the cPanel account's home directory. |
/subaccount |
services.webdisk.perms |
string |
The subaccount's file permissions for its Web Disk home directory. Note: The services.webdisk.homedirparameter determines the subaccount's Web Disk home directory. This parameter defaults to rw. |
|
rw |
type |
string |
The type of account. This parameter defaults to sub. |
|
sub |
username |
string |
Required The username for the subaccount. |
A username that meets the subaccount name limitations.
Note: This value does not include the domain name. |
example |
Returns
Return |
Type |
Description |
Possible values |
Example |
alternate_email |
string |
An alternate email address for the subaccount's user. |
A valid email address. |
user@example.com |
avatar_url |
string |
The URL to the user's subaccount profile photo. Note: Use the HTTPS protocol to prevent mixed content warnings when users view it from another HTTPS URL. |
A valid HTTPS URL that points to an image file. |
|
can_delete |
boolean |
Whether the cPanel account user can delete the subaccount. |
|
0 |
can_set_password |
boolean |
Whether the cPanel account user can change the subaccount's password.
|
Note: The function returns a 0 value for subaccounts who inherit their password from the cPanel account. |
1 |
can_set_quota |
boolean |
Whether the cPanel account user can change the subaccount's disk usage quota. |
|
0 |
dismissed |
boolean |
Whether the cPanel account user dismissed the merge prompt for the service account. Note: Only service accounts return this value. |
|
1 |
domain |
string |
The subaccount user's associated domain. |
A domain that the cPanel account owns. |
example.com |
full_username |
string |
The subaccount's username and domain name. |
A valid username, the @ character, and the associated domain. |
user@example.com |
guid |
string |
The subaccountunique identifier. Note: The subaccount's globally unique identifier (GUID) does not change when you adjust its other attributes. |
The system assigned unique value. |
|
issues |
array |
This array of hashes contains information about any issues or problems with the subaccount. |
This array contains the type, area, service,message, used, and limit values. |
|
type |
string |
The type of issue. The function returns this value in theissues array. |
|
info |
area |
string |
The affected section of cPanel & WHM. |
quota |
quota |
service |
string |
The affected service. The function returns this value in theissues array. |
|
|
message |
string |
The description of the issue. The function returns this value in theissues array. |
A message that contains a description of the issue. |
Your account is over quota. |
used |
string |
The number of Megabytes (MB) that the account currently uses. The function returns this value in theissues array. |
A positive integer. |
2000 |
limit |
string |
The set quota Megabyte (MB) limit for the affected subaccount. The function returns this value in theissues array. |
A positive integer. |
1500 |
merge_candidates |
array |
An array of hashes that represents the service accounts that the system could merge for this subaccount. |
This array contains the alternate_email,avatar_url, can_delete, can_set_password,can_set_quota, dismissed, domain,full_username, guid, has_siblings, issues,merge_candidates, parent_type, phone_number,real_name, services, special,sub_account_exists, synced_password, type, andusername values. |
|
has_siblings |
boolean |
Whether the service account shares afull_username value with another service account. |
|
0 |
parent_type |
string |
The type of account that could own the service account. |
|
hypothetical |
phone_number |
string |
The subaccount user's phone number. |
A valid phone number that conforms to ITU-T'sE.164 recommended standard for the representation of telephone numbers. |
+15551234567 |
real_name |
string |
The name of the subaccount's user. |
|
John Doe |
services |
hash |
This hash contains information about the subaccount's access to email, FTP, and Web Disk. |
This hash contains the email, ftp, and webdiskvalues. |
|
|
hash |
This hash contains the information that indicates the subaccount's email status. |
This hash contains the enabled and quota values. |
|
enabled |
boolean |
Whether the subaccount can access Webmail, POP, and IMAP services. |
|
1 |
quota |
string |
The subaccount's email disk space quota. |
|
100 |
ftp |
hash |
This hash contains the information that indicates the subaccount's FTP status. |
This hash contains the enabled, quota, and homedirvalues. |
|
enabled |
boolean |
Whether the subaccount can access FTP. |
|
0 |
quota |
string |
The subaccount's FTP disk space quota. |
|
100 |
homedir |
string |
The subaccount's FTP home directory. |
A relative path from the cPanel account's home directory on the server. |
/subaccount |
webdisk |
hash |
This hash contains the information that indicates the subaccount's Web Disk status. |
This hash contains the enabled, homedir, perms, and private values. |
|
enabled |
boolean |
Whether the subaccount can access Web Disk. |
|
0 |
homedir |
string |
The path to the subaccount's directory, relative to the cPanel account's home directory. |
A valid path. |
/bob |
perms |
string |
Whether to grant write permissions to the subaccount. |
|
rw |
private |
boolean |
Whether to set the Web Disk directory's permissions to public or private. Notes:
|
|
0 |
special |
boolean |
Whether the account is a system-created special account that the user cannot remove.
|
|
1 |
sub_account_exists |
boolean |
Whether a subaccount exists with the same username. |
Note: The function returns this attribute as nullvalue if the account type is not a service account. |
0 |
synced_password |
boolean |
Whether the user has synchronized the passwords for each of the subaccount'sservice accounts. |
Note: The function returns this attribute as nullvalue if the account type is not a subaccount. |
0 |
type |
string |
The type of account. |
|
sub |
username |
string |
The username for the subaccount. Notes: This value does not include the domain name. |
A username that meets the subaccount name limitations.
|
example |