# Add a server to WHMCS
Source: https://docs.webgee.com/en/reseller/how-to-add-a-server-or-reseller-account-into-your-whmcs



Connect WHMCS to your hosting server so it can create, suspend and terminate
cPanel accounts automatically when customers order. Applies to reseller accounts
and to VPS or dedicated servers with WHM.

Use an **API token**, not your WHM password. A token can be revoked on its own
and restricted to specific IP addresses, and it does not change when you rotate
your password.

## 1. Generate an API token in WHM [#1-generate-an-api-token-in-whm]

1. Sign in to **WHM**.
2. Go to **Development → Manage API Tokens**.
3. Select **Generate Token**.
4. Name it something identifiable — `whmcs` — and select the privileges it
   needs.
5. Copy the token.

<Callout type="warn">
  The token is shown **once**. If you navigate away without copying it, you must
  generate a new one.
</Callout>

Restrict the token to your WHMCS server's IP address while you are here — see
[Restrict WHM API tokens by IP](/en/reseller/enhancing-security-with-whm-api-token-ip-address-restrictions).
A token that works from anywhere is a standing key to your whole server.

## 2. Add the server in WHMCS [#2-add-the-server-in-whmcs]

1. In the WHMCS admin area, go to **Setup → Products/Services → Servers**.

2. Select **Add New Server**.

3. Fill in:

   | Field                   | Value                                                                 |
   | ----------------------- | --------------------------------------------------------------------- |
   | Name                    | Anything identifiable, e.g. `webgee-uk-1`                             |
   | Hostname                | The server's hostname                                                 |
   | IP Address              | The server's main IP                                                  |
   | Assigned IP Addresses   | The IPs available to accounts on it                                   |
   | Type                    | **cPanel**                                                            |
   | Username                | Your WHM username — `root` on a VPS, your reseller username otherwise |
   | Access Hash / API Token | The token from step 1                                                 |

4. Leave **Password** empty. It is not used when a token is supplied.

5. Tick **Secure** to connect over SSL, and set the port to `2087`.

## 3. Test the connection [#3-test-the-connection]

Select **Test Connection** before saving. WHMCS reports success or the exact
error.

Save only once the test passes — saving a server that cannot connect means
orders fail at provisioning time, after the customer has paid.

## If the test fails [#if-the-test-fails]

* **`Invalid username or token`** — the username must match the account the
  token was generated under. A token made under `root` does not work with a
  reseller username.
* **Connection refused or timeout** — port `2087` is blocked between your WHMCS
  server and the hosting server, or the token is IP-restricted to a different
  address.
* **`Access denied`** — the token lacks a required privilege. Regenerate it with
  account creation and management permissions.

## Related [#related]

* [Restrict WHM API tokens by IP](/en/reseller/enhancing-security-with-whm-api-token-ip-address-restrictions)
* [Install WHMCS with Softaculous](/en/reseller/softaculous-how-do-i-install-whmcs)
* [Create a reseller account in WHM](/en/reseller/how-to-create-a-reseller-whm)
