Overview
To connect WHMCS to cPanel, create an API token in your reseller WHM, add your server in WHMCS under System Settings > Servers using the cPanel module and that token, then link each WHMCS product to a WHM package. From then on a paid order creates the cPanel account by itself, and overdue invoices suspend it. Expect about 30 minutes for the first product.
This guide is for reseller hosting customers who already have WHMCS installed and want it to provision accounts on their reseller plan. It covers the details that trip resellers up in particular: package names that carry your username as a prefix, the server hostname to use, and a WHMCS IP that gets blocked after a few failed tests. If you’re still setting up the business, how to start a reseller hosting business covers the order of things.
Prerequisites
- WHMCS installed on your own hosting with its cron job running every 5 minutes (
php -q /path/to/whmcs/crons/cron.php). Without the cron, automatic suspensions and many emails never happen. - Your reseller WHM login and the server hostname from your welcome email.
- At least one hosting package created in WHM. Managing clients in WHM shows how.
- Private nameservers set up if you sell under your own brand (see how reseller hosting works).
Step-by-Step: Connect WHMCS to cPanel
Step 1: Create an API token in WHM
- Log in to WHM with your reseller username.
- Go to Development > Manage API Tokens and click Generate Token.
- Name it
whmcs. Leave the privileges set to everything your reseller account allows; WHMCS needs to list packages and create, suspend, unsuspend, terminate and change packages on accounts. - Leave the expiry empty, click Save, and copy the token straight away. WHM shows it only once.
Use a token rather than your password. You can revoke a token without changing your login, and a WHM password change doesn’t break WHMCS.
Step 2: Add the server in WHMCS
- In the WHMCS admin area, click the wrench icon, open System Settings > Servers and click Add New Server.
- Set Module to cPanel.
- Hostname or IP Address: the server hostname from your welcome email, not your own domain. WHMCS connects to WHM on port 2087 over SSL, and the server’s certificate matches its hostname.
- Username: your reseller username. API Token: the token from Step 1. Leave Password empty.
- Click Test Connection. On success, WHMCS opens the full server form.
- Give it a name, enter your private nameservers in the nameserver fields, set Maximum No. of Accounts to your plan’s account limit, make sure Secure (SSL) is ticked, and save.
Step 3: Create a server group
On the same page click Create New Group, name it (for example cPanel Reseller), add your server to it and save. Products point at a group rather than a single server, which makes it painless to add a second server later.
Step 4: Link a product to a WHM package
- Go to System Settings > Products/Services and create a new product with the type Shared Hosting.
- Open the Module Settings tab. Set Module Name to cPanel and choose your server group.
- Pick the WHM Package Name from the list. WHMCS loads it from WHM through the API, so an empty list means the connection or token is wrong.
- Leave Reseller Account unticked; that option creates reseller sub-accounts, not normal cPanel accounts.
- Choose Automatically setup the product as soon as the first payment is received and save.
Note: packages you create as a reseller are named with your username in front, for example myreseller_Basic. If you type a package name by hand instead of picking it from the list, include the prefix or account creation fails.
Step 5: Test the whole flow
- Create a test client in WHMCS and place an order for the product with a test domain.
- Mark the invoice as paid.
- Check System Logs > Module Log in WHMCS (turn on module logging first) to see the exact API call and WHM’s reply.
- In WHM, open List Accounts and confirm the account exists with the right package. Then use the Suspend and Unsuspend buttons on the WHMCS service to confirm those work too, and terminate the test account.
Step 6: Import clients you already host
If you created accounts in WHM before installing WHMCS, use WHMCS’s server sync tool (open it from the server list) to import them and match each account to a client and product. Check the billing dates on imported services before the next invoice run.
Common Issues & Troubleshooting
Test Connection fails: “cURL Error: Failed to connect … port 2087”
Cause: the server’s firewall or cPHulk blocked your WHMCS server’s IP, often after a few failed tests with a wrong token, or your own WHMCS host blocks outgoing connections on port 2087.
Fix: ask your reseller host to check the firewall and cPHulk for your WHMCS server’s IP and allow it, and check with your WHMCS host that outbound port 2087 is open.
Test Connection fails with “Access denied” or “Invalid API token”
Cause: the token was copied with a stray space, was revoked, or doesn’t have enough privileges, or the username doesn’t match the account the token belongs to.
Fix: generate a new token under the same reseller username with all reseller privileges and paste it again.
Account creation fails: package does not exist
Cause: the WHM package name in the product doesn’t match exactly, usually because the reseller prefix is missing or the package was renamed in WHM.
Fix: reopen the product’s Module Settings and pick the package from the list again rather than typing it.
Overdue accounts are never suspended
Cause: the WHMCS cron job isn’t running, or automatic suspension is turned off.
Fix: check the last cron run on the WHMCS System Health page, fix the cron entry, and confirm Enable Suspension is on under System Settings > Automation Settings.
Once your client list outgrows a reseller plan, a Host & Tech VPS with its own WHM connects to WHMCS the same way, using a root-level API token. Questions about your reseller plan’s limits go to our help centre.
Frequently Asked Questions
Can a cPanel reseller account connect to WHMCS?
Yes. WHMCS connects to WHM with your reseller username and an API token, and can then create, suspend, unsuspend, terminate and upgrade the accounts you own. It can’t see or manage accounts that belong to other resellers on the server.
Should I use my WHM password or an API token in WHMCS?
Use an API token. It can be revoked on its own without changing your login, and changing your WHM password won’t break the connection. Store the token only in WHMCS.
Why is the WHM Package Name list empty in WHMCS?
WHMCS couldn’t read your packages from WHM. Test the server connection again, check the product is using the right server group, and make sure the token has permission to list packages. Reseller package names include your username as a prefix.
Does WHMCS create the cPanel account before the invoice is paid?
Only if you choose that. The usual setting is to set up the product as soon as the first payment is received. You can also choose to set it up when the order is placed, or when you accept the order manually.
Do I need WHMCS to run a reseller hosting business?
No, you can create accounts by hand in WHM and invoice separately. WHMCS saves time once you have more than a handful of clients, because it handles invoices, reminders, suspensions and account creation in one place.