How to create an API token for billing and automation
An API token lets another system — your billing system, a script or another server — create, suspend and manage accounts without your password. Each token can be limited and revoked at any time.
Steps
- Log in to the administrator panel (
https://<server>:2087). - Open API Tokens in the menu (section Account).
- Name — a name you recognise, for example
billing. - Allowed IP addresses (optional) — the addresses or ranges the token may be used from, for example
203.0.113.10, 198.51.100.0/24. Empty means from anywhere. Up to 50 entries. - Expires — Never, or after 7, 30, 90 or 365 days.
- Tick Read only (cannot change anything) for tokens that only read data, for example monitoring.
- Click Create token.
- Copy the token shown in the green box (Copy). It is not shown again.
The token appears under Your tokens with its limits, when it was created and when it was Last used.
Use the token
Send it in the Authorization header:
curl -H "Authorization: Bearer TOKEN" https://server1.example.com:2087/api/v1/accounts
The Usage card on the page lists the main calls, for example POST /api/v1/accounts, POST /api/v1/accounts/{username}/suspend and GET /api/v1/server/status.
Connect a billing system
- WHMCS: click Download the WHMCS module and unpack it into your WHMCS folder (it creates
modules/servers/hostpanel). In WHMCS, add a server with the module "Hosting Panel", the hostname of this server, port 2087 with SSL, and the token in "Access Hash". - Other billing systems (for example Blesta or HostBill): the server also answers the standard
/json-apiinterface on port 2087. Use the billing system's usual module for hosting control panels, with your admin username and the token.
In both cases, add the billing server's IP address to the Firewall allow list: wrong tokens get an address blocked.
Revoke a token
Click Revoke next to it and confirm. It stops working at once.
Common questions
I lost the token. Can I see it again?
No. Tokens are stored only as a hash. Create a new token and revoke the old one.
What can a reseller's token do?
Resellers create their own tokens on the same page; a reseller's token reaches only that reseller's accounts and packages.
Thank you — this helps us improve the article.
Still stuck?
Ask the AI about your exact situation — it answers from this knowledge base — or contact us.
Related articles
- Webhooks explained: notify other systems of server events
Send a signed JSON message to your billing, monitoring or chat system when accounts, domains, mailboxes, limits, tasks or tickets change.
- How to manage several servers and set up a DNS cluster
Add your other servers running this control panel, see their load and accounts, sign in to customer panels there, and share DNS zones between them.
- The sahaab command line: every command explained
Commands of the sahaab tool on the server: reset a password, turn off two-factor sign-in, unlock the admin panel by IP, run tasks, nameservers and more.