Problems with cpapi2 listparkeddomains

JAB Creations

Active Member
Nov 21, 2009

I'm here because apparently cPanel 74 totally destroyed the automation of my business. So now, on a Monday on the second to last week of December before everyone disappears for a minimum of three weeks I'm fixing code instead of making phone calls. SO! Let's make this thread actually count for something please.

My ultimate goal is to add a parked domain name. When I look at the documentation for parked domain names I see several API options available. The documentation is so completely chaotic I can barely follow a very few select topics beyond a second page!

I attempted to use the WHM API but even though I authenticated with cURL (Guide to API Authentication - Username and Password Authentication - Developer Documentation - cPanel Documentation) I have ZERO frigin idea of which API it is and how to execute any sort of request!

I attempted to research using the Webmail Session URL hours of searching never reveal how the heck I obtain a security token!!! The closest I got was on this page: Guide to API Authentication - API Tokens - Developer Documentation - cPanel Documentation however it just says, "$token = "MYAPITOKEN";" but NEVER talks about HOW to OBTAIN the token!!!

I attempted a PHP request:
$result = shell_exec('cpapi2 --user=root Park listparkeddomains');
That just dumps all the commands.

So I tried the command in PuTTY:

[[email protected]:/root]$ cpapi2 --user=root Park listparkeddomains
[2018-12-03 17:50:12 -0500] warn [Internal Warning while parsing unknown 23005] Use of uninitialized value $Cpanel::CPDATA{"DNS"} in hash element at /usr/local/cpanel/Cpanel/ line 298.
 at /usr/local/cpanel/Cpanel/ line 298.
        Cpanel::Park::api2_listparkeddomains("api.function", "listparkeddomains", "api.module", "Park") called at /usr/local/cpanel/Cpanel/Api2/ line 134
        eval {...} called at /usr/local/cpanel/Cpanel/Api2/ line 134
        Cpanel::Api2::Exec::api2_exec("Park", "listparkeddomains", HASH(0x2f51050), HASH(0x2f50df8)) called at line 1278
        cpanel::cpanel::docpanelaction(HASH(0x2f50eb8)) called at line 4227
        cpanel::cpanel::run_fast_json_mode() called at line 840
        cpanel::cpanel::script("cpanel::cpanel", "--json-fast-connect", "--stdin") called at line 271

  apiversion: 2
  data: []

    result: 1
  func: listparkeddomains
  module: Park
[[email protected]:/root]$
So even though I somehow found a working command - it's broken!!!

I'm staring straight down the shotgun barrel of having my entire December completely obliterated here. All I need is to use PHP to list parked domains and add a new parked domain. That is IT! Literally my entire life hangs by this literal thread. Please HELP!
Last edited by a moderator:


Product Owner II
Staff member
Nov 14, 2017
Hello @JAB Creations

Did you see the UAPI function here? UAPI Functions - DomainInfo::list_domains - Developer Documentation - cPanel Documentation
This will be taking the place of the cPapi2 function that you were using

Also that function you're using isn't broken, it's being used incorrectly, you shouldn't be using the root user. The root user won't/shouldn't have parked domains. Used with a regular user I can confirm this works without issue.

Is there something else that was not working properly as well?