Every request to the my.host API needs one credential: a personal access token. Create one in the control panel under My account → API access. API keys are deprecated: new ones can no longer be created, and existing keys keep working.| Credential | Header | Can do |
|---|
| Personal access token | Authorization: Bearer mh_pat_… | Only the permissions chosen for the token, and never more than the user who created it. Expires after the period you choose (7 days to a year), or has no expiry date. Optionally limited to IP addresses or subnets. |
| API key (deprecated) | API-Key: <key> | Everything the user who created it may do. Optionally limited to IP addresses. |
A token without an expiry date suits integrations that run unattended, such as WHMCS or automatic certificate renewal. Such a token is revoked after 12 months without use; the user who created it gets an e-mail 30 days before. Using the token again keeps it.To replace an API key, create a token and put it where the key was: a token also works in the API-Key header.Send one of the two, not both. Clients that can only send a bearer credential may also send an API key as Authorization: Bearer <key>. Clients that can only send an API-Key header, such as older versions of our WHMCS module, may send a token there: API-Key: mh_pat_….A credential belongs to the user who created it. When the main user of the account changes that user's permissions, the change applies at once to that user's API keys and tokens.API key (deprecated)#
Personal access token#
A token is shown once, when you create it: we only store a fingerprint (hash) of it. You can revoke a token at any time in the control panel; it stops working immediately.Token permissions (scopes)#
When you create a token you choose, per section, what it may do. In the API these are scopes of the form <section>:<level>, for example domains:read or vps:write. Every level includes read for the same section.| Level | In the control panel | Allows |
|---|
read | View | Viewing data. |
write | Change | Changes that cost nothing but take effect at once, such as DNS records, starting or restarting a VPS, firewall rules, replying to a ticket. |
purchase | Order | Anything that costs money: orders, renewals, upgrades, reserving a floating IP. |
critical | High impact | Actions you cannot undo and confidential data: deleting or cancelling, reinstalling, restoring a backup, changing the owner of a domain name, auth codes, root and rescue passwords, managing users. |
The sections are domains, domains-profiles, domains-nameservers, domains-dns-templates, vps, vps-ssh-keys, vps-floating-ips, hosting, hosting-email, hosting-wordpress, hosting-files, certificates, order, account-profile, account-paymethods, account-invoices, account-tickets, account-users and account-affiliate.hosting covers web hosting packages, their domains with DNS records, SSL, PHP, databases, FTP, cron jobs, SSH, Redis, Git repositories, Node.js and Python apps, backups and orders; hosting-email their mailboxes, forwarders and autoreplies and the mail settings of a domain; hosting-wordpress their WordPress sites; hosting-files the files and folders of the package. Each hosting endpoint names its scope in its description.The write level of hosting, hosting-files and hosting-wordpress can run code on the package: through cron jobs, FTP accounts, SSH access and keys, Git repositories and Node.js and Python apps, by placing a file in a website, or through a WordPress plugin or theme. Code on a package runs as its hosting account and reaches everything the account has. So a credential with one of these scopes can in effect read and change everything in that package, including its mail, whatever its other scopes and levels. Give write only to an integration you trust with the whole package.A credential with only read scopes cannot do this. The file endpoints do not open the folders that hold e-mail or the file with the account's password, so hosting-files:read gives no access to mail.Errors#
| Status | Meaning |
|---|
401 Unauthorized | No credential, an unknown or expired credential, a revoked token, or a key or token used from an IP address outside its whitelist. |
403 Forbidden | The credential is valid but may not call this endpoint: the user lacks the permission, or the token lacks the scope. |
With 401 and 403 the response has a WWW-Authenticate header as described in RFC 6750. For a missing scope it names the scope:Security best practices#
Keep credentials confidential. Treat API keys and tokens as passwords. Do not share them or put them in client-side code.
Give a token only what it needs. Choose the fewest sections and levels, and a short lifetime. Only give High impact when the integration really needs it.
Revoke what you no longer use. Revoke a token or deactivate an API key in the control panel as soon as you suspect it has leaked.
Modified at 2026-12-03 10:33:05