Create API tokens
An API token lets a script or tool manage your hosting account without your password. You can cancel it at any time. Developers use tokens to automate creating mailboxes, databases, or subdomains.
Important: A token has full access to your hosting account. Treat it like a password.
Create a token
- Open Account → Hosting → your site → Security.
- Under API tokens, click New token.
- Give it a name, such as
deploy-script. Use letters, numbers, dashes, and underscores. - Choose an expiry: In 30 days, In 90 days, In a year, or Never. Pick a short one if you can.
- Click Create token.
- Copy the token now. It isn't shown again.
Use it
Give the token and your hosting username to the tool or script. On Business and Pro, the username is the part before the @ in the Connect with command under Account → Hosting → your site → Developer → SSH access. On Essential, ask us for it.
Scripts call the API at your own domain on port 2083, with the username and token in an Authorization header. The word cpanel in the header is required by the API. For example, to list your mailboxes:
curl -H "Authorization: cpanel yourusername:YOUR_TOKEN" \
"https://example.ca:2083/execute/Email/list_pops"
Your domain must point at Barbrick and have its SSL certificate. If a tool asks for something you can't find, open a request at https://barbrick.ca/submitticket.php.
Keep it safe
- Store it in an environment variable. See Set environment variables for apps.
- Never commit it to Git.
- Create a separate token for each tool.
- Create one only if a tool asks for it.
Revoke
Return to API tokens and click Revoke next to the token. Tools using it stop working at once.
If something goes wrong
| Problem | Fix |
|---|---|
| A tool says "Access denied" | Wrong user or token, or the token was revoked or expired |
| You lost the token | Revoke it and create a new one. We can't show it again |
| No API tokens section | Not enabled for your plan. Ask support |
Still stuck? Ask us and we'll walk you through it.
