Page tree
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, use the unsetupreseller function.

Examples 


 JSON API
https://hostname.example.com:2087/cpsess##########/json-api/terminatereseller?user=username&terminatereseller=1&verify=I%20understand%20this%20will%20irrevocably%20remove=%20all%20the%20accounts%20owned%20by%20the%20reseller%20$resellername
 XML API
https://hostname.example.com:2087/cpsess##########/xml-api/terminatereseller?user=username&terminatereseller=1&verify=I%20understand%20this%20will%20irrevocably%20remove=%20all%20the%20accounts%20owned%20by%20the%20reseller%20$resellername
 Command Line
whmapi0 terminatereseller user=username terminatereseller=1 verify=I understand that this will remove all of the accounts owned by the reseller username

Notes:

  • You must URI-encode values.
  • For more information and additional output options, read our Guide to WHM API 0 documentation or run the whmapi0 --help command. 
  • We introduced this functionality in cPanel & WHM version 11.52.0.8.

 Output (JSON)
{  
   "result":[  
      {  
         "status":1,
         "privdelete":1,
         "statusmsg":"Account Terminations Complete",
         "accts":{  
            "paige":{  
               "status":1,
               "statusmsg":"username account removed",
               "rawout":"Running pre removal script (/scripts/prekillacct)...... 
DoneCollecting Domain Name and IP...User: bob\nDomain: example.com\n... 
DoneKilling all processes owned by user......DoneCleaning passwd,shadow, 
group......DoneRemoving User from Group.......... 
DoneRemoving Web Logs......DoneRemoving Bandwidth Files...... 
DoneRemoving Crontab......DoneRemoving Virtual Hosts...Removed 
Extra Entries from httpd.conf\nexample.com not found in httpd.conf.\n... 
DoneRemoving MySQL databases and users......DoneRemoving 
PostgreSQL databases and users......DoneRemoving System User...... 
DoneRemoving Group......DoneRemoving DNS Entries...example.com 
=> deleted from server. \n...DoneRemoving Email Setup...Removing 
/etc/valiases/example.com\n...DoneRemoving mailman lists...... 
DoneRemoving remotedomains,secondarymx,localdomains entries...... 
DoneRemoving Counter Data......DoneAdding ip back to the ip address pool... 
System has 2 free ips.\n...DoneRemoving user's cPanel Databases & Updating......DoneReloading Services......DoneRemoving mail and service configs...\n...DoneSending Contacts......DoneUpdating internal databases... Updating ftp passwords for username\nPurging ftp user paige\nFtp password files updated.\nFtp vhost passwords synced\n...DoneRunning post removal scripts (/scripts/legacypostkillacct, /scripts/postkillacct)......DoneAccount Removal Complete!!!...username account removed...Done"
            }
         }
      }
   ]
}
 Output (XML)
<terminatereseller>
   <result>
      <accts>
         <name>account1</name>
         <rawout>
Collecting Domain Name and IP...User: account1 Domain: username.tld ...
Done Killing all processes owned by user......Done Cleaning passwd,shadow,group
......Done Removing User from Group..........Done Removing Web Logs......Done
Removing Crontab......Done Removing Virtual Hosts...Removed Extra Entries from
httpd.conf ...Done Removing System User......Done Removing Group......Done
Removing DNS Entries...account1.tld -> deleted from servername. ...Done
Removing Email Setup...Removing /etc/valiases/username.tld ...Done Removing
mailman lists......Done Removing MySQL databases and users......Done Removing
remotedomains,secondarymx,localdomains entries......Done Adding ip back to
ipaddrpool...System has 0 free ips. ...Done Removing user's cPanel Databases &
Updating......Done Reloading Services......DoneSending Contacts......Done Updating
internal databases...Updating ftp passwords for all users Ftp password files updated.
Ftp vhost passwords synced ...Done Running post removal
scripts......Done <br /><b>Account Removal Complete!!!</b><br />
</rawout>
          <status>1</status>
          <statusmsg>account1 account removed</statusmsg>
       </accts>
       <accts>
          <name>bob</name>
          <rawout>
