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

 

Description

This function deletes a cPanel or WHM account.

Warning:

You cannot recover deleted accounts. 

Examples 


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


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)
{  
   "metadata":{  
      "version":1,
      "reason":"example account removed",
      "output":{  
         "raw":"Running pre removal script (/usr/local/cpanel/scripts/prekillacct)......Done\nCollecting Domain Name and IP...User: example\nDomain: example.com\n...Done\nLocking account and setting shell to nologin...Locking password for user example.\npasswd: Success\n...Done\nKilling all processes owned by user......Done\nRemoving Sessions.........Done\nRemoving Suspended Info.........Done\nCleaning Virtfs.........Done\nRemoving Web Logs......Done\nRemoving Bandwidth Files......Done\nRemoving Email Sending Limits Cache......Done\nRemoving DKIM keys......Done\nRemoving Crontab......Done\nRemoving HTTP Virtual Hosts...Removed the following non-SSL virtual hosts: example.com\nRemoved the following SSL virtual hosts: \n...Done\nRemoving ftp Virtual Hosts......Done\nRemoving user's web content directory symlinks......Done\nRemoving MySQL databases and users......Done\nRemoving PostgreSQL databases and users......Done\nRemoving User & Group.......Success...Done\nRemoving DNS Entries...example.com => deleted from hostname. \n...Done\nRemoving Email Setup...Removing /etc/valiases/example.com\n...Done\nRemoving mailman lists......Done\nUpdating Databases......Done\nRemoving bandwidth limits......Done\nRemoving Counter Data......Done\nAdding IP back to the IP address pool...System has 2 free ips.\n...Done\nRemoving user's cPanel Databases & Updating......Done\nReloading Services......Done\nRemoving mail and service configs...\n...Done\nSending Contacts......Done\nUpdating internal databases...Updating ftp passwords for example\nPurging ftp user example\nFtp password files updated.\nFtp vhost passwords synced\n...Done\nRunning post removal scripts (/usr/local/cpanel/scripts/legacypostkillacct, /usr/local/cpanel/scripts/postkillacct)......Done\nAccount Removal Complete!!!...example account removed...Done\n"
      },
      "result":1,
      "command":"removeacct"
   }
}
 Output (XML)
<result>
    <metadata>
        <version>1</version>
        <reason>example account removed</reason>
        <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 2 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> 
        <command>removeacct</command> 
   </metadata> 
</result>


Note:

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

   

Parameters

ParameterTypeDescriptionPossible valuesExample

user

or

username

string

Required

The account's username.

The username of a cPanel account on the server.

username
keepdnsBoolean

Whether to retain the account's DNS entries.

This parameter defaults to 0.

  • 1 — Retain DNS entries.
  • 0 — Delete DNS entries.
0

 

Returns

This function only returns metadata.