The edge apikey command
The Experience Edge plugin for Sitecore CLI provides the edge apikey
command to help you manage API keys for Experience Edge.
Usage and options
You can use the edge apikey
command as follows:
dotnet sitecore edge apikey [subcommand] [options]
Using the command without any subcommands or options returns the list of active API keys for the currently selected tenant. For example:
dotnet sitecore edge apikey
You can use the following options with the edge apikey
command:
Option |
Description |
---|---|
|
The Experience Edge API key value. |
|
The Experience Edge API key hash. Returns information about the API keys in JSON format. |
|
The number of API keys to return in one chunk/page. Default: 20 |
|
The page number to return when the result includes more than one page. Default: 1 |
|
If provided, the list of keys includes revoked keys. Revoked API keys are marked with a |
|
Specifies the Experience Edge environment to target. Possible values: Default: |
|
Displays developer help and usage information about the command. |
For example, to show the second page of five API keys for the current tenant, including the revoked keys, run the following command:
dotnet sitecore edge apikey --pageSize 5 --pageNumber 2 --all
To get detailed information about an API key, run the following command:
dotnet sitecore edge apikey --hash <your-api-key-hash>
The command displays JSON-formatted information about the API key:
{
"Hash": "XXXXX",
"IsRevoked": <false|true>,
"Label": "<apikey-label>",
"Scopes": [
"audience-preview",
"content-#everything#"
],
"CreatedBy": "<user>",
"Created": "<created-date>"
}
Dates are displayed in local time.
Subcommands
You can use the following subcommands:
-
create
- creates a new Experience Edge API key. -
revoke
- revokes an Experience Edge API key.
The create subcommand
The create
subcommand creates a new Experience Edge API key based on the provided options. For example:
dotnet sitecore edge apikey create -l Main
The command prints the newly created API key.
Experience Edge does not store API keys in plain text. It is therefore vital that you copy the API key from the output and keep it safe.
You can use the following options with the create
subcommand:
Option |
Description |
---|---|
|
Required. The Experience Edge API key label. |
|
The scopes of the Experience Edge API key. Default: |
|
The user to assign as the creator of the API keys. Default: currently logged-in user. |
|
Specifies the Experience Edge environment to target. Possible values: Default: |
|
Display developer help and usage information about the command. |
The revoke subcommand
The revoke
subcommand deactivates an Experience Edge API key to prevent it from being used. For example:
dotnet sitecore edge apikey revoke --hash <your-api-key-hash>
You can use the following options with the revoke
subcommand:
Option |
Description |
---|---|
|
The Experience Edge API key value. |
|
The Experience Edge API key hash. |
|
Specifies the Experience Edge environment to target. Possible values: Default: |
|
Displays developer help and usage information about the command. |