cPanel/Tokens
cPanel module

Tokens

4 functions, invoked through the cpanel_uapi tool.

scope cpanel:uapi
Call any function with cpanel_uapi(service_id, module="Tokens", function, params). Live availability depends on the cPanel features JetHost has enabled on your account — call list_cpanel_operations to see what is active.

create_full_access GET#

Create cPanel API token

This function creates a new API token with full access to all of a cPanel account's features.

Note:

The token only grants access to the features that the account has access to. For example, if you disable the File Manager feature, the token can't access it.

namestringRequired
The API token's name. Note: The name may only contain alphanumeric characters, dashes (-), and underscores (_).
expires_atintegerOptional
The API token's expiration time. Important: When an API token expires the system does not delete it. You must manually delete expired API tokens. If you do not use this parameter, the API token will not expire.

Response — normalized as { ok, data, errors[], warnings[] }; data contains:

create_timeinteger
The API token's creation date and time.
tokenstring
The generated API token.

list GET#

Return cPanel API tokens

This function returns a list of a cPanel account's API tokens.

No parameters.

Response — normalized as { ok, data, errors[], warnings[] }; data is an array of:

create_timeinteger
The API token's creation date and time.
expires_atinteger
The API token's expiration time. * null — The API token does not expire.
featuresarray<string>
The account features that the API token has access to. * An empty array — The API token has full access.
has_full_accessinteger
Whether the API token has full access to the account's features. 1 — The API token has full access to the account's features. 0 — The API token does not have full access to the account's features.
One of: 1 0
namestring
The API token's name.

rename GET#

Update cPanel API token's name

This function renames a cPanel account's existing API token.

namestringRequired
The API token's name.
new_namestringRequired
The new name for the API token. Note: The name may only contain alphanumeric characters, dashes (-), and underscores (_).

Response — normalized as { ok, data, errors[], warnings[] }; data contains:

Payload varies by call.

revoke GET#

Remove cPanel API token

This function removes an API token from a cPanel account.

namestringRequired
The API token to remove.

Response — normalized as { ok, data, errors[], warnings[] }; data contains:

Whether the system removed the API token. 1 - The system removed the API token or the API token doesn't exist. 0 - The system did not remove the API token. Note: The system returns the data value in the function's metadata. This differs from our usual API return format. For more information, read our [UAPI Introduction](/cpanel/introduction/) documentation.