WHM API.
https://api.docs.cpanel.net/_mock/specifications/whm.openapi/
https://{host}:{port}/json-api/
- Mock server
https://api.docs.cpanel.net/_mock/specifications/whm.openapi/list_users
- A server running WHM.
https://whm-server.tld:2087/json-api/list_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/list_users{ "data": { "users": [ … ] }, "metadata": { "command": "list_users", "reason": "OK", "result": 1, "version": 1 } }
A Perl Compatible Regular Expression (PCRE) that filters the results.
Note:
- The system matches the PCRE against the
searchtypeparameter's specified type. - If you do not specify a value for both the
searchtypeandsearchparameters, the function returns all of the server's accounts.
The function's search method.
exact- The matched value and thesearchvalue must be identical.regex- The matched value must contain thesearchvalue.
The account information to query. If you do not specify a value for both the searchtype and search parameters, the function returns all of the server's accounts.
domain- Match domains against thesearchregular expression.owner- Match the WHM user who owns the account against thesearchregular expression.user- Match usernames against thesearchregular expression.ip- Match IP addresses against thesearchregular expression.package- Match hosting plans (packages) against thesearchregular expression.
- Mock server
https://api.docs.cpanel.net/_mock/specifications/whm.openapi/listaccts
- A server running WHM.
https://whm-server.tld:2087/json-api/listaccts
- 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/listaccts?search=username&searchmethod=exact&searchtype=domain&want=domain%2Cdiskused'{ "data": { "acct": [ … ] }, "metadata": { "command": "listaccts", "reason": "OK", "result": 1, "version": 1 } }
Request
This function modifies multiple cPanel accounts.
Warning:
- We strongly recommend that you do not modify a cPanel account's settings if that account uses a hosting plan (package). If the package values change, the system will overwrite any of your custom values with the package's new values.
- This function uses case-sensitive parameters. You must enter parameters in the correct case format. If you do not, the function will ignore that parameter.
Note:
On servers that run CentOS 7, you may see a named warning 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 account's current username.
Note:
To modify multiple users, duplicate or increment the parameter name. For example, the user-1, user-2, and user-3 parameters.
Whether backups are enabled for the account.
1— Enabled.0— Disabled.
This parameter defaults to the defined system value.
Note:
This parameter requires root privileges.
The account's maximum bandwidth use, in bytes.
0,nullorunlimited— The account can use unlimited bandwidth.
This parameter defaults to the defined system value.
The account's contact email address.
This parameter defaults to the defined system value.
The owner of the account's MySQL® databases.
This parameter defaults to the defined system value.
The number of disk blocks for the account, in kilobytes (KB).
This parameter defaults to the defined system value.
Whether CGI access is enabled for the account.
1— Enabled.0— Disabled.
This parameter defaults to the defined system value.
Note:
When a server profile disables the Web Server role, you cannot enable CGI access.
Whether DomainKeys Identified Mail (DKIM) is enabled for the account.
1— Enabled.0— Disabled.
This parameter defaults to the defined system value.
Whether Domain-based Message Authentication, Reporting, and Conformance (DMARC) is enabled for the account.
1— Enabled.0— Disabled.
This parameter defaults to the defined system value.
Whether shell (SSH) access is enabled for the account.
1— Enabled.0— Disabled.
This parameter defaults to the defined system value.
Note:
We strongly recommend that you use the shell parameter to specify a shell for SSH access.
Whether Sender Policy Framework (SPF) is enabled for the account.
1— Enabled.0— Disabled.
This parameter defaults to the defined system value.
The account's display language.
This parameter defaults to the defined system value.
The account's default locale.
This parameter defaults to the defined system value.
The storage format that the account's mailboxes use.
maildirmbox
This parameter defaults to the defined system value.
The percentage of failed or deferred email messages that the account can send per hour before outgoing mail is rate-limited.
0orunlimited— The account can send an unlimited number of failed or deferred messages.
This parameter defaults to the defined system value.
The maximum number of emails that the account can send in one hour.
0orunlimited— The account can send an unlimited number of emails.
This parameter defaults to the defined system value.
The maximum size, in megabytes (MB), that the account can define when it creates an email account.
unlimited— The account possesses an unlimited quota.
Important:
- This value applies to each email account, not each cPanel account.
- If you specify a
MAX_EMAILACCT_QUOTAvalue, the function will overwrite the plan's defined value for that cPanel account. - This parameter does not affect any existing email accounts
- We recommend that you allow the account's plan to determine this value.
MAX_EMAIL_PER_HOURwill define to unlimited if you do not define either the plan orMAX_EMAILACCT_QUOTAparameters.
This parameter defaults to the defined system value. It will default to unlimited if you do not define either the plan or MAX_EMAILACCT_QUOTA parameters.
The account's maximum number of addon domains.
0,null, orunlimited— The account possesses unlimited addon domains.
This parameter defaults to the defined system value.
The account's maximum number of FTP accounts.
nullorunlimited— The account possesses unlimited FTP accounts.
This parameter defaults to the defined system value.
The account's maximum number of mailing lists.
0,null, orunlimited— The account possesses unlimited mailing lists.
This parameter defaults to the defined system value.
The account's maximum number of parked domains (aliases).
nullorunlimited— The account possesses unlimited mailing lists.
This parameter defaults to the defined system value.
The account's maximum number of Ruby applications.
nullorunlimited— The account possesses unlimited Ruby applications.
This parameter defaults to the defined system value.
The maximum number of email accounts for the account.
nullorunlimited— The account possesses unlimited email accounts.
This parameter defaults to the defined system value.
The maximum number of each available type of SQL database for the account.
For example, if you set this value to 5 and the system administrator allows MySQL® and PostgreSQL® databases, users can create up to five MySQL databases and up to five PostgreSQL databases.
nullorunlimited— The account possesses unlimited databases.
This parameter defaults to the defined system value.
The maximum number of subdomains for the account.
nullorunlimited— The account possesses unlimited subdomains.
This parameter defaults to the defined system value.
Whether to modify the firewall rules as part of the account modification.
1– Modify the firewall rules.0– Do not modify the firewall rules.
NOTE:
If you do not set this parameter, the system will modify the firewall based on the Do not make changes to the firewall during account modification. setting in WHM's Tweak Settings interface (WHM >> Home >> Server Configuration >> Tweak Settings).
The priority of the account's primary mail exchanger.
Note:
The parameter name consists of MXCHECK, a hyphen, and the primary domain of the account.
Example key and value:
MXCHECK-example.com=10
This parameter defaults to the define system value.
Whether to send a notification when someone links the account to an external authentication account.
1— Enabled.0— Disabled.
This parameter defaults to the defined system value.
Whether to send a notification when someone disables notifications for external authentication account links.
1— Enabled.0— Disabled.
This parameter defaults to the defined system value.
Whether to send a notification when an AutoSSL certificate expires.
1— Enabled.0— Disabled.
This parameter defaults to the defined system value.
Whether to send a notification AutoSSL cannot renew a certificate because domains that fail Domain Control Validation (DCV) exist on the current certificate.
1— Enabled.0— Disabled.
This parameter defaults to the defined system value.
Whether to send a notification when AutoSSL renews a certificate.
1— Enabled.0— Disabled.
This parameter defaults to the defined system value.
Whether to send a notification when AutoSSL renews a certificate but the new certificate lacks at least one domain that the previous certificate secured.
1— Enabled.0— Disabled.
This parameter defaults to the defined system value.
Whether to send a notification when someone changes the contact address for the account.
1— Enabled.0— Disabled.
This parameter defaults to the defined system value.
Whether to send a notification when disables the notification for contact address changes.
1— Enabled.0— Disabled.
This parameter defaults to the defined system value.
Whether to send a notification when the account reaches its disk usage limit.
1— Enabled.0— Disabled.
This parameter defaults to the defined system value.
Whether to send a notification when someone changes the account's password.
1— Enabled.0— Disabled.
This parameter defaults to the defined system value.
Whether to send a notification when someone disables notifications for password changes.
1— Enabled.0— Disabled.
This parameter defaults to the defined system value.
Whether to send a notification when an SSL certificate on the account expires.
1— Enabled.0— Disabled.
This parameter defaults to the defined system value.
Whether to suspend outgoing email on the account.
1— Suspend outgoing email.0— Do not suspend outgoing email.
This parameter defaults to the defined system value.
A new owner's username or the root user, to change the account's owner.
This parameter defaults to the defined system value.
Note:
The authenticated user must have root privileges in order to assign the account to a reseller other than that account.
An access token for the account's Pushbullet™ notifications.
This parameter defaults to the defined system value.
The account's disk space quota, in multiples of 1,048,576 bytes.
0,null, orunlimited— The account's disk space is unlimited.
This parameter defaults to the defined system value.
A space-separated list of removed, missing, or uninstalled extensions.
This parameter defaults to the defined system value.
Warning:
This parameter removes all of the extensions that you list from the _PACKAGE_EXTENSIONS variable in the user file. It will not remove the extensions' variables. For more information, read our Guide to Package Extensions.
Whether to rename the cPanel account's database objects to use a new username's database prefix. This parameter only applies to servers that use database prefixing.
1— Rename the cPanel account's database objects.0— Do not rename the cPanel account's database objects.
Warning:
- The account owner must update any applications to use the new database object names.
- Use this parameter carefully. It can cause confusion for system administrators.
MySQL does not allow you to rename a database. When cPanel & WHM "renames" a database, the system performs the following steps:
- The system creates a new database.
- The system moves data from the old database to the new database.
- The system recreates grants and stored code in the new database.
- The system deletes the old database and its grants.
Warning:
- If any of the first three steps fail, the system returns an error and attempts to restore the database's original state. If the restoration process fails, the API function's error response describes these additional failures.
- In rare cases, the system creates the second database successfully, but fails to delete the old database or grants. The system treats the rename action as a success; however, the API function returns warnings that describe the failure to delete the old database or grants.
Whether to grant reseller privileges to the account.
1— Grant reseller privileges.0— Do not grant reseller privileges.
The account's cPanel interface theme.
This parameter defaults to the defined system value.
The absolute file path to the shell's location.
This parameter defaults to the defined system value.
Whether Apache SpamAssassin™ is enabled for the account.
1— Enabled.0— Disabled.
This parameter defaults to the defined system value.
A timestamp for which to use as the account's creation date.
This parameter defaults to the defined system value.
- Mock server
https://api.docs.cpanel.net/_mock/specifications/whm.openapi/massmodifyacct
- A server running WHM.
https://whm-server.tld:2087/json-api/massmodifyacct
- 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/massmodifyacct?user=string&BACKUP=1&BWLIMIT=unlimited&CONTACTEMAIL=username%40example.com&DBOWNER=example&DISK_BLOCK_LIMIT=100000000&HASCGI=1&HASDKIM=1&HASDMARC=1&HASSHELL=1&HASSPF=1&LANG=english-utf8&LOCALE=en&MAILBOX_FORMAT=maildir&MAX_DEFER_FAIL_PERCENTAGE=unlimited&MAX_EMAIL_PER_HOUR=unlimited&MAX_EMAILACCT_QUOTA=unlimited&MAXADDON=unlimited&MAXFTP=unlimited&MAXLST=unlimited&MAXPARK=unlimited&MAXPASSENGERAPPS=unlimited&MAXPOP=unlimited&MAXSQL=unlimited&MAXSUB=unlimited&modify_firewall=0&MXCHECK-*=1¬ify_account_authn_link=0¬ify_account_authn_link_notification_disabled=0¬ify_autossl_expiry=0¬ify_autossl_expiry_coverage=0¬ify_autossl_renewal=0¬ify_autossl_renewal_coverage=0¬ify_contact_address_change=0¬ify_contact_address_change_notification_disabled=0¬ify_disk_limit=0¬ify_password_change=0¬ify_password_change_notification_disabled=0¬ify_ssl_expiry=0&OUTGOING_EMAIL_SUSPENDED=0&OWNER=reseller&PUSHBULLET_ACCESS_TOKEN=1234567890"A=unlimited&remove_missing_extensions=packageext1+packageext2&rename_database_objects=0&reseller=1&RS=jupiter&shell=%2Fbin%2Fbash&spamassassin=1&STARTDATE=1549471343&STYLE=Glass'{ "data": { "payload": [ … ] }, "metadata": { "command": "massmodifyacct", "messages": [ … ], "reason": "Failed to modify one or more users.", "result": 0, "version": 1, "warnings": [] } }