WHM API.
https://api.docs.cpanel.net/_mock/specifications/whm.openapi/
https://{host}:{port}/json-api/
Request
This function returns details about the server's current cPanel & WHM server profile.
- Mock server
https://api.docs.cpanel.net/_mock/specifications/whm.openapi/get_current_profile
- A server running WHM.
https://whm-server.tld:2087/json-api/get_current_profile
- 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_profile{ "data": { "code": "MAILNODE", "description": "This profile provides only services and cPanel features that allow the system to serve mail.", "disabled_roles": [ … ], "enabled_roles": [ … ], "experimental": 1, "name": "Mail", "optional_roles": [ … ] }, "metadata": { "command": "get_current_profile", "reason": "OK", "result": 1, "version": 1 } }
Request
This function checks whether a specific server role is currently enabled for the server.
For more information about server roles, read our How to Use Server Profiles documentation.
The role to check. The role must be one of the following case-sensitive values:
CalendarContact- Allows users to access CalDAV and CardDAV services and features.DNS- Allows users to create and edit Domain Name System (DNS) zone files. This role doesn’t convert your server to a cPanel DNSOnly™ server.FileStorage- Allows users to access cPanel’s File Manager and Git™ Version Control features. When a profile disables this role, you can’t enable the Shell Access setting when you create a new cPanel account.FTP- Allows users to manage their account’s files with an FTP client.MailLocal- Allows the control of local mail delivery and related features.MailReceive- Allows users to receive mail from external sources.MailRelay- Allows the server’s Message Transfer Agent (MTA) to forward mail from one remote host to another.MailSend- Allows users to send mail and control the features necessary for sending mail.MySQL- Allows users to create and manage MySQL® or MariaDB databases.MySQLClient- This role checks whether the MySQL/MariaDB client access exists locally or remotely. You cannot directly enable or disable this role. The system enables or disables this role depending on the MySQL configuration.Postgres- Allows users to create and manage PostgreSQL databases if cPanel & WHM manages the server’s PostgreSQL.PostgresClient- This role checks whether the PostgreSQL client access exists locally.SpamFilter- Allows users to use Apache SpamAssassin™ to identify, sort, and delete unsolicited mail.WebDisk- Allows users to manage their account’s files with a WebDAV client.Webmail- Allows users to access webmail services and features.WebServer- Allows users to create and manage websites for their domains.
- Mock server
https://api.docs.cpanel.net/_mock/specifications/whm.openapi/is_role_enabled
- A server running WHM.
https://whm-server.tld:2087/json-api/is_role_enabled
- 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/is_role_enabled?role=FTP'{ "data": { "enabled": 1 }, "metadata": { "command": "is_role_enabled", "reason": "OK", "result": 1, "version": 1 } }
Request
This function activates a server profile.
Note:
- If a server profile enables a service, the system will also enable service monitoring. To disable a service's monitoring, use WHM's Service Manager interface (WHM >> Home >> Service Configuration >> Service Manager).
- For a list of the server's available profiles, use the
get_available_profilesfunction.
The code value of the server profile.
STANDARD— The Standard profile.DATABASENODE— The Database profile.MAILNODE— The Mail profile.DNSNODE— The DNS profile.
The optional roles to enable or disable with the profile, in JSON format. You must URI-encode this value.
Note:
As an example, if you wished to enable
SpamFilterand disableDNS, the JSON object would be:{ "SpamFilter": 1, "DNS": 0 }.This parameter does not enable optional roles for profiles that do not possess any optional roles.
If you do not pass this parameter, the system disables a profile's optional roles, if any exist.
- Mock server
https://api.docs.cpanel.net/_mock/specifications/whm.openapi/start_profile_activation
- A server running WHM.
https://whm-server.tld:2087/json-api/start_profile_activation
- 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/start_profile_activation?code=MAILNODE&optional={%22DNS%22%3A0%2C%22SpamFilter%22%3A1}'{ "data": { "log_id": "17053.10418168.1533478604" }, "metadata": { "command": "start_profile_activation", "reason": "OK", "result": 1, "version": 1 } }