Development Guides Home

Guide to Replacing cPanel API 1 Functions with UAPI Equivalents

This document lists the UAPI functions which replace previously-deprecated cPanel API 1 functions. We introduced UAPI in cPanel & WHM version 11.42. As we developed additional UAPI functions, we created equivalents to some cPanel API 1 functions. Beginning with cPanel & WHM version 82, we started development for new UAPI modules and functions. These new modules and functions replace any cPanel API 1 functions without a current equivalent.

We are actively removing the cPanel API 1 functions beginning in cPanel & WHM version 88. We strongly recommend that anyone using a cPanel API 1 function use a UAPI function instead.

Replace cPanel API 1 functions with UAPI equivalents

To retrieve a list of cPanel API 1 functions that custom integrations call your system, call the following WHM API 1 functions:

The following examples display code from a cPanel API 1 function and its UAPI equivalent. Click the tab below that corresponds to your chosen development language.

Note:

The examples below compare the cPanel API 1 SetLang::setlang function and the UAPI Locale::set_locale function.

LiveAPI PHP Class

cPanel API 1 function

Copy
Copied
$cpanel = new CPANEL(); // Connect to cPanel - only do this once.

// Set the "en" locale for the account.
$new_language = $cpanel->api1(
    'SetLang', 'setlang',
        array('en')
);

UAPI Function

Copy
Copied
$cpanel = new CPANEL(); // Connect to cPanel - only do this once.

// Set the "en" locale for the account.
$set_locale = $cpanel->uapi(
    'Locale', 'set_locale',
    array(
        'locale' => 'en',
    )
);

LiveAPI Perl Module

cPanel API 1 function

Copy
Copied
my $cpliveapi = Cpanel::LiveAPI->new(); # Connect to cPanel - only do this once.

# Set the "en" locale for the account.
my $new_language = $cpliveapi->api1(
    'SetLang', 'setlang',
        ['en']
);

UAPI function

Copy
Copied
my $cpliveapi = Cpanel::LiveAPI->new(); # Connect to cPanel - only do this once.

# Set the "en" locale for the account.
my $set_locale = $cpliveapi->uapi(
    'Locale', 'set_locale',
    {
        'locale' => 'en',
    }
);
Note:

For more information, read our Guide to the LiveAPI System.

For more information about how to replace a cPanel API 1 function with a UAPI function, read our Replace a cPanel API 1 Function With a UAPI Function documentation.

UAPI functions and legacy equivalents

The following tables list the UAPI functions that we added starting in cPanel & WHM version 82. The tables also list their cPanel API 1 equivalent functions.

For a complete list of UAPI functions and cPanel API 1 functions, read our Guide to UAPI and Guide to cPanel API 1 documentation.

BoxTrapper

cPanel API 1 Functions UAPI Functions
BoxTrapper::changestatus BoxTrapper::set_status
BoxTrapper::fetchcfgfile
BoxTrapper::listmsgs BoxTrapper::list_email_templates
BoxTrapper::get_log
BoxTrapper::resetmsg BoxTrapper::reset_email_template
BoxTrapper::savecfgfile BoxTrapper::set_allowlist
BoxTrapper::saveconf
BoxTrapper::get_configuration
This function returns all of an account's BoxTrapper configuration settings.
BoxTrapper::showmessage BoxTrapper::get_message
BoxTrapper::list_queued_messages
This function inherently has filtering capabilities.
BoxTrapper::get_status

ClamScanner

cPanel API 1 Functions UAPI Functions
ClamScanner::bars

DenyIp

cPanel API 1 Functions UAPI Functions
DenyIp::adddenyip BlockIp::add_ip
DenyIp::deldenyip BlockIp::remove_ip

Fileman

cPanel API 1 Functions UAPI Functions
Fileman::restoredb Backup::restore_databases
Fileman::restorefiles Backup::restore_files
Fileman::restoreaf

Gpg

cPanel API 1 Functions UAPI Functions
Gpg::deletekey GPG::delete_keypair
Gpg::exportkey GPG::export_public_key
Gpg::exportsecretkey GPG::export_secret_key
Gpg::genkey GPG::generate_key
Gpg::importkeys GPG::import_key

Htaccess

cPanel API 1 Functions UAPI Functions
Htaccess::del_user DirectoryPrivacy::delete_user
Htaccess::htdirls
DirectoryPrivacy::list_users
Htaccess::resname DirectoryIndexes::get_indexing
Htaccess::setindex DirectoryIndexes::set_indexing
Htaccess::set_pass DirectoryPrivacy::add_user
Htaccess::set_protect DirectoryPrivacy::configure_directory_protection

ImageManager

cPanel API 1 Functions UAPI Functions
ImageManager::convert ImageManager::convert_file
ImageManager::thumbnail ImageManager::create_thumbnails
ImageManager::get_dimensions
This function returns all of an image's dimensions.
ImageManager::scale ImageManager::resize_image

LogManager

cPanel API 1 Functions UAPI Functions
LogManager::listdownloads LogManager::list_archives
LogManager::savesettings LogManager::set_settings
LogManager::showsettings LogManager::get_settings

MySQL®

cPanel API 1 Functions UAPI Functions
Mysql::list_databases
Mysql::routines Mysql::list_routines
Mysql::list_users
Mysql::updateprivs Mysql::update_privileges

Net

cPanel API 1 Functions UAPI Functions
Net::dnslookup DNS::lookup

Park

cPanel API 1 Functions UAPI Functions
Park::disableredirect Mime::delete_redirect
Park::getredirecturl Mime::get_redirect
Park::setredirecturl Mime::add_redirect

PHP

cPanel API 1 Functions UAPI Functions
PHP::loaddocroots DomainInfo::domains_data
PHP::loadvars

PostgreSQL®

cPanel API 1 Functions UAPI Functions
Postgres::deluser Postgresql::delete_user
Postgresql::list_databases
Postgres::listusersopt Postgresql::list_users

ServerInformation

cPanel API 1 Functions UAPI Functions
ServerInfo::servicestatus ServerInformation::get_information

SetLang

Note:

We removed the SetLang cPanel API 1 module in cPanel & WHM version 82.

cPanel API 1 Functions UAPI Functions
SetLang::setlang Locale::set_locale
SetLang::listlangsopt Locale::list_locales

Stats

cPanel API 1 Functions UAPI Functions
Stats::errlog Stats::get_site_errors
Stats::showbandwidth Stats::get_bandwidth

StatsManager

cPanel API 1 Functions UAPI Functions
StatManager::updateUserConfig StatsManager::save_configuration
StatManager::doForm StatsManager::get_configuration

SubDomain

cPanel API 1 Functions UAPI Functions
SubDomain::disablesubrd Mime::delete_redirect
SubDomain::setsuburl Mime::add_redirect
SubDomain::subdomainurl Mime::get_redirect