Introduction
The following guide explains the methods that can be used to generate an API token that is specific to an individual cPanel user.
The resulting token will be limited to the same access as the cPanel account that it was created for.
It is also possible to generate a token with customized permissions. If you’re looking for that functionality instead, links for that process are included in the “Additional Resources” section at the end of this article.
Via the cPanel UI
1. Login to cPanel as the desired cPanel user
2. Click on the “Manage API Tokens” icon
3. Enter a name for the API token. The name is arbitrary and is only to help you remember what the API token is being used for.
4. Select an expiration, or leave it without an expiration
5. Click the blue Create button
6. Copy your token to a safe place
Via SSH or Terminal
NOTE: This method does not currently work due to the following defect. You may use the “follow” button at the link below to get updates when the issue is resolved:
UAPI – Tokens::create_full_access requires root access
1. Login to SSH as the cPanel user or access the Terminal icon from cPanel
2. Issue the following command and be sure to update the username and token name to your own values:
uapi --user=austtynw Tokens create_full_access name='exampleToken'
If you want to set an expiration date you can do so by specifying a future date in Epoch time:
twentyFourHoursFromNow=$(date +%s -d "$(date) + 24 Hours")
uapi --user=austtynw Tokens create_full_access name='exampleToken' expires_at=$twentyFourHoursFromNow
3. Copy the resulting token to a safe place