Collecting Domain Name and IP...User: bob Domain: username.tld ...Done Killing all processes
owned by user......Done Cleaning passwd,shadow,group......Done Removing User from
Group..........Done Removing Web Logs......Done Removing Crontab......Done Removing
Virtual Hosts...Removed Extra Entries from httpd.conf ...Done Removing System
User......Done Removing Group......Done Removing DNS Entries......bob.tld -> deleted from
servername. ...Done Unable to unlink /var/named/username.tld.db, file does not exist.bob.tld ->
deleted from servername. ...Done Removing Email Setup...Removing /etc/valiases/username.tld
...Done Removing mailman lists......Done Removing MySQL databases and users...Database
``bob_db1'' dropped Database ``username'' dropped ...Done Removing
remotedomains,secondarymx,localdomains entries......Done Adding ip back to
ipaddrpool...System has 0 free ips. ...Done Removing user's cPanel Databases &
Updating......Done Reloading Services......Done
Sending Contacts......Done Updating internal databases...Updating ftp passwords for
all users Ftp password files updated. Ftp vhost passwords synced ...Done Running
post removal scripts......Done <br /><b>Account Removal Complete!!!</b><br />
</rawout>
          <status>1</status>
          <statusmsg>username account removed</statusmsg>
       </accts>
       <privdelete>1</privdelete>
       <status>1</status>
       <statusmsg>Account Terminations Complete</statusmsg>
   </result>
</terminatereseller>

Parameters

ParameterTypeDescriptionPossible valuesExample
user
string

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
verifystring

Required

A verification message.

 Click to view...

I%20understand%20this%20will%20irrevocably%20remove=%20all%20the%20accounts%20owned%20by%20the%20reseller%20$resellername

Returns

ReturnTypeDescriptionPossible valuesExample

result

array of hashes

An array of hashes of function output.

This hash includes the status, privdelete, and statusmsg returns and the accts hash.

 

status

Boolean

Whether the function succeeded.

The function returns this value in the result hash.

  • 1 — Success.
  • 0 — Failure.
1

privdelete

Boolean

Whether the function deleted the reseller's main account.

The function returns this value in the result hash.

  • 1 — Deleted.
  • 0Not deleted.
1

statusmsg

string

A message of success or a reason for failure.

The function returns this value in the result hash.

  • Account Terminations Complete
  • An error message.

Account Terminations Complete

accts

hash

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

The function returns this hash in the result hash.

This hash includes the username hash, where username is a cPanel username that the reseller owned. 

username

hash

A hash of termination data for an account that the reseller owned.

Note:

The cPanel account name is the return's name.

The function returns this hash in the accts hash.

This hash includes the status, statusmsg, and rawout returns. 

status

Boolean

Whether the function succeeded.

The function returns this value in the username hash.

  • 1 — Success.
  • 0 — Failure.
1

statusmsg

string

A message of success or a reason for failure.

The function returns this value in the username hash.

  • username account removed
  • An error message.

username account removed

 rawout

string

Output from the account's removal.

The function returns this value in the username hash.

One or more string values.

Note:

This output may contain HTML. 

 Click to view...
Collecting Domain Name and IP...User: bob Domain: username.tld ...Done Killing all processes
owned by user......Done Cleaning passwd,shadow,group......Done Removing User from
Group..........Done Removing Web Logs......Done Removing Crontab......Done Removing
Virtual Hosts...Removed Extra Entries from httpd.conf ...Done Removing System
User......Done Removing Group......Done Removing DNS Entries......bob.tld -> deleted from
servername. ...Done Unable to unlink /var/named/username.tld.db, file does not exist.bob.tld ->
deleted from servername. ...Done Removing Email Setup...Removing /etc/valiases/username.tld
...Done Removing mailman lists......Done Removing MySQL databases and users...Database
``bob_db1'' dropped Database ``username'' dropped ...Done Removing
remotedomains,secondarymx,localdomains entries......Done Adding ip back to
ipaddrpool...System has 0 free ips. ...Done Removing user's cPanel Databases &
Updating......Done Reloading Services......Done
Sending Contacts......Done Updating internal databases...Updating ftp passwords for
all users Ftp password files updated. Ftp vhost passwords synced ...Done Running
post removal scripts......Done <br /><b>Account Removal Complete!!!</b><br />