With the release of cPanel & WHM version 82 to CURRENT this week, we are adding several new UAPI modules and functions. These new functions replace several previously-deprecated cPanel API 1 functions. For a complete list of API calls that we’ve added so far, read our Guide to Replacing cPanel API 1 functions with UAPI equivalents documentation.
Our goal is to provide a more seamless experience for anyone who integrates with cPanel & WHM.
What is an API, and who uses it?
An Application Programming Interface (API) is a set of subroutine definitions and communication protocols. These components help connect a software application’s backend functionality to a user interface (UI). An API can also function as a means for external applications to communicate with the application that defines the API.
When users perform an action in the UI or directly via an API call, the API sends the action to the backend. The backend then responds with the information. If the system can’t complete the request, the API call returns a meaningful error or warning.
cPanel & WHM uses the API frameworks that ship with our product to build, populate, and create functionality in our UIs. Anyone who wants to integrate with cPanel & WHM can also use these API frameworks.
Wait, cPanel & WHM has an API?
cPanel & WHM has two active APIs:
- WHM API 1 — Use this API to access WHM functionality
- UAPI — Use this API to access cPanel functionality.
We also have the following deprecated APIs:
For more information about each of these APIs, read our Quickstart Development Guide documentation.
We introduced UAPI in cPanel & WHM version 11.42. UAPI provides a more consistent and predictable experience for developers who create integrations and extensions that interact with cPanel. UAPI functions return information in a simple data structure without formatting. This format allows integrators to use the data as needed. UAPI allows developers to filter, sort, and paginate the output. Additionally, developers can filter returned data into output columns.
Since cPanel API 1 and API 2 are both deprecated, we strongly recommend using UAPI calls for cPanel integrations whenever possible. We tentatively plan to have all cPanel functionality operating under the UAPI framework by version 86 and plan to completely remove cPanel API 1 from our codebase in version 88.
A Simple Example
Imagine you are a web developer with many cPanel user accounts across various servers to help manage your customers’ websites. You want to ensure that those sites don’t run out of their allocated filesystem space, so you create a dashboard web application. The UAPI Quota::get_quota_info call is what you need to get the necessary data to your dashboard.
With a simple API request, it returns the following account information:
- The account’s megabyte limit.
- The account’s megabytes used.
- The account’s remaining megabytes.
You can pass this data into variables within your code that are later used to generate a graph. You’ve done this for one cPanel instance, but you have three other accounts.
So within each cPanel account, you generate a cPanel API Token. This token allows you to access API functionality for the cPanel account without logging in through the cPanel interface. Now, on a regular interval of time that you’ve set, your dashboard can automatically poll each cPanel account via the API and retrieve the data you need.
Tell Us Your Thoughts!
What APIs have you used in the past? What features and options make an API great to use? Join in on developer discussions in our Discord integrations channel, on our cPanel Developers forum, and sign up to our Plugin Devs mailing list. You can also join us in our Slack channel or our official cPanel subreddit! Look for future blog posts to include updates related to this API project and monitor our Release Notes to keep informed about new UAPI functions.
We look forward to hearing your thoughts and continuing this discussion!