You can call cPanel API and UAPI functions through the WHM API.
We recommend that you use WHM API 1
uapi_cpanel function. This 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
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.
For more information about WHM API calls, read our Guide to WHM API 1 documentation.
WHM API calls consist of the following basic parts:
The web server's HTTP address.
Generally, this value is
https:// and the hostname.
The port number to access.
2087- Secure connection.
2086- Insecure connection.
We strongly recommend that you use port
2087and a secure connection.
If you use port
2086and enable the Always redirect to SSL option in WHM's Tweak Settings interface ( WHM >> Home >> Server Configuration >> Tweak Settings ), the system redirects insecure API calls and causes errors.
The current session's security token.
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 UAPI module name.
Module names are case-sensitive.
The UAPI function name.
Function names are case-sensitive.
The cPanel API version to use.
1- Use cPanel API 1.
2- Use cPanel API 2.
3- Use UAPI.
If you do not supply this parameter, the system defaults to cPanel API 2.
The function's input parameters and their values.
parameter=valuepairs with the ampersand character (
- You must URI-encode these values.