Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!

Using root account with api2 to addpop to a given user

Discussion in 'cPanel Developers' started by robjacoby, Aug 22, 2011.

  1. robjacoby

    robjacoby Registered

    Aug 22, 2011
    Likes Received:
    Trophy Points:
    Hi all,

    I am looking to use the php publicAPI library found at to add mail accounts for a user. I want to be able to do this using the root login however whenever I try to make any api1 or api2 calls using the root login, I get Access Denied. For example:

    $this->cp Cpanel_PublicAPI::getInstance($this->getOptions()); //where $this->getOptions() contains all relevant params ie, host, user, pass

    public function createEmail($username$email$password$domain$quota 100)
    $queryMf = array(
    'module'    => 'Email',
    'function'  => 'addpop',
    'user'      => $username,

    $queryParams = array(
    'domain'    => $domain,
    'email'     => $email,
    'password'  => $password,
    'quota'     => $quota,

    $response $this->cp->cpanel_api2_request('cpanel'$queryMf$queryParams);
    when calling createEmail with all relevant params, I get the Access Denied response using the root login. If I change the authentication details to the user and pass of the user I want to add the pop account for, it works fine.

    Is this by design? Or am I simply doing something wrong.

    It should also be important to note, that using the root login, any whm_api calls work fine.
  2. MattDees

    MattDees Well-Known Member

    Apr 29, 2005
    Likes Received:
    Trophy Points:
    Houston, TX
    cPanel Access Level:
    Root Administrator
    in your cpanel_api2_request line change "cpanel" to "whostmgr"

    root cannot authenticate against cpanel properly, if that does not fix it, please let me know and I'll ask the developer of that class to take a look at it.
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice