How to restrict an API token (IP addresses, expiry, read-only)
An API token works like a password for scripts and billing systems. Limit each token to what it needs, so a leaked token can do little harm.
Steps
- Open the token page:
- Administrator or reseller: admin panel (
https://<server>:2087) → API Tokens (section Account). - Customer: control panel (
https://<server>:2083) → API tokens (section Advanced).
- Administrator or reseller: admin panel (
- Name — what the token is for, for example
billingordeploy script(letters, digits, spaces,.,_,-; up to 64 characters). - Allowed IP addresses (optional) — the addresses or ranges it may be used from, for example
203.0.113.10, 198.51.100.0/24. Leave empty to allow any address. Up to 50 entries; IPv6 works too. - Expires — Never, or After 7 days, After 30 days, After 90 days or After 365 days.
- Tick Read only (cannot change anything) if the token only needs to look things up.
- Click Create token.
- Copy the token from the green box at once. It is shown only once.
The Limits column of Your tokens shows each token's restrictions, or "no limits".
What a refused request says
| Situation | Answer |
|---|---|
| Used from an address not in the list | "This API token may not be used from this address." |
| After its expiry date | "This API token has expired." |
| A read-only token tries to change something | "This API token can only read." |
Good to know
- Restrictions cannot be changed later. Create a new token with the right limits and Revoke the old one.
- Last used shows when each token was last used. Revoke tokens you no longer use.
- Wrong tokens count as failed logins and can get the sender's address blocked. Add a billing server's address with Always allow in Firewall and to the Whitelisted IPs of Brute Force Protection.
- Administrator and reseller tokens also obey the admin panel's IP access list, if one is set.
- A token stops working when its owner loses API access, for example when the account is suspended or its plan no longer includes API tokens.
- Team members cannot create API tokens; only the account owner can.
Common questions
What does a read-only token allow?
Only reading: GET requests on /api/v1. On /json-api only version, applist, listaccts, accountsummary, listpkgs, showbw and gethostname.
I lost a token. Can I see it again?
No. Only a fingerprint of it is stored. Create a new token and revoke the old one.
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 the admin panel to your IP addresses
Allow only your own IP addresses or ranges to open the admin panel on port 2087, and how to get back in with one command if you lock yourself out.
- How to set up brute force protection for panel logins
Block IP addresses after repeated failed logins to the admin panel, control panel and API: set max failures, the time window, block time and whitelisted IPs.
- How to block or allow an IP address in the firewall
Block an attacker's IP address or range on the whole server, or always allow a trusted address such as a billing server, permanently or for a set time.
- Two-factor authentication for team members
How team members protect their own control panel login with two-factor authentication, and how the account owner turns it off when a member loses a phone.