- Created by Documentation, last modified on Oct 18, 2018
disable_authentication_provider
disable_failing_authentication_providers
enable_authentication_provider
get_available_authentication_providers
get_provider_client_configurations
get_provider_configuration_fields
get_provider_display_configurations
get_users_authn_linked_accounts
set_provider_client_configurations
set_provider_display_configurations
twofactorauth_generate_tfa_config
twofactorauth_get_user_configs
cpgreylist_is_server_netblock_trusted
cpgreylist_list_entries_for_common_mail_provider
cpgreylist_load_common_mail_providers_config
cpgreylist_save_common_mail_providers_config
cpgreylist_trust_entries_for_common_mail_provider
cpgreylist_untrust_entries_for_common_mail_provider
create_cpgreylist_trusted_host
delete_cpgreylist_trusted_host
Introduction
WHM API 1 accesses the WHM interface's features. You can use this API to perform server administration tasks, administrate cPanel and WHM reseller accounts, and manage cPanel & WHM services.
Important:
In cPanel & WHM version 76, we introduced server profiles and roles. When you enable a non-Standard Node server profile, the system disables API calls associated with that profile's disabled roles.
Notes:
- Use the
applist
command to return an alphabetical list of WHM API 1 functions. - You cannot call this API's functions via another API's call methods. For more information, read the API method distinctions section below.
Basic usage
https://hostname.example.com:2087/cpsess##########/json-api/accountsummary?api.version=1&user=username
WHM API calls through JSON consist of the following basic parts:
Part | Description |
---|---|
Server and port | The web server's HTTP address and the port number to use. Generally, this value begins with When you call this API, use the following ports:
Warning: You cannot call this API via cPanel ports ( |
Security token | The current session's security token. Note: Cookie-based calls (for example, calls from a web browser) require a security token. For other authentication methods, read our Guide to API Authentication documentation. |
API type | The API output type that you wish to receive. Use |
Function | The WHM API function. |
API version | The API version to use. To call WHM API 1, set the |
Input parameters and values | The function's input parameters and their values.
Note: The term "Boolean" in our documentation refers to parameters that accept values of
|
Important:
cPanel & WHM version 66 deprecated XML output for cPanel API 1, cPanel API 2, UAPI, WHM API 0, and WHM API 1.
- Calls for XML API output will return a deprecation warning.
- We plan to remove XML output entirely in a future version of cPanel & WHM.
For more information, read our cPanel Deprecation Plan documentation.
https://hostname.example.com:2087/cpsess##########/xml-api/accountsummary?api.version=1&user=username
Warning:
WHM API calls through XML consist of the following basic parts:
Part | Description |
---|---|
Server and port | The web server's HTTP address and the port number to access.
|
Security token | The current session's security token. Note: Cookie-based calls (for example, calls from a web browser) require a security token. For other authentication methods, read our Guide to API Authentication documentation. |
API type | The API output type that you wish to receive. Use |
Function | The WHM API function. |
API version | The API version to use. To call WHM API 1, set the |
Input parameters and values | The function's input parameters and their values.
Note: The term "Boolean" in our documentation refers to parameters that accept values of
|
whmapi1 accountsummary user=username
Notes:
- cPanel & WHM introduced the command line feature in version 11.52.0.8.
- WHM API 1 calls via the command line do not return the metadata that other methods return if they experience errors that prevent a successful function run. For more information, read our WHM API 1 - Return Data documentation.
WHM API calls through the command line consist of the following basic parts:
Part | Description |
---|---|
Command | This value is always Note: If you run CloudLinux™, you must use the full path of the /usr/local/cpanel/bin/whmapi1 |
Output Type | The API output type that you wish to receive.
Note: This parameter defaults to |
Function | The WHM API function. |
Input parameters and values | The function's input parameters and their values.
Note: The term "Boolean" in our documentation refers to parameters that accept values of
|
Note:
For more information about this feature, run the following command:
whmapi1 --help
Warning:
Do not attempt to use cPanel or WHM interface URLs to perform actions in custom code. You must call the appropriate API functions in order to perform the actions of cPanel & WHM's interfaces.
For example, do not pass values to .html
pages, as in the following example:
http://example.com:2082/frontend/x3/mail/doaddpop.html/email=name&domain=user.com
While this unsupported method sometimes worked in previous versions of cPanel & WHM, we strongly discourage its use and do not guarantee that it will work in the future. Instead, the correct method to perform this action is to call the appropriate API function.
API method distinctions
cPanel, L.L.C. produces four current and two deprecated APIs, and they all include separate sets of functions. Make certain that the function and module that you call exist in the API version that your code uses. Important: API calls must use the correct port: Otherwise-correct calls will return Select a tab to view examples of calls to the desired API: Note: Browser-based calls to WHM API 1 must include the WHM API version ( For more information, read our Guide to Testing Custom Code - WHM API Calls and Guide to WHM API 1 documentation. Note: For more information, read our Guide to Testing Custom Code - cPanel API and UAPI Calls and Guide to UAPI documentation. Note: For more information, read our Guide to Testing Custom Code - cPanel API and UAPI Calls and Guide to cPanel API 2 documentation. Warning: WHM API 0 is deprecated. We strongly recommend that you only use the equivalent WHM API 1 functions instead. Note: For more information, read our Guide to Testing Custom Code - WHM API Calls and Guide to WHM API 0 documentation. Warning: cPanel API 1 is deprecated. We strongly recommend that you use cPanel API 2 or UAPI instead. Note: For more information, read our Guide to Testing Custom Code - cPanel API and UAPI Calls and Guide to cPanel API 1 documentation. 2082
— Unsecure calls to cPanel's APIs.2083
— Secure calls to cPanel's APIs.2095
— Unsecure calls to cPanel's APIs via a Webmail session.2096
— Secure calls to cPanel's APIs via a Webmail session.2086
— Unsecure calls to WHM's APIs, or to cPanel's APIs via the WHM API.2087
— Secure calls to WHM's APIs, or to cPanel's APIs via the WHM API.Permission denied
or Function not found
errors if they use an incorrect port number. https://hostname.example.com:2087/cpsess##########/json-api/accountsummary?api.version=1&user=username
api.version=1
). If you omit the version, the system calls WHM API 0, which may not contain the desired function, or may contain an older version of that function.whmapi1 accountsummary user=username
https://hostname.example.com:2083/cpsess##########/execute/Module/function?parameter=value¶meter=value¶meter=value
uapi --user=username --output=type Module function parameter=value parameter=value
$cpanel = new CPANEL(); // Connect to cPanel - only do this once.
// Call a UAPI function.
$function_result = $cpanel->uapi(
'Module', 'function',
array(
'parameter' => 'value',
'parameter' => 'value',
'parameter' => 'value',
)
);
my $cpliveapi = Cpanel::LiveAPI->new(); # Connect to cPanel - only do this once.
# Call a UAPI function.
my $function_result = $cpliveapi->uapi(
'Module', 'function',
{
'parameter' => 'value',
'parameter' => 'value',
'parameter' => 'value',
}
);
<!-- Call a UAPI function. -->
[%
execute(
'Module', 'function',
{
'parameter' => 'value',
'parameter' => 'value',
'parameter' => 'value',
}
);
%]
https://hostname.example.com:2087/cpsess##########/json-api/cpanel?cpanel_jsonapi_user=user&cpanel_jsonapi_apiversion=2&cpanel_jsonapi_module=Module&cpanel_jsonapi_func=function¶meter="value"
cpapi2 --user=username --output=type Module function parameter=value parameter=value
<!-- Call a cPanel API 2 function. -->
[%-
USE Api2;
SET myvariable = execute(
'Module', 'function',
{
'parameter' => 'value',
'parameter' => 'value',
'parameter' => 'value',
}
);
%]
$cpanel = new CPANEL(); // Connect to cPanel - only do this once.
// Call the function.
$my_variable = $cpanel->api2(
'Module', 'function',
array(
'parameter' => 'value',
'parameter' => 'value',
'parameter' => 'value',
)
);
my $cpliveapi = Cpanel::LiveAPI->new(); # Connect to cPanel - only do this once.
# Call the function.
my $my_variable = $cpliveapi->api2(
'Module', 'function',
{
'parameter' => 'value',
'parameter' => 'value',
'parameter' => 'value',
}
);
https://hostname.example.com:2087/cpsess##########/json-api/accountsummary?user=username
whmapi0 accountsummary user=username
cpapi1 --user=username --output=type Module function parameter=value parameter=value
$cpanel = new CPANEL(); // Connect to cPanel - only do this once.
$your_variable = $cpanel->api1('Module', 'function', array('parameter', 'parameter', 'parameter') ); // Call the function.
my $cpliveapi = Cpanel::LiveAPI->new(); # Connect to cPanel - only do this once.
my $your_variable = $cpliveapi->api1('Module', 'function', ['parameter', 'parameter', 'parameter'] ); # Call the function.
<!-- Call a cPanel API 1 function. -->
[%-
USE Api1;
SET myvariable = execute(
'Module', 'function',
{
'parameter' => 'value',
'parameter' => 'value',
'parameter' => 'value',
}
);
%]
WHM API 1 Basics
Available in:
WHM 11+
Languages:
JSON, XML
Methods:
GET, POST
Return Formats:
About WHM API 1
WHM API 1 performs functions and accesses data in WHM.
Notes:
- Some functions and parameters may require that you authenticate as the
root
user. - You must use the appropriate WHM ports (
2086
or2087
) to call WHM API functions.
Related Documentation
-
Page:Guide to WHM API 1 — WHM API 1 accesses the WHM interface's features.
-
Page:WHM API 1 - Filter Output — You can use additional variables to filter WHM API 1 output.
-
Page:WHM API 1 - Sort Output — You can use additional variables to sort WHM API 1 output.
-
Page:WHM API 1 - Paginate Output — You can use additional variables to paginate WHM API 1 output.
-
Page:WHM API 1 - Return Data — WHM API 1 outputs data in either JSON or XML format.