Run cPanel API or UAPI function

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.

SecurityBasicAuth
Request
query Parameters
cpanel_jsonapi_func
required
string

The UAPI function name.

Important:

Function names are case-sensitive.

Example: cpanel_jsonapi_func=listpopswithdisk
cpanel_jsonapi_module
required
string

The UAPI module name.

Important:

Module names are case-sensitive.

Example: cpanel_jsonapi_module=Email
cpanel_jsonapi_user
required
string <username>

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.

Example: cpanel_jsonapi_user=user
cpanel_jsonapi_apiversion
integer
Default: 2

The cPanel API version to use.

  • 1 — Use cPanel API 1.
  • 2 — Use cPanel API 2.
  • 3 — Use UAPI.
Enum: 1 2 3
Example: cpanel_jsonapi_apiversion=3
Variable Names and Values
string

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=value pairs with the ampersand character (&).
  • You must URI-encode these values.
Responses
200

HTTP Request was successful.

Response Schema: application/json
data
any

Information returned by the cPanel API function passed in cpanel_jsonapi_module and cpanel_jsonapi_func.

object
get/cpanel
Request samples
whmapi1 --output=jsonpretty \
  cpanel \
  cpanel_jsonapi_user='user' \
  cpanel_jsonapi_module='Email' \
  cpanel_jsonapi_func='listpopswithdisk'
Response samples
application/json
{
  • "data": null,
  • "metadata": {
    • "command": "cpanel",
    • "reason": "OK",
    • "result": 1,
    • "version": 1
    }
}