The short answer: your system asks the API for a cPanel login link for a hosting account in your account, with POST /v1/services/{id}/cpanel-login. The link opens cPanel without asking for a password, works only once and gives full access to the panel. It is for cPanel only: on a Plesk hosting account the API does not create it. There is more about hosting in the program on the hosting for resellers page.
What you need
A key with hosting:login. It is a sensitive permission, kept apart from the others and off by default, because whoever has the link can do everything the account owner can. Turn it on only for the key you will really use for this. See the permissions that come switched off.
How it works
| 1 |
Have the service number. It is the hosting account's id in GET /v1/services.
|
|
| 2 |
Ask for the link with POST /v1/services/{id}/cpanel-login. The answer is 201, with url and single_use set to true.
|
|
| 3 |
Open it straight away. The link works only once. Do not keep it in logs or send it by email.
|
|
| 4 |
To log in again, ask for another. Each request creates a new link.
|
|
curl https://api.mozout.com/v1/services/1470/cpanel-login -X POST \
-H "Authorization: Bearer $MOZOUT_API_KEY"
1470 is the hosting account's id. The answer:
{"data": {"url": "https://...", "single_use": true, "simulated": false}, "meta": {}}
| Rule |
What it means |
| Once only |
After it has been used, the link will not open the panel again. |
| Idempotency-Key has no effect |
The API does not keep the link, so repeating the request creates another one. |
| 5 per minute |
That is the panel login limit, per hosting account, on top of the general limit. |
| Sandbox |
With a sandbox_ key the API only checks the request and creates no link. |
When the API does not create the link
| Answer |
When |
| 403 insufficient_scope |
The key does not have hosting:login. |
| 404 |
The service is not in your account. |
| 409 with server_not_supported |
The server cannot manage hosting through the API yet. This is the case for a Plesk hosting account. |
| 409 with service_not_active, service_not_ready or not_hosting |
The service is not active, is not ready yet or is not a hosting account. |
|
On Plesk, there is no link through the API. The documentation says the link is for cPanel, and hosting operations only run on supported servers, which today are the cPanel ones. On a Plesk account, the access details are in My MozOut, on the service. To change the Plesk password, see how to change your Plesk password.
|
What about the accounts inside Reseller Hosting?
The accounts you create inside a reseller plan are not services of your account, so they have no number for this request. You get into them through the reseller plan's WHM or Plesk. See first steps as a reseller.
|
Want to open your clients' cPanel from your own system? See on the page what the API does on each account.
See hosting for resellers
|
|
SEE ALSO
The API key permissions that come switched off, and why: cPanel login, cron and FTP, purchases
Sensitive API permissions and the spending limit: paying, buying, reinstalling, cPanel access
Hosting through the API: subdomains, databases, cron jobs, SSL, PHP options and FTP
Giving a developer access to your site without handing over your password
Account area, cPanel or webmail: which login do you need?
Hosting in the Reseller Program
|
RECOMMENDED PRODUCT Web hosting with cPanel Domain and SSL included, daily backups and the panel you already know. from £5.28/mo (3-year plan, with coupon) See plans |