To authenticate API requests, you can use secret keys instead of credentials. This topic describes how to create and manage secret keys using the secret_key CLI utility.

You can also create and manage secret keys via Plesk XML API.

Note: For security reasons, Plesk does not store secret keys. It stores only their hashes.

Usage

secret_key <command> [
<option_1> [<param>]
[<option_2> [<param>]]
]

Example

The following command creates a secret key assigned to the IP address 192.0.2.1:

plesk bin secret_key -c -ip-address 192.0.2.1

Note: Once you have created a secret key, copy it and keep it safe. For security reasons, secret keys are shown only when they are created. The secret_key CLI utility will not show them after that.

Commands

Command Parameter Description Example
--create or -c  

Creates a secret key assigning it to the specified IP address (if any) or to the IP address of the request sender.

Can be used with the -ip-address and -description options. If you do not specify -ip-address, Plesk will assign the secret key to the IP address of the request sender.

Note:

Once you have created a secret key, copy it and keep it safe. For security reasons, secret keys are shown only when they are created. The secret_key CLI utility will not show them after that.

To create a secret key assigned to the IP address 192.0.2.1 with the description “test key”:

plesk bin secret_key --create -ip-address 192.0.2.1 -description "test key"

--list or -l  

Shows the information about all secret keys located on the server: key IDs, IP addresses the keys are assigned to, and key descriptions (if any).

Note:

For security reasons, the command does not show secret keys themselves.

To show the information about all secret keys located on the server:

plesk bin secret_key --list

--delete or -d -key <secret_key_value | secret_key_ID>

Deletes the specified secret key.

Used with the -key option.

To delete the key 53de495a-b405-ca64-35d3-54b0352edeec:

plesk bin secret_key --delete -key 53de495a-b405-ca64-35d3-54b0352edeec

To delete the key with the ID 3:

plesk bin secret_key --delete -key 3

--help or -h   Displays the help on the utility usage.

To see the help on the utility usage:

plesk bin secret_key --help

or

plesk bin secret_key -h

Options

Option Parameter Description Example
-ip-address <IP_address>

The IP address a secret key is assigned to. Used with the --create command.

Plesk XML API will deny requests that use the secret key but were sent from other IP addresses.

To create a secret key assigned to the IP address 192.0.2.1 with the description “test key”:

plesk bin secret_key -create -ip-address 192.0.2.1 -description "test key"

-description <string> The secret key description. Used with the --create command.

To create a secret key assigned to the IP address 192.0.2.1 with the description “test key”:

plesk bin secret_key -create -ip-address 192.0.2.1 -description "test key"

-key <string> The secret key value or ID. Used with the --delete command.

To delete the key 53de495a-b405-ca64-35d3-54b0352edeec:

plesk bin secret_key --delete -key 53de495a-b405-ca64-35d3-54b0352edeec

To delete the key with the ID 3:

plesk bin secret_key --delete -key 3