Using WHM, it’s easy to quickly deploy new cPanel accounts, but if you need to do it in bulk it can be tedious and error prone. Fortuantely the WHM API makes it easy to setup accounts in batches. The following script is a stripped down example of how to batch multiple cPanel accounts using cURL and the WHM API.

Browsing the API documentation reveals that essentially anything you can do in WHM, you can do via the API.

Some Notes

  • Since this script uses basic auth, make sure you’re connecting over https (you can also access the API over http via port 2086, but you should not if you’re using basic auth).
  • If you choose to hard code your root password into a script (like the above example) make sure to remove it when you’re done.