The API key permissions that come switched off, and why: cPanel login, cron and FTP, purchases

API & DocumentationKeys & Permissions·· 2 views· 4 min read

The short answer: an API key can touch your clients' websites and spend your credit. That is why the most powerful permissions come switched off on every new key, kept apart from the rest, and you turn them on by hand only on the key that needs them. For hosting there are three: hosting:login, hosting:code and billing:purchase. The hosting for resellers page shows them on a new key.

The three hosting ones, and what they do

Permission What it allows Why it comes switched off
hosting:login Creating a login link to an account's cPanel. The link gives full access to the panel. Whoever has it can do everything the account owner can.
hosting:code Creating cron jobs, creating FTP accounts and changing their passwords. It also shows the command of each cron job. A cron job or an FTP account can run code on the account, and a job's command may contain passwords.
billing:purchase Buying from credit: plans, domains, plan changes, credits and add-ons. It spends money. A leaked key with this permission spends your credit.

Without them, the key still does the everyday work: with hosting:read and hosting:write it reads usage, creates databases and subdomains, requests SSL and changes PHP options. Cron jobs are still listed, but without hosting:code the command comes back as null and command_hidden as true.

The others that also come switched off

Outside hosting, the same rule applies: billing:pay (paying invoices from credit), services:cancel (requesting a service cancellation), domains:transfer_code (requesting the transfer code), and the server ones, vps:reinstall, vps:restore and vps:password. The details are in sensitive API permissions and the spending limit.

If the key lacks the permission

The API answers 403 with the code insufficient_scope and does nothing. You do not need to delete the key: create another one with the permission you need.

How to use them safely

1 One key per job. One for everyday account work, with no sensitive permissions. Another just for purchases, with billing:purchase. And, only if you really need it, a third one for cPanel logins. If one leaks, the others keep working.
2 A spending limit on the purchases key: the most it can spend in 30 days, in your account currency. With the limit at 0, it cannot spend. GET /v1/limits shows the limit and what has been spent.
3 An IP list. The key only works from your server's addresses.
4 An expiry date. 30, 90 or 365 days. The default is 90.
5 Sandbox first. With a sandbox_ key, changes are simulated and nothing is charged. See Sandbox or Production.
What no key can do, whatever its permissions: create another key, change the account password or email, or see card details. And the API never returns hosting account passwords. Keys are created on the API page in Meu Interweb; see creating an API key.
If a key with these permissions leaks, revoke it straight away on the API page and create a new one. The right order is in a key has leaked.

Automating your clients' accounts? See on the page what each key can do.

See hosting for resellers

SEE ALSO

Sensitive API permissions and the spending limit: paying, buying, reinstalling, cPanel access

API permissions by area: read or write, and which permission each task needs

Creating an API key: name, mode, permissions, validity, IP list and spending limit

Getting into a client's cPanel without the password: the one-time login link from the API

An API key or token has leaked: what to do, in the right order

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.36/mo (3-year plan, with coupon)

See plans
Was this answer helpful? Your answer helps us improve this article.