Child pages
  • WHM API 1 Functions - terminatereseller
Skip to end of metadata
Go to start of metadata

Description


This function deletes a reseller and all of the reseller's cPanel accounts.

Warning:

  • You cannot recover deleted accounts. Use this function with extreme caution.
  • This function deletes the reseller account and all of the accounts that the reseller owns.
  • To remove reseller privileges from an account but not delete the reseller's account or any accounts that the reseller owns, call the WHM API 1 unsetupreseller function.

Examples 


 JSON API
https://hostname.example.com:2087/cpsess##########/json-api/terminatereseller?api.version=1&user=username&terminatereseller=1
 XML API
https://hostname.example.com:2087/cpsess##########/xml-api/terminatereseller?api.version=1&user=username&terminatereseller=1
 Command Line
whmapi1 terminatereseller user=username terminatereseller=1


Notes:

  • You must URI-encode values.
  • For more information and additional output options, read our Guide to WHM API 1 documentation or run the whmapi1 --help command.
  • If you run CloudLinux™, you must use the full path of the whmapi1 command:

    /usr/local/cpanel/bin/whmapi1

 Output (JSON)
{  
   "data":{  
      "acct":[  
         {  
            "reason":"example account removed",
            "user":"example",
            "output":{  
               "raw":"Running pre removal script (/usr/local/cpanel/scripts/prekillacct)......Done\n 
Collecting Domain Name and IP...User: example\nDomain: example.com\n 
...Done\nLocking account and setting shell to nologin...Locking password for user example.\n 
passwd: Success\n 
...Done\n 
Killing all processes owned by user......Done\n 
Removing Sessions.........Done\n 
Removing Suspended Info.........Done\n 
Cleaning Virtfs.........Done\n 
Removing Web Logs......Done\n 
Removing Bandwidth Files......Done\n 
Removing Email Sending Limits Cache......Done\n 
Removing DKIM keys......Done\n 
Removing Crontab......Done\n 
Removing HTTP Virtual Hosts...Removed the following non-SSL virtual hosts: example.com test.example.com doggy.example.com fred.example.com\n 
Removed the following SSL virtual hosts: example.com\n 
...Done\n 
Removing ftp Virtual Hosts......Done\n 
Removing user's web content directory symlinks......Done\n 
Removing MySQL databases and users...Removed DB example_wp\n 
Database \"example_wp\" dropped\n 
...Done\nRemoving PostgreSQL databases and users......Done\n 
Removing User & Group.......Success...Done\nRemoving DNS Entries...example.com => deleted from hostname. \n ...Done\n Removing Email Setup...Removing /etc/valiases/example.com\n Removing /etc/valiases/test.example.com\n Removing /etc/valiases/doggy.example.com\n Removing /etc/valiases/fred.example.com\n ...Done\n Removing mailman lists......Done\n Updating Databases......Done\n Removing bandwidth limits......Done\nRemoving Counter Data......Done\n Adding IP back to the IP address pool...System has 2 free ips.\n ...Done\n Removing user's cPanel Databases & Updating......Done\n Reloading Services......Done\n Removing mail and service configs...\n ...Done\n ...Done\nSending Contacts......Done\n Updating internal databases...Updating ftp passwords for example\n Purging ftp user example\nFtp password files updated.\ Ftp vhost passwords synced\n ...Done\n Running post removal scripts (/usr/local/cpanel/scripts/legacypostkillacct, /usr/local/cpanel/scripts/postkillacct)......Done\nAccount Removal Complete!!!...example account removed...Done\n"
            },
            "result":1
         }
      ]
   },
   "metadata":{  
      "version":1,
      "reason":"OK",
      "result":1,
      "command":"terminatereseller"
   }
}
 Output (XML)
<result>
   <data>
      <acct>
         <reason>example account removed</reason>
         <user>example</user>
         <output>
            <raw>Running pre removal script (/usr/local/cpanel/scripts/prekillacct)......Done
