Skip to main content

How to get a cPanel API token

Dennis Postma18 October 2026
Reading time3 minutes
Guides

Create a WHM or cPanel API token for DNS, pick the right one for your account and connect it to DNSense.

DNSense guide cover: a cPanel API token shown once

cPanel & WHM has two APIs and two kinds of token. Which one you need depends on whose zones you want to manage.

Which token do you need?

  • WHM API token: for a server administrator (root) or a reseller. It reaches every DNS zone that account owns. WHM listens on port 2087.
  • cPanel API token: for one hosting account. It reaches the zones of that account: the main domain plus its addon and parked domains. cPanel listens on port 2083.

Both are sent in an Authorization header and neither needs your password. You can revoke a token at any time without changing the password.

Option 1: a WHM token

  1. Log in to WHM as root or as the reseller.
  2. Open Development > Manage API Tokens and click Generate Token.
  3. Give it a name, such as dnsense. A reseller can limit the token to the privileges it needs for DNS. Optionally set an expiry date.
  4. Click Save and copy the token. WHM shows it once, so copy it before you leave the page.

Option 2: a cPanel token

  1. Log in to cPanel.
  2. Open Security > Manage API Tokens and click Create.
  3. Give it a name, such as dnsense, and optionally an expiry date.
  4. Click Create and copy the token. It is shown once.

Connect it to DNSense

Add a connection, choose cPanel, pick the matching token type and fill in:

  • Hostname of your server. Name another port in the host or in the port field if yours is not the default.
  • Username: the root, reseller or hosting account the token belongs to.
  • API token, the token you just made.

DNSense imports the zones the account can reach, and edits records through the same API cPanel's own zone editor uses.

Limits

DNSense manages A, AAAA, CNAME, MX, TXT, SRV and CAA records on cPanel. Other records in the zone, such as NS, are left untouched.

If it does not connect

Test the token first. For a WHM token:

curl -H "Authorization: whm <username>:<token>" "https://<host>:2087/json-api/listzones?api.version=1"

For a cPanel token:

curl -H "Authorization: cpanel <username>:<token>" "https://<host>:2083/execute/DomainInfo/list_domains"

A JSON answer means the token works from where you are. Check that the server's firewall lets DNSense reach port 2087 or 2083, and that the DNS role is enabled on the server: WHM turns listzones off without it.