How to create an API token for scripts and billing
An API token lets a script or a billing system act for you without your password. The token is shown only once; the server keeps only a fingerprint of it.
Which token do I need?
| You are | Create it in | It works for |
|---|---|---|
| Administrator | Admin panel → API Tokens (section Account) | Every account and package, REST API v1, /json-api, WHMCS |
| Reseller | Admin panel → API Tokens (needs the API tokens (billing systems) privilege) | The reseller's own accounts and packages |
| Hosting customer | Control panel → API tokens (section Advanced) | Only the customer API of that account |
Steps
- Open API Tokens in the admin panel, or API tokens in the control panel.
- Name — what the token is for, for example
billingordeploy script. 1–64 characters: letters, digits, spaces,_,.and-. - Optional limits (see restrict an API token):
- Allowed IP addresses — the token works only from these addresses or ranges.
- Expires — Never, or after 7, 30, 90 or 365 days.
- Read only (cannot change anything).
- Click Create token.
- The page shows New token: with the token and a Copy button. Copy it now and store it safely. It will not be shown again.
The token is a string of 40 letters and digits, for example 9F2C…. Send it as Authorization: Bearer <token>.
See and revoke tokens
Your tokens lists each token with its Limits, when it was Created and when it was Last used (never if not yet). Click Revoke to stop a token at once.
Good to know
- A lost token cannot be shown again. Revoke it and create a new one.
- Only the account owner can create customer tokens; team members do not see API tokens.
- A token stops working when its owner loses API access: a reseller without the API tokens (billing systems) privilege, a customer whose plan leaves out API tokens, or a suspended account.
- Use one token per system, so you can revoke one without breaking the others.
Common questions
Where do I put the token in WHMCS?
In the server's Access Hash field. See connect WHMCS.
Does the token expire when I change my password?
No. Tokens are independent of the password. Revoke them yourself when needed.
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
- How to restrict an API token (IP addresses, expiry, read only)
Limit an API token to your billing server's IP addresses, let it expire after 7 to 365 days, or make it read only, and the errors you get when a limit applies.
- REST API overview: authentication, requests and responses
How the REST API v1 works: base URL, Bearer token authentication, JSON or form bodies, the response envelope, HTTP status codes and every endpoint.
- How to connect WHMCS to the control panel (provisioning module)
Install the WHMCS module, add the server with an API token and pick packages, so WHMCS creates, suspends, upgrades and terminates accounts.
- Customer API: automate mailboxes, databases, DNS and cron
Use your hosting account's own API token to manage mailboxes, forwarders, MySQL databases, DNS records and cron jobs from scripts, with curl examples.