Guide to UAPI

Introduction

UAPI accesses the cPanel interface's features. Use this API to access and modify cPanel account data and settings.

Notes:

  • If you encounter problems with a local access method (LiveAPI PHP, LiveAPI Perl, or Template Toolkit), attempt a browser-based call.
  • You cannot call this API's functions via another API's call methods. 

Basic usage


cPanel or Webmail Session URL 


/execute/Module/function?parameter=value&parameter=value&parameter=value


LiveAPI PHP Class


$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',

 

         )

 

);


LiveAPI Perl Module

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',
    }
);


cPanel Template Toolkit 

<!-- Call a UAPI function. -->
[% 
execute( 
     'Module', 'function', 
     
        'parameter' => 'value', 
        'parameter' => 'value', 
        'parameter' => 'value', 
     
); 
%]

Command Line

uapi  --user=username --output=type Module function parameter=value parameter=value

 

cPanel or Webmail Session URL calls

You can access UAPI functions directly from any web browser when you make the call from a cPanel or Webmail session.

Browser-based calls consist of the following basic parts:



Part
Description
Action
This portion of the URL will always be execute.
Function
The UAPI function.
Input parameters and values
The UAPI function's input parameters and their values.
  • Separate multiple parameter=value pairs with the ampersand character (&).
  • You must URI-encode these values.
 
Note:
The term "Boolean" in our documentation refers to parameters that accept values of 1 or 0. cPanel & WHM APIs do not support the literal values of true and false.
 
Module
The UAPI module name.
Security token
The current session's security token.
Note:
Cookie-based calls (for example, calls from a web browser) require a security token. For other authentication methods, read our Guide to API Authentication documentation. 
Server and port
The web server's HTTP address and the port number to use. Generally, this value begins with https:// and the domain name.
When you call this API, use the following ports:
  •  
  • 2082 —Unsecure calls as a specific cPanel account.
  • 2083 — Secure calls as a specific cPanel account.
  • 2095 —Unsecure calls via a Webmail session.
  • 2096 — Secure calls via a Webmail session.
Warning:
Unless you call this API via the WHM API, you cannot call this API via WHM's ports (2086 or 2087).

 


Warning:

Do not attempt to use the URL of a cPanel or WHM interface in order 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 notguarantee that it will work in the future. Instead, the correct method to perform this action is to call the appropriate API function.

 

API method distinctions

 

cPanel, Inc. 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:

  • 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.

Otherwise-correct calls will return Permission denied or Function not found errors if they use an incorrect port number. 

  • 39 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....