Use WHM API to Call cPanel API & UAPI

Introduction

You can call cPanel API and UAPI functions through the WHM API.

Note:

We introduced this feature in cPanel & WHM version 11.48.

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.

Basic usage

WHM API calls consist of the following basic parts:



Item
Description
Example
Server
The web server's HTTP address.
Generally, this value is https:// and the hostname.
https://hostname.example.com
Port
The port number to access.
  • 2087 — Secure connection.
  • 2086 — Insecure connection.
Notes:
  • We strongly recommend that you use port 2087 and a secure connection.
  • If you use port 2086 and enable Always redirect to SSL in WHM'sTweak Settings interface (Home >> Server Configuration >> Tweak Settings), the system redirects insecure API calls and causes issues.
2087
Security Token
The current session's security token.
cpsess123456789
Output format
The output type to return.
  • Use json-api to return JavaScript Object Notation (JSON). Make sure to use the JSON versions of the cpanel_ parameters below.
  • Use xml-api to return Extensible Markup Language (XML). Make sure to use the XML versions of the cpanel_ parameters below.
Note:
 
This API's XML output does not comply with XML standards, is slower than JSON output to produce, and may result in validation errors. Westrongly recommend that you use JSON.
 
json-api
Function
The WHM API function to call. For cPanel API1, cPanel API2, and UAPI, use the cpanel function.
cpanel
cPanel User
The cPanel username for the account through which to call the function.
cpanel_jsonapi_user=user
or
cpanel_xmlapi_user=user
cPanel API or UAPIModule
The UAPI module name.
Important:
Module names are case-sensitive
cpanel_jsonapi_module=Email
or
cpanel_xmlapi_module=Email
cPanel API or UAPI Function
The UAPI function name.
Important:
Function names are case-sensitive
 cpanel_jsonapi_func=listpopswithdisk 
or
 cpanel_xmlapi_func=listpopswithdisk 
cPanel API Version
The cPanel API version to use.
  • 1 — Use cPanel API 1.
  • 2 — Use cPanel API 2.
  • 3 — Use UAPI.
Warning:
If you do not supply this parameter, the system defaults to cPanel API 2.
 
 
cpanel_jsonapi_apiversion=3
or
cpanel_xmlapi_version=3
Variable Names and Values
The function's input parameters and their values.
Notes:
  • Separate multiple parameter=value pairs with the ampersand character (&).
  • You must URI-encode these values.
domain=example.com
  • 132 Users Found This Useful
Was this answer helpful?

Related Articles

The cPanel Interface

For  cPanel  &  WHM  version  58 Overview The cPanel interface is...

User Preferences

For cPanel & WHM version 58 Overview This document outlines how to access your cPanel...

Manage External Authentications

For cPanel & WHM version 58 Overview Manage credentials Additional documentation...

What is cPanelID?

In This Article:  Overview ServicesHow to get a cPanelID cPanelID External...

Guide to cPanel Interface Customization - cPanel Style Development

Introduction You can develop custom styles that modify the appearance of the cPanel interface....