Collecting Domain Name and IP...User: example Domain: example.com ...Done
Locking account and setting shell to nologin...Locking password for user example. passwd: Success ...Done
Killing all processes owned by user......Done
Removing Sessions.........Done
Removing Suspended Info.........Done
Cleaning Virtfs.........Done
Removing Web Logs......Done
Removing Bandwidth Files......Done
Removing Email Sending Limits Cache......Done
Removing DKIM keys......Done
Removing Crontab......Done
Removing HTTP Virtual Hosts...Removed the following non-SSL virtual hosts: example.com Removed the following SSL virtual hosts: ...Done
Removing ftp Virtual Hosts......Done Removing user's web content directory symlinks......Done
Removing MySQL databases and users......Done
Removing PostgreSQL databases and users......Done
Removing User & Group.......Success...Done Removing DNS Entries...example.com => deleted from hostname. ...Done Removing Email Setup...Removing /etc/valiases/example.com ...Done Removing mailman lists......Done Updating Databases......Done Removing bandwidth limits......Done Removing Counter Data......Done Adding IP back to the IP address pool...System has 3 free ips. ...Done Removing user's cPanel Databases & Updating......Done Reloading Services......Done Removing mail and service configs... ...Done Sending Contacts......Done Updating internal databases...Updating ftp passwords for example Purging ftp user example Ftp password files updated. Ftp vhost passwords synced ...Done Running post removal scripts (/usr/local/cpanel/scripts/legacypostkillacct, /usr/local/cpanel/scripts/postkillacct)......Done Account Removal Complete!!!...example account removed...Done 
               </raw> 
            </output> 
            <result>1</result> 
         </acct> 
   </data> 
   <metadata> 
      <version>1</version> 
      <reason>OK</reason> 
      <result>1</result> 
      <command>terminatereseller</command> 
   </metadata> 
</result>


Note:

Use WHM's API Shell interface (WHM >> Home >> Development >> API Shell) to directly test WHM API calls.

   

Parameters

ParameterTypeDescriptionPossible valuesExample
userstring

Required

The reseller account's username.

A valid reseller username on the server.username
terminateresellerBoolean

Required

Whether to terminate the reseller's main account.

  • 1 — Terminate.
  • 0 — Do not terminate.
1

Returns

ReturnTypeDescriptionPossible valuesExample

acct

array of hashes

An array of hashes of function output.

This hash contains the reason, user, and result returns and the output hash.

 

user

string

The account username.

The function returns this value in the acct hash.

A valid username.

username

result

Boolean

Whether the function succeeded.

The function returns this value in the  acct hash.

  • 1 — Success.
  • 0 — Failure.
1

reason

string

A message of success or a reason for failure.

The function returns this value in the  acct hash.

  • username account removed
  • An error message.

username account removed

output

hash

A hash of termination data for the reseller's accounts.

The function returns this hash in the  acct hash.

This hash contains the raw parameter. 

 raw

string

Output from the account's removal.

The function returns this value in the  output hash.

One or more string values.

Note:

This output may contain HTML. 

 Click to view...
Running pre removal script (/usr/local/cpanel/scripts/prekillacct)......Done
Collecting Domain Name and IP...User: example Domain: example.com ...Done
Locking account and setting shell to nologin...Locking password for user example. passwd: Success ...Done
Killing all processes owned by user......Done
Removing Sessions.........Done
Removing Suspended Info.........Done
Cleaning Virtfs.........Done
Removing Web Logs......Done
Removing Bandwidth Files......Done
Removing Email Sending Limits Cache......Done
Removing DKIM keys......Done
Removing Crontab......Done
Removing HTTP Virtual Hosts...Removed the following non-SSL virtual hosts: example.com Removed the following SSL virtual hosts: ...Done
Removing ftp Virtual Hosts......Done Removing user's web content directory symlinks......Done
Removing MySQL databases and users......Done
Removing PostgreSQL databases and users......Done
Removing User & Group.......Success...Done Removing DNS Entries...example.com => deleted from hostname. ...Done Removing Email Setup...Removing /etc/valiases/example.com ...Done Removing mailman lists......Done Updating Databases......Done Removing bandwidth limits......Done Removing Counter Data......Done Adding IP back to the IP address pool...System has 3 free ips. ...Done Removing user's cPanel Databases & Updating......Done Reloading Services......Done Removing mail and service configs... ...Done Removing Logaholic Webstats...Id: TQ:TaskQueue:129 ...Done Sending Contacts......Done Updating internal databases...Updating ftp passwords for example Purging ftp user example Ftp password files updated. Ftp vhost passwords synced ...Done Running post removal scripts (/usr/local/cpanel/scripts/legacypostkillacct, /usr/local/cpanel/scripts/postkillacct)......Done Account Removal Complete!!!...example account removed...Done