WHM API.
https://api.docs.cpanel.net/_mock/specifications/whm.openapi/
https://{host}:{port}/json-api/
Request
This function creates a cPanel account and sets up its domain information.
Note:
- On servers that run CentOS 7, you may see a
namedwarning about the absence of SPF resource records on DNS. - This warning is not relevant on CentOS 7 servers, because RFC 7208 deprecated SPF records. CentOS 7 servers use TXT records instead of SPF records.
- Red Hat 7.1 and CentOS 7.1 both contain
bind-9.9.4-23.el7, which is an updated version of BIND that complies with RFC 7208. To resolve this issue, update your operating system to a version that contains the updated version of BIND. For more information, read the Red Hat Bugzilla case about SPF record errors.
The new account's username. cPanel usernames must adhere to the following criteria:
- The first eight characters of a username must be unique.
- A username cannot begin with a number or the test string.
Note:
- Use the
Cpanel::Validate::UsernamePerl module to validate usernames before you call this function. For more information, read the/usr/local/cpanel/Cpanel/Validate/Username.podfile. - The system will automatically convert this value to all lowercase letters.
- MySQL's unique character limitations do not exist on servers that use MariaDB.
Assign Account Enhancements to the cPanel account. To view your server's Account Enhancements, run WHM API 1's list_account_enhancements function.
The account's maximum bandwidth.
0,unlimited, ornull— The account possesses unlimited bandwidth.
Whether the account has Common Gateway Interface (CGI) access enabled.
1— Enabled.0— Disabled.
Note:
When a server profile disables the Web Server role, this parameter defaults to 0. On these servers, you cannot enable CGI access.
The account's contact email address.
The account's IP address.
Note:
If you do not specify this parameter, the system will determine the account's IP address.
Whether DomainKeys Identified Mail (DKIM) is enabled for the account.
1— Enabled.0— Disabled.
Note:
This parameter defaults to the Enable DKIM on domains for newly created accounts setting's value in WHM's Tweak Settings interface (WHM >> Home >> System Configuration >> Tweak Settings).
Whether Domain-based Message Authentication, Reporting, and Conformance (DMARC) is enabled for the account.
1— Enabled.0— Disabled.
Note:
This parameter defaults to the Enable DMARC on domains for newly created accounts setting's value in the Domains section of WHM's Tweak Settings interface (WHM >> Home >> System Configuration >> Tweak Settings).
The account's main domain.
Note:
- If you do not provide a domain, the system will automatically create a temporary domain for the account.
- For more information about temporary domains, read our Temporary Domains documentation.
The account's assigned feature list.
Whether to overwrite an existing DNS zone with the new account's information. The system performs this action if a matching DNS zone currently exists.
1— Overwrite.0— Do not overwrite.
The account's group ID.
Note:
- To use this parameter, the function's caller must authenticate as the root user.
- If you do not specify this parameter, the system generates a group ID.
- This must be a unique value that is not currently associated with disk usage and does not exist on the server.
Whether the account has shell (SSH) access enabled.
1— Enabled.0— Disabled.
A legacy parameter.
1— Enabled.0— Disabled.
Important:
Only include this parameter if you set a useregns value of 1.
The absolute path to the account's home directory.
Note:
- To use this parameter, the function's caller must authenticate as the
rootuser. - If you do not specify a value, the system uses the
/home/userdirectory, whereuseris the account's username.
Whether the account has a dedicated IP address.
y— The account possesses a dedicated IP address.n— The account does not possess a dedicated IP address.
The account's default locale.
Note:
- This value is case-sensitive.
- For region-specific locales, use the ISO 639-1 code, an underscore (
_), and the ISO 3166-1 code.
A linked cPanel mail server on which to also create the account. This is the server's alias (friendly name) defined when creating the link to a cPanel mail server.
Note:
This function requires a linked cPanel mail server.
A mailbox format to use, if you do not wish to use the system's default mailbox format.
Note:
- Use this parameter when you transfer between servers with different mailbox formats.
- This parameter defaults to the The mailbox storage format for new accounts setting in the Mail section of WHM's Tweak Settings interface (WHM >> Home >> Server Configuration >> Tweak Settings).
The percentage of failed or deferred email messages that the account can send per hour. If the account exceeds this value its outgoing mail is rate-limited.
0orunlimited— The account can send an unlimited number of failed or deferred messages.
The maximum number of emails that the account can send in one hour.
0orunlimited— The account can send an unlimited number of emails.
The maximum size that the account can define when it creates an email account.
0orunlimited— The account possesses an unlimited quota.
Important:
- This value applies to each email account, not each cPanel account.
- If you define this parameter it overwrites the hosting plan's defined value for the account.
- We recommend that you allow the account's plan to determine this value.
The maximum number of Team users for this account. This parameter should be a number between 0 and the server's default value, inclusively. This parameter can not be a number greater than the server's default value.
The account's maximum number of addon domains.
unlimited, ornull— The account possesses unlimited addon domains.
The account's maximum number of FTP accounts.
0,unlimited, ornull— The account possesses unlimited FTP accounts.
The account's maximum number of mailing lists.
0,unlimited, ornull— The account possesses unlimited mailing lists.
The account's maximum number of parked domains (aliases).
unlimitedornull— The account possesses unlimited parked domains.
The account's maximum number of email accounts.
0,unlimited, ornull— The account possesses unlimited email accounts.
The account's maximum number of each available type of SQL database. For example, this parameter has a 5 value and the system administrator allows MySQL® and PostgreSQL® databases. Users can create up to five MySQL databases and up to five PostgreSQL databases.
0,unlimited, ornull— The account possesses unlimited databases.
The account's maximum number of subdomains. unlimited or null — The account possesses unlimited subdomains.
The account's main mail exchanger's type.
local- Local Mail Exchanger.secondary- Backup Mail Exchanger.remote- Remote Mail Exchanger.auto- Automatically Detect Configuration.
Note:
The function does not configure the primary MX entry to point to the appropriate exchanger. You must perform this function separately.
The name of the account owner.
root- A valid reseller account username on the server.
Set the account to own itself. Ignored if owner is set.
1— Set account to own itself.0— Do nothing.
The account's password.
Note:
- You can use either the
passor thepasswordparameter, but not both. - If you don't specify this value, the system generates a secure password.
The account's password.
Note:
- You can use either the
passor thepasswordparameter, but not both. - If you don't specify this value, the system generates a secure password.
A new plan name. Use this parameter to save unique account settings as a new plan.
Note:
- If you do not use this parameter but specify
1for thesavepkgvalue, the system will generate a plan name. - If you do not use this parameter and specify
0or do not use thesavepkgparameter, the function does not save a new plan. - If you do not use this parameter, the function will not save the new account settings.
The account's hosting plan (package).
Important:
If you provide this value, do not use the optional quota-related parameters below. Instead, we recommend that you allow the account's plan to determine these values.
The account's disk space quota.
0— The account's disk space is unlimited.
Whether to grant reseller privileges to the account.
1— Grant reseller privileges.0— Do not grant reseller privileges.
Create the user as a reseller without an associated domain.
1- Create the account as a reseller without an associated domain.0- Do not create the account as a reseller without an associated domain.
Warning:
If you create a reseller without a domain, certain parts of WHM will not function for that user. These limitations exist both when logged in as that user and when you attempt to perform actions which affect that user.
Whether to save the account's settings as a new plan.
1— Save.0— Do not save.
Whether to display the account password in the output.
y— Display the account password in the output.n— Do NOT display the account password in the output.
Whether the account has Apache SpamAssassin™ enabled.
1— Enabled.0— Disabled.
Whether to enable spam box filtering for the account.
y- Enable spam box filtering.n- Disable spam box filtering. Note:
You must enable Apache SpamAssassin™ to use the Spam Box feature.
Whether Sender Policy Framework (SPF) is enabled for the account.
1— Enabled.0— Disabled.
This parameter defaults to the Enable SPF on domains for newly created accounts setting's value in WHM's Tweak Settings interface (WHM >> Home >> System Configuration >> Tweak Settings).
The account's user ID.
Note:
- To use this parameter, the function's caller must authenticate as the
rootuser. - If you do not specify this parameter, the system generates a user ID.
- This must be a unique value that is not currently associated with disk usage and does not exist on the server.
Whether to use registered nameservers for the domain.
1- Use registered nameservers.0- Use the server's default nameservers.
Important:
If you set this parameter to 1, you must also include the hasuseregns parameter with a value of 1.
- Mock server
https://api.docs.cpanel.net/_mock/specifications/whm.openapi/createacct
- A server running WHM.
https://whm-server.tld:2087/json-api/createacct
- curl
- JavaScript
- Node.js
- Python
- Java
- C#
- PHP
- Go
- Ruby
- R
- Payload
curl -i -X GET \
-u <username>:<password> \
'https://api.docs.cpanel.net/_mock/specifications/whm.openapi/createacct?username=username&account_enhancements=string&bwlimit=unlimited&cgi=1&contactemail=username%40example.com&cpmod=jupiter&customip=192.0.2.0&dkim=1&dmarc=1&domain=example.com&featurelist=feature_list&forcedns=0&gid=123456789&hasshell=0&hasuseregns=1&homedir=%2Fhome%2Fuser&ip=n&language=en&mail_node_alias=mailnode&mailbox_format=mdbox&max_defer_fail_percentage=unlimited&max_email_per_hour=unlimited&max_emailacct_quota=1024&max_team_users=7&maxaddon=unlimited&maxftp=unlimited&maxlst=unlimited&maxpark=unlimited&maxpop=unlimited&maxsql=unlimited&maxsub=unlimited&mxcheck=auto&owner=root&ownerself=1&pass=123456luggage&password=123456luggage&pkgname=my_new_package&plan=default"a=500&reseller=0&reseller_without_domain=0&savepkg=1&showpass=n&spamassassin=1&spambox=y&spf=1&uid=123456789&useregns=0'{ "data": { "ip": "192.0.2.0", "nameserver": "ns1.example.com", "nameserver2": "ns2.example.com", "nameserver3": "ns3.example.com", "nameserver4": "ns4.example.com", "nameservera": "192.0.2.1", "nameservera2": "192.0.2.2", "nameservera3": "192.0.2.3", "nameservera4": "192.0.2.4", "nameserverentry": "dnsentry1", "nameserverentry2": "dnsentry2", "nameserverentry3": "dnsentry3", "nameserverentry4": "dnsentry4", "package": "my_new_package" }, "metadata": { "command": "createacct", "output": { … }, "reason": "Account Creation Ok", "result": 1, "version": 1 } }
- Mock server
https://api.docs.cpanel.net/_mock/specifications/whm.openapi/get_current_users_count
- A server running WHM.
https://whm-server.tld:2087/json-api/get_current_users_count
- curl
- JavaScript
- Node.js
- Python
- Java
- C#
- PHP
- Go
- Ruby
- R
- Payload
curl -i -X GET \
-u <username>:<password> \
https://api.docs.cpanel.net/_mock/specifications/whm.openapi/get_current_users_count{ "data": { "users": 100 }, "metadata": { "command": "get_current_users_count", "reason": "OK", "result": 1, "version": 1 } }
- Mock server
https://api.docs.cpanel.net/_mock/specifications/whm.openapi/get_maximum_users
- A server running WHM.
https://whm-server.tld:2087/json-api/get_maximum_users
- curl
- JavaScript
- Node.js
- Python
- Java
- C#
- PHP
- Go
- Ruby
- R
- Payload
curl -i -X GET \
-u <username>:<password> \
https://api.docs.cpanel.net/_mock/specifications/whm.openapi/get_maximum_users{ "data": { "users": 100 }, "metadata": { "command": "get_maximum_users", "reason": "OK", "result": 1, "version": 1 } }