Developer Center

Enhance your cPanel with the use of these powerful tools and resources. Plugins, Addons, APIs and more!

Interfacing with cPanel and WHM

Gaining access to cPanel / WHM functionality from an outside script or application

When developing a custom billing application, customer portal, or other external application, you can use cPanel's XML API to gain access to functionality on any cPanel/WHM server, local or remote. The XML API allows you to directly call WHM functionality, or to call cPanel's API1 and API2 APIs with the cPanel XML API call.

Learn more about the XML API


The XML API functionality deprecates the previous cPanel::Accounting Perl and PHP modules


Hooks and reactions to changes in WHM / cPanel

While it is nice to be able to gain access to cPanel / WHM functionality, at many times, it is important to be able to react to changes that a user has made inside of cPanel/WHM. For example, you may need to perform a certain action each time an account or user is created by WHM. To do this, you can tie into the cPanel / WHM hook system. There are 2 types of hooks available for cPanel and WHM. Script Hooks and Function Hooks.

Script Hooks

Script hooks allow you to react to actions performed by cPanel and WHM's scripts. For example, /scripts/upcp is used to update cPanel / WHM. If you need to perform an action before or after an update, you can tie into the /scripts/preupcp or /script/postupcp script hooks

Learn more about the cPanel/WHM Script Hooks

Function Hooks

Function hooks allow you to tie into actions performed within the interface by API1 and API2 functions. For example, a user changing their password. You can capture the user's new password and send it to a billing application for example.

Learn more about the cPanel Function Hooks