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/cors_proxy_get
- A server running WHM.
https://whm-server.tld:2087/json-api/cors_proxy_get
- 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/cors_proxy_get?url=http%3A%2F%2Fwww.example.com'{ "data": { "_cp_redirects": [ … ], "content": "<!doctype html>\\n<html>\\n<head>\\n <title>Example Domain</title>\\n\\n <meta charset=\\\"utf-8\\\" />\\n <meta http-equiv=\\\"Content-type\\\" content=\\\"text/html; charset=utf-8\\\" />\\n <meta name=\\\"viewport\\\" content=\\\"width=device-width, initial-scale=1\\\" />\\n <style type=\\\"text/css\\\">\\n body {\\n background-color: #f0f0f2;\\n margin: 0;\\n padding: 0;\\n font-family: -apple-system, system-ui, BlinkMacSystemFont, \\\"Segoe UI\\\", \\\"Open Sans\\\", \\\"Helvetica Neue\\\", Helvetica, Arial, sans-serif;\\n\\n }\\n div {\\n width: 600px;\\n margin: 5em auto;\\n padding: 2em;\\n background-color: #fdfdff;\\n border-radius: 0.5em;\\n box-shadow: 2px 3px 7px 2px rgba(0,0,0,0.02);\\n }\\n a:link, a:visited {\\n color: #38488f;\\n text-decoration: none;\\n }\\n @media (max-width: 700px) {\\n div {\\n margin: 0 auto;\\n width: auto;\\n }\\n }\\n </style>\\n</head>\\n\\n<body>\\n<div>\\n <h1>Example Domain</h1>\\n <p>This domain is for use in illustrative examples in documents. You may use this\\n domain in literature without prior coordination or asking for permission.</p>\\n <p><a href=\\\"https://www.iana.org/domains/example\\\">More information...</a></p>\\n</div>\\n</body>\\n</html>\\n" }, "metadata": { "command": "cors_proxy_get", "reason": "OK", "result": 1, "version": 1 } }
Request
You can call cPanel API and UAPI functions through the WHM API.
This method is useful, for example, when you develop plugins for WHM users, particularly resellers, but need to access cPanel functions. You can make these calls from within either the WHM or cPanel interfaces.
Important:
We recommend that you use the WHM API 1 uapi_cpanel function. The uapi_cpanel function is a more flexible way to call cPanel API functions from WHM. For example, you can use the uapi_cpanel function with the WHM API 1 batch function.
Before calling a cPanel API function via this method, read its documentation. The cPanel API function may require other parameters not listed in this document.
The UAPI function name.
Important:
Function names are case-sensitive.
The UAPI module name.
Important:
Module names are case-sensitive.
The cPanel username for the account through which to call the function.
Make certain that you specify the username in lowercase characters only. cPanel & WHM automatically converts usernames to lowercase when you create a cPanel account. For this reason, if you supply a username that includes some or all capital letters, the call will fail.
The cPanel API version to use.
1— Use cPanel API 1.2— Use cPanel API 2.3— Use UAPI.
The function's input parameters and their values. You can add any additional parameters supported by the underlying cPanel API function.
Example: domain=example.com
Note:
- Separate multiple
parameter=valuepairs with the ampersand character (&). - You must URI-encode these values.
- Mock server
https://api.docs.cpanel.net/_mock/specifications/whm.openapi/cpanel
- A server running WHM.
https://whm-server.tld:2087/json-api/cpanel
- 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/cpanel?cpanel_jsonapi_func=listpopswithdisk&cpanel_jsonapi_module=Email&cpanel_jsonapi_user=user&cpanel_jsonapi_apiversion=3&Variable+Names+and+Values=string'{ "data": null, "metadata": { "command": "cpanel", "reason": "OK", "result": 1, "version": 1 } }
The name of the function to call on the remote server.
The name of the parameter for the function.
Note:
You must enter the same number of parameter_name and parameter_value parameters.
The value of the parameter for the function.
Note:
You must enter the same number of parameter_name and parameter_value parameters.
- Mock server
https://api.docs.cpanel.net/_mock/specifications/whm.openapi/execute_remote_whmapi1_with_password
- A server running WHM.
https://whm-server.tld:2087/json-api/execute_remote_whmapi1_with_password
- 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/execute_remote_whmapi1_with_password?function=passwd&host=host.example.com¶meter_name=user¶meter_value=username2&password=luggage12345&username=username&tls_verification=on'{ "data": { "app": [ … ], "key-name*": "system" }, "metadata": { "command": "execute_remote_whmapi1_with_password", "reason": "OK", "result": 1, "version": 1 } }