- Created by Documentation, last modified on Oct 18, 2018
cPanel Tags
(deprecated)
Bandwidth:: displaybwheader
Bandwidth:: displaybw
Bandwidth:: displayday
Bandwidth:: displaymainbwheader
BoxTrapper:: changestatus
BoxTrapper:: cleancfgfilelist
BoxTrapper:: editmsg
BoxTrapper:: fetchcfgfile
BoxTrapper:: getboxconfdir
BoxTrapper:: listmsgs
BoxTrapper:: logcontrols
BoxTrapper:: messageaction
BoxTrapper:: multimessageaction
BoxTrapper:: resetmsg
BoxTrapper:: savecfgfile
BoxTrapper:: saveconf
BoxTrapper:: showautowhitelist
BoxTrapper:: showemails
BoxTrapper:: showfromname
BoxTrapper:: showlog
BoxTrapper:: showmessage
BoxTrapper:: showqueue
BoxTrapper:: showqueuesearch
BoxTrapper:: showqueuetime
BoxTrapper:: status
BoxTrapper:: statusbutton
Branding:: file
Branding:: image
Branding:: killimg
Branding:: setbrandingpkg
Branding:: setmyacctspkg
Branding:: setupdirs
Branding:: tempsetbrandingpkg
Chkservd:: geteximport
Chkservd:: geteximport_ssl
ClamScanner:: bars
cPAddons:: mainpg
Cron:: crontab_perms
CustInfo:: getemail
DiskUsage:: showmanager
Email:: addautoresponder
Email:: adddforward
Email:: addfilter
Email:: addlist
Email:: addmx
Email:: addpop
Email:: addspam
Email:: addspambox
Email:: addspamfilter
Email:: changemx
Email:: checkfastmail
Email:: checkpipefwd
Email:: clearspambox
Email:: delautoresponder
Email:: deldforward
Email:: delfilter
Email:: dellist
Email:: delmx
Email:: delpop
Email:: delspam
Email:: delspambox
Email:: disable_spam_autodelete
Email:: editquota
Email:: enable_spam_autodelete
Email:: getaging
Email:: getarsbody
Email:: getarscharset
Email:: getarsfrom
Email:: getarshtml
Email:: getarsinterval
Email:: getarsstart
Email:: getarsstop
Email:: getarssubject
Email:: getmailserver
Email:: getmailserveruser
Email:: getpopquota
Email:: has_spam_as_acl
Email:: has_spam_autodelete
Email:: listmaildomains
Email:: listmaildomainsopt
Email:: listmaildomainsoptndef
Email:: mainacctdiskused
Email:: passwdlist
Email:: passwdpop
Email:: setmxaccept
Email:: spamboxstatus
Email:: spamstatus
Email:: tracefilter
Fileman:: changeperm
Fileman:: delfile
Fileman:: dofileop
Fileman:: emptytrash
Fileman:: extractfile
Fileman:: fileimg
Fileman:: fmmkdir
Fileman:: fmmkfile
Fileman:: fmpushfile
Fileman:: fmrename
Fileman:: fmsavefile
Fileman:: fmsavehtmlfile
Fileman:: fullbackup
Fileman:: getfile
Fileman:: htmleditor
Fileman:: killdir
Fileman:: listfiles
Fileman:: listfullbackups
Fileman:: listtemplates
Fileman:: restoreaf
Fileman:: restoredb
Fileman:: restorefile
Fileman:: restorefiles
Fileman:: savehtmlfile
Fileman:: showperm
Fileman:: uploadfiles
Fileman:: viewfile
Ftp:: addftp
Ftp:: delftp
Ftp:: ftpquota
Ftp:: ftpservername
Ftp:: ftpstatslogin
Ftp:: get_anonftp
Ftp:: get_anonftpin
Ftp:: get_welcomemsg
Ftp:: getftpquota
Ftp:: kill_ftp_session
Ftp:: listftpstatsurl
Ftp:: passwdftp
Ftp:: set_anonftp
Ftp:: set_anonftpin
Ftp:: set_welcomemsg
Htaccess:: checkprotected
Htaccess:: del_user
Htaccess:: getindex
Htaccess:: htdirls
Htaccess:: number_of_users
Htaccess:: phpselectable
Htaccess:: resname
Htaccess:: set_pass
Htaccess:: set_protect
Htaccess:: setindex
Htaccess:: setphpreference
Htaccess:: showusers
ImageManager:: convert
ImageManager:: dimensions
ImageManager:: hdimension
ImageManager:: scale
ImageManager:: thumbnail
ImageManager:: wdimension
LastLogin:: lastlogin
LeechProtect:: disable
LeechProtect:: enable
LeechProtect:: setup
LeechProtect:: showpasswdfile
LeechProtect:: status
MagicRevision:: uri
Mime:: add_handler
Mime:: add_hotlink
Mime:: add_mime
Mime:: add_redirect
Mime:: del_handler
Mime:: del_hotlink
Mime:: del_mime
Mime:: del_redirect
Mime:: linkallownull
Mime:: linkenable
Mime:: linkexts
Mime:: linkrurl
Mime:: linkurls
Mysql:: adddb
Mysql:: addhost
Mysql:: adduser
Mysql:: adduserdb
Mysql:: checkdb
Mysql:: deldb
Mysql:: delhost
Mysql:: deluser
Mysql:: deluserdb
Mysql:: gethost
Mysql:: initcache
Mysql:: listdbs
Mysql:: listdbsopt
Mysql:: listusers
Mysql:: listusersopt
Mysql:: number_of_dbs
Mysql:: number_of_users
Mysql:: repairdb
Mysql:: routines
Mysql:: updateprivs
News:: displaynews
NVData:: set
Postgres:: adddb
Postgres:: adduser
Postgres:: adduserdb
Postgres:: deldb
Postgres:: deluser
Postgres:: deluserdb
Postgres:: initcache
Postgres:: listdbsopt
Postgres:: listusersopt
Postgres:: number_of_dbs
Postgres:: number_of_users
ProxyUtils:: proxyaddress
Resellers:: accountlistopt
Resellers:: themelistopt
Serverinfo:: servicestatus
SetLang:: listlangsopt
SetLang:: setlang
SpamAssassin:: config
SpamAssassin:: saveconfig
SSH:: getport
SSL:: delete
SSL:: deletecrt
SSL:: deletecsr
SSL:: deletekey
SSL:: gencrt
SSL:: gencsr
SSL:: genkey
SSL:: getcabundle
SSL:: getcnname
SSL:: install
SSL:: installedhost
SSL:: listkeysopt
SSL:: showcrt
SSL:: showcsr
SSL:: showkey
SSL:: sslsharedstatus
SSL:: uploadcrt
SSL:: uploadkey
StatManager:: doForm
StatManager:: updateUserConfig
Stats:: analoglist
Stats:: awstats
Stats:: bwbar
Stats:: errlog
Stats:: lastvisitors
Stats:: showbandwidth
Stats:: webalizer
Stats:: webalizerftp
SubDomain:: addsubdomain
SubDomain:: cplistsubdomains
SubDomain:: disablesubrd
SubDomain:: listsubdomainsop
SubDomain:: setsuburl
Introduction
cPanel API 1 accesses information from the cPanel interface.
Warning:
cPanel API 1 is deprecated. We strongly recommend that you use cPanel API 2 or UAPI instead.
Important:
In cPanel & WHM version 76, we introduced server profiles and roles. When you enable a non-Standard Node server profile, the system disables API calls associated with that profile's disabled roles.
Note:
You cannot call this API's functions via another API's call methods. For more information, read the API method distinctions section below.
Basic usage
$cpanel = new CPANEL(); // Connect to cPanel - only do this once. $your_variable = $cpanel->api1('Module', 'function', array('parameter', 'parameter', 'parameter') ); // Call the function.
my $cpliveapi = Cpanel::LiveAPI->new(); # Connect to cPanel - only do this once. my $your_variable = $cpliveapi->api1('Module', 'function', ['parameter', 'parameter', 'parameter'] ); # Call the function.
Note:
Currently, individual function documentation does not include Template Toolkit examples.
[%- USE Api1; SET myvariable = execute( 'Module', 'function', { 'parameter' => 'value', 'parameter' => 'value', 'parameter' => 'value', } ); %]
<cpanel Module="Module::function( $FORM('parameter','parameter','parameter') )">
cpapi1 --user=username --output=type Module function parameter=value parameter=value
Note:
cPanel & WHM introduced the command line feature in version 56.
cPanel API 1 calls through the command line consist of the following basic parts:
Part | Description |
---|---|
Command | This value is always Note: If you run CloudLinux™, you must use the full path of the /usr/local/cpanel/bin/cpapi1 |
Output Type | The API output type that you wish to receive.
Note: This parameter defaults to |
Module | The cPanel API 1 module name. |
Function | The cPanel API 1 function. |
User | The cPanel account-level username. |
Input parameters and values | The function's input parameters and their values.
Note: The term "Boolean" in our documentation refers to parameters that accept values of
|
Note:
For more information about this feature, run the following command:
cpapi1 --help
Variable | Description | Example |
---|---|---|
Module | The module for the function that you wish to use. | Email |
function | The cPanel API 1 function that you wish to use. | addpop |
parameter | Input parameters that you pass to the function. Important:
Note: The term "Boolean" in our documentation refers to parameters that accept values of | example.com |
Warning:
Do not attempt to use cPanel or WHM interface URLs to perform actions in custom code. You must call the appropriate API functions in order to perform the actions of cPanel & WHM's interfaces.
For example, do not pass values to .html
pages, as in the following example:
http://example.com:2082/frontend/x3/mail/doaddpop.html/email=name&domain=user.com
While this unsupported method sometimes worked in previous versions of cPanel & WHM, we strongly discourage its use and do not guarantee that it will work in the future. Instead, the correct method to perform this action is to call the appropriate API function.
Call cPanel API 1 from the WHM API
Warning:
Unless you call this API via the WHM API, you cannot call this API via WHM's ports (2086
or 2087
).
You can use the WHM API to call cPanel API functions. For more information, read our Use WHM API to Call cPanel API & UAPI documentation.
Important:
Because some cPanel API 1 functions return HTML output, this method will cause parsing errors in most XML parsers. We strongly recommend that you use cPanel API 2 instead.
Custom Event Handlers and Standardized Hooks
You can use the Standardized Hook System to customize the events before and after a cPanel API call.
API method distinctions
cPanel, L.L.C. produces four current and two deprecated APIs, and they all include separate sets of functions. Make certain that the function and module that you call exist in the API version that your code uses. Important: API calls must use the correct port: Otherwise-correct calls will return Select a tab to view examples of calls to the desired API: Note: Browser-based calls to WHM API 1 must include the WHM API version ( For more information, read our Guide to Testing Custom Code - WHM API Calls and Guide to WHM API 1 documentation. Note: For more information, read our Guide to Testing Custom Code - cPanel API and UAPI Calls and Guide to UAPI documentation. Note: For more information, read our Guide to Testing Custom Code - cPanel API and UAPI Calls and Guide to cPanel API 2 documentation. Warning: WHM API 0 is deprecated. We strongly recommend that you only use the equivalent WHM API 1 functions instead. Note: For more information, read our Guide to Testing Custom Code - WHM API Calls and Guide to WHM API 0 documentation. Warning: cPanel API 1 is deprecated. We strongly recommend that you use cPanel API 2 or UAPI instead. Note: For more information, read our Guide to Testing Custom Code - cPanel API and UAPI Calls and Guide to cPanel API 1 documentation. 2082
— Unsecure calls to cPanel's APIs.2083
— Secure calls to cPanel's APIs.2095
— Unsecure calls to cPanel's APIs via a Webmail session.2096
— Secure calls to cPanel's APIs via a Webmail session.2086
— Unsecure calls to WHM's APIs, or to cPanel's APIs via the WHM API.2087
— Secure calls to WHM's APIs, or to cPanel's APIs via the WHM API.Permission denied
or Function not found
errors if they use an incorrect port number. https://hostname.example.com:2087/cpsess##########/json-api/accountsummary?api.version=1&user=username
api.version=1
). If you omit the version, the system calls WHM API 0, which may not contain the desired function, or may contain an older version of that function.whmapi1 accountsummary user=username
https://hostname.example.com:2083/cpsess##########/execute/Module/function?parameter=value¶meter=value¶meter=value
uapi --user=username --output=type Module function parameter=value parameter=value
$cpanel = new CPANEL(); // Connect to cPanel - only do this once.
// Call a UAPI function.
$function_result = $cpanel->uapi(
'Module', 'function',
array(
'parameter' => 'value',
'parameter' => 'value',
'parameter' => 'value',
)
);
my $cpliveapi = Cpanel::LiveAPI->new(); # Connect to cPanel - only do this once.
# Call a UAPI function.
my $function_result = $cpliveapi->uapi(
'Module', 'function',
{
'parameter' => 'value',
'parameter' => 'value',
'parameter' => 'value',
}
);
<!-- Call a UAPI function. -->
[%
execute(
'Module', 'function',
{
'parameter' => 'value',
'parameter' => 'value',
'parameter' => 'value',
}
);
%]
https://hostname.example.com:2087/cpsess##########/json-api/cpanel?cpanel_jsonapi_user=user&cpanel_jsonapi_apiversion=2&cpanel_jsonapi_module=Module&cpanel_jsonapi_func=function¶meter="value"
cpapi2 --user=username --output=type Module function parameter=value parameter=value
<!-- Call a cPanel API 2 function. -->
[%-
USE Api2;
SET myvariable = execute(
'Module', 'function',
{
'parameter' => 'value',
'parameter' => 'value',
'parameter' => 'value',
}
);
%]
$cpanel = new CPANEL(); // Connect to cPanel - only do this once.
// Call the function.
$my_variable = $cpanel->api2(
'Module', 'function',
array(
'parameter' => 'value',
'parameter' => 'value',
'parameter' => 'value',
)
);
my $cpliveapi = Cpanel::LiveAPI->new(); # Connect to cPanel - only do this once.
# Call the function.
my $my_variable = $cpliveapi->api2(
'Module', 'function',
{
'parameter' => 'value',
'parameter' => 'value',
'parameter' => 'value',
}
);
https://hostname.example.com:2087/cpsess##########/json-api/accountsummary?user=username
whmapi0 accountsummary user=username
cpapi1 --user=username --output=type Module function parameter=value parameter=value
$cpanel = new CPANEL(); // Connect to cPanel - only do this once.
$your_variable = $cpanel->api1('Module', 'function', array('parameter', 'parameter', 'parameter') ); // Call the function.
my $cpliveapi = Cpanel::LiveAPI->new(); # Connect to cPanel - only do this once.
my $your_variable = $cpliveapi->api1('Module', 'function', ['parameter', 'parameter', 'parameter'] ); # Call the function.
<!-- Call a cPanel API 1 function. -->
[%-
USE Api1;
SET myvariable = execute(
'Module', 'function',
{
'parameter' => 'value',
'parameter' => 'value',
'parameter' => 'value',
}
);
%]
cPanel API 1 Basics
Available in:
cPanel 11+
Languages:
PHP, Perl
Methods:
GET, POST
Return Formats:
See the desired function for output information.
About cPanel API 1
Warning:
cPanel API 1 is deprecated. We strongly recommend that you use cPanel API 2 or UAPI instead.
Notes:
- These functions may require a feature list. To view the available feature lists on a cPanel server, view WHM's Feature Manager interface.
- Unless you call this API via the WHM API, you must use the appropriate cPanel ports (
2082
or2083
). You can also call some functions via cPanel's Webmail ports (2095
or2096
).
Related Documentation
-
Page:Use WHM API to Call cPanel API and UAPI — You can call cPanel API and UAPI functions through the WHM API.
-
Page:Guide to the Manage2 API — The Manage2 API automates cPanel license management procedures.
-
Page:Guide to UAPI — UAPI accesses the cPanel interface's features.
-
Page:Guide to WHM API 0 — WHM API 0 accesses the WHM interface's features.
-
Page:Guide to cPanel API 2 — cPanel API 2 accesses cPanel account information and modifies settings.