cPanel API tokens: access for scripts
An API token lets a script or an external service work with cPanel without your password: create mailboxes, read statistics, make backups.
- Open "Manage API Tokens" (group "Security").
- Enter a token name (letters, digits, dashes).
- Set an expiry date - better to limit it.
- Click "Create" and copy the token right away: it is shown only once.

Example request - list of mailboxes:
curl -H 'Authorization: cpanel USERNAME:TOKEN' 'https://PANEL_ADDRESS/execute/Email/list_pops'USERNAME is your cPanel username, PANEL_ADDRESS is the cPanel address from the welcome email.
A token has the same rights as your password. Keep it like a password and delete it when the script is no longer used.