cPanel & WHM's Software Development Kit (SDK)
Welcome, developers! This area of our site provides information about how you can create software that interacts with cPanel & WHM.
Integrating your custom software with cPanel & WHM
We strive to make it easy to develop for cPanel & WHM. This software development kit (SDK) contains instructions and sample code describing the methods you can use to interact with our products. We provide several versions of a fast, flexible API, in addition to scripts and modules.
Getting started
1. If you are new to developing software that integrates with cPanel & WHM, you should review our
API documentation. Our API allows you to access cPanel & WHM through your code. Pay attention to the descriptions of each version of our API, as these allow you to manage different aspects of cPanel & WHM.
2. Once you have some experience with our API, review our
documentation about hooking into cPanel's functionality. This will allow you to automate tasks before and after APIs are run on a cPanel & WHM system.
3. If you have lots of experience with cPanel & WHM's software development kit and are having trouble locating the information you need, head over to our
forums. We are always happy to hear from you.
Where can I go for help?
Have questions? Try one of the following support channels:
| Go here: |
If you: |
| cPanel & WHM Developer Forum |
Find yourself stumped on a problem, wondering where to get help. The forums are populated by both the cPanel staff and a dedicated group of knowledgeable developers . We strongly encourage you to join, post, and share your questions, comments, and concerns with this active online community. |
| Submit a Ticket |
Suspect that a cPanel & WHM update broke something on your server. |
| Feature Requests Forum |
Want to suggest a new feature or change for our software. |
| The Integration Blog |
Want to read announcements and new information about integrating your software with cPanel & WHM. |
| Our UserVoice forum (click the red feedback tab at right) |
Think you've found a problem with our documentation. |
Standardized Hooks
For cPanel & WHM 11.32
Note: The Standardized Hooks documentation is currently under revision. You should check back shortly for improvements to this information.
The Standardized Hooks system adds sanity checks to your custom module and function hooks.
This system also offers a series of insertion points you can use to perform tasks on your cPanel & WHM server.
This system is only available in cPanel & WHM versions 11.32 and later.
| Document |
Description |
| Abstract |
This document is a high-level description of the Standardized Hooks system. |
| Basic Usage |
You can find basic use information for the new system in this document. |
| Advanced Usage |
This document covers more advanced features of the Standardized Hooks system. |
| Insertion Points |
You can find the list of the Standardized Hooks system's insertion points and learn how to use them here. |
| Troubleshooting |
The Standardized Hooks system contains a wealth of robust troubleshooting features. You can learn about them here. |
AppConfig
For cPanel & WHM 11.32
This document describes a cPanel subsystem that can allow you to affect a PHP application served from within cPanel, WHM, or webmail.
| Document |
Description |
| AppConfig |
In cPanel & WHM 11.32, we added the ability to specify two low-level PHP handling attributes when cPanel, WHM, or webmail serves a PHP application. |
cPanel & WHM's API
Our API allows you to access cPanel & WHM functionality from your own integrated or external applications. These documents describe how to use our API functions.
| Basics |
|
| Introduction |
Basic information about our application programming interface (API). |
| Authenticating API Function Calls |
2 methods you can use to authenticate API function calls. |
| cPanel Template Toolkit |
cPanel Template Toolkit is a template-driven parser for API2 calls. This document describes how to use the cPanel Template Toolkit. |
| Internal API |
|
| Using API 1 Functions |
Learn how to call API 1 functions directly using cPanel tags. cPanel tags are supported but will eventually be phased out. If you plan to make your application compatible with all future versions of cPanel & WHM, you should use our LiveAPI system whenever possible. |
| Using API 2 Functions |
This document describes how to call API 2 functions in cPanel tags. cPanel tags are supported but will eventually be phased out. If you plan to make your application compatible with all future versions of cPanel & WHM, you should use our LiveAPI system whenever possible. |
| Using API 1 & 2 Functions via XML API |
You can call API 1 and API 2 functions using our XML API. |
| API 1 Functions |
A reference list of API 1 functions and modules. |
| API 2 Functions |
A reference list of API 2 functions and modules. When coding for the cPanel interface, the API 2 system can utilize a custom templating system, based on Template Toolkit, to display data returned by the functions. API 2 is much more flexible than API 1, but requires more sophisticated coding. We recommend using API 2 whenever possible. |
| Whostmgr::XMLUI::cPanel Perl Module |
The Whostmgr::XMLUI::cPanel module allows you to execute cPanel API 1 and API 2 functions natively from within your Perl applications. |
| External API |
|
| XML and JSON API |
Our XML and JSON APIs allow you to interact with WHM. |
| Parsing XML Data |
Learn how to parse XML output. |
| Manage 2 API |
Our Manage 2 API allows you to manage your licenses. |
| API Privilege Escalation |
You can temporarily escalate a user's privileges while using API calls. |
Modules and Plugins
You can create cPanel modules and plugins to extend cPanel's functionality. WHM plulgins allow you to add new functionality to WHM. These documents explain how to create modules and plugins for cPanel & WHM.
| cPanel Modules |
|
| Installing Internal Perl Modules |
Instructions to install your own internal Perl modules. |
| Writing cPanel Modules |
Modules are software components that you can add to cPanel to extend cPanel's functionality. |
| The PHP Accounting Module |
Learn how to use access keys with cPanel's PHP accounting module. |
| The cPanel::Accounting Perl Module |
Learn how to use remote access keys with the cPanel::Accounting Perl module. |
| Writing cPanel Plugins |
|
| cPanel Plugins |
cPanel Plugins allow you to integrate third-party applications with cPanel. You can use plugins to add links to your users' cPanel interfaces. |
| LiveAPI |
This document covers some basic information about the LiveAPI system. The LiveAPI system is a growing body of work that will make creating software with cPanel & WHM's API and interpreted languages, such as Perl or PHP, much easier.
- LiveAPI PHP Class — The LiveAPI PHP class is a PHP framework you can use within cPanel. This framework provides PHP scripts with a local socket to the cPanel binary,
cpsrvd, allowing your script to make API1 and API2 calls to the local machine via the socket. - LiveAPI Perl Module — The LiveAPI Perl Module provides Perl scripts with a local socket to the cPanel binary,
cpsrvd. |
| cPanel CGI Scripts |
CGI scripts can be very useful when you need more flexibility than cPanel's other integration methods allow. This document describes where and how to create your CGI script. |
| Plugin Variables |
This page documents the variables available within cPanel's HTML logic and DynamicUI files. |
| DynamicUI Reference Charts |
You can use these charts as a reference guide whenever adding items to your cPanel interface. |
| Installing cPanel Plugins |
cPanel plugins must be installed and used in a specific way. You can learn about installing cPanel plugins here. |
| Adding Icons and Groups |
Learn about adding icons and groups to the cPanel interface. |
| Plugin Installation File Generator |
You will need to generate an installation file for your plugins. |
| Plugin Security Policy |
You can read cPanel's plugin security policy here. |
| Using PHP in a cPanel Plugin's Interface |
For cPanel & WHM 11.30 and older versions of cPanel & WHM — We have refactored this system so that it applies to an expanding list of scripting languages. You should review our LiveAPI documentation for the most recent information. cPanel allows for additional pages to be written in PHP rather than straight HTML. This document describes using PHP to generate a cPanel plugin's interface. |
| WHM Plugins |
|
| Creating WHM Plugins |
You can create WHM plugins that extend WHM's functionality. |
| ACL Reference Table |
You can find our access control reference table here. |
| The swapip Utility |
Though it does not reside in the /scripts directory, this tool allows you to update the IP address in a DNS zone record. |
| The cPanel Logger Module |
The Cpanel::Logger module can be used to raise error messages in a custom event handler. This module provides a common interface for logging to files, such as cPanel's error_log. |
| Pluggable dnsadmin Modules |
You can create pluggable dnsadmin modules that automate tasks in your DNS cluster. This set of documents describes how to create these modules. |
| EasyApache Modules |
|
| Custom Modules |
You can add features to EasyApache by developing custom modules. |
cPAddons (Site Software)
cPAddons allow you to add functionality to the cPanel interface.
Advanced System Administration
Advanced system administrators may find the following information useful.
| Advanced System Administration |
|
| TailWatch |
TailWatch is a process that handles the tasks previously handled by three separate processes: eximstats, antirelayd, and cpbandwd. |
| Integrating Custom Webmail Applications |
You can add your favorite custom webmail applications to cPanel. |
| Troubleshooting Perl |
Here are some basic troubleshooting methods you can use when you encounter problems using Perl. |
cPanel Hooks
For cPanel & WHM 11.30 and older versions of cPanel & WHM
As of cPanel & WHM 11.32, we have refactored this system so that it applies sanity checks to your software. You should review our
Standardized Hooks documentation for the most recent information.
These documents explain how to hook into cPanel's functionality. You can run hooks before and after API calls. This will allow you to automate recurring tasks on a cPanel & WHM server.
| cPanel Hooks |
|
| Introduction |
This document will get you started on the various methods of hooking into cPanel's functionality. |
| Writing Function Hooks |
Function hooks allow you to automatically perform actions after an API 1 or API 2 function is executed. These scripts are placed in /usr/local/cpanel/hooks and receive XML via STDIN from parent cPanel processes. |
| Script Hooks |
cPanel & WHM script hooks allow for custom code to be executed for certain system-level operations such as account modifications, installation of server software, and backup runs. |
| Custom Event Handlers |
A custom event handler is a powerful tool that allows you to access operations triggered by the cPanel interface. You can create custom event handlers as pre and post event handlers—meaning that the action is taken before or after an API function executes. |
| The cPanel Logger Module |
You can use the Cpanel::Logger module to raise error messages in a custom event handler. |
| Universal Password Trap |
As a cPanel account password can be changed in a number of places, including both cPanel and WHM, we've created a universal hook that fires anytime an account password is changed. |
| Hooking into EasyApache |
|
| EasyApache Hooks |
Using EasyApache, you can automatically perform actions before or after rebuilding Apache. |
Developer Software
This section contains all of our developer software. This software includes packages and libraries, utilities, API clients, and code examples.
| Packages and Libraries |
|
| API Clients |
|
| PHP XML-API class |
This download provides a PHP class designed for easy automation of the XML API from within PHP scripts. |
| PublicAPI in PHP |
PublicAPI is a set of language-agnostic methods for interacting with cPanel systems. The PublicAPI PHP client class is a PHP implementation of our PublicAPI system. The client supports all of the methods used by the Public API interface, in addition to most of the methods available in our previous PHP client classes, such as the XML-API client class. |
| PublicAPI in Perl |
PublicAPI is a set of language-agnostic methods for interacting with cPanel systems. The PublicAPI Perl client class is a Perl implementation of our PublicAPI system. |
| Developer Utilities |
|
| API Tracer |
This CustomEventHandler allows you to trace API calls made in cPanel along with their input and output data.
Important: This should only be run on development servers. |
| Examples |
|
| Frontend Customization |
This file contains an example of how to build an email account creation page. |
| Backend Customization |
This download contains a description of how to create a CustomEventHandler that implements email blacklisting, including proper error returning from within the CustomEventHandler system. |