The edge apikey command

Current version: 10.4

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:

RequestResponse
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:

RequestResponse
dotnet sitecore edge apikey

You can use the following options with the edge apikey command:

Option

Description

--token

The Experience Edge API key value.

--hash

The Experience Edge API key hash.

Returns information about the API keys in JSON format.

--pageSize

The number of API keys to return in one chunk/page.

Default: 20

--pageNumber

The page number to return when the result includes more than one page.

Default: 1

--all, --showAll

If provided, the list of keys includes revoked keys. Revoked API keys are marked with a [REVOKED] indicator.

--env, --environment

Specifies the Experience Edge environment to target.

Possible values: preprod, prod

Default: prod

-?, -h, --help

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:

RequestResponse
dotnet sitecore edge apikey --pageSize 5 --pageNumber 2 --all

To get detailed information about an API key, run the following command:

RequestResponse
dotnet sitecore edge apikey --hash <your-api-key-hash>

The command displays JSON-formatted information about the API key:

RequestResponse
{
  "Hash": "XXXXX",
  "IsRevoked": <false|true>,
  "Label": "<apikey-label>",
  "Scopes": [
    "audience-preview",
    "content-#everything#"
  ],
  "CreatedBy": "<user>",
  "Created": "<created-date>"
}
Note

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:

RequestResponse
dotnet sitecore edge apikey create -l Main

The command prints the newly created API key.

Important

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

-l, --label

Required.

The Experience Edge API key label.

-s, --scopes

The scopes of the Experience Edge API key.

Default: audience-delivery content-#everything#

-by, --createdBy

The user to assign as the creator of the API keys.

Default: currently logged-in user.

--env, --environment

Specifies the Experience Edge environment to target.

Possible values: preprod, prod

Default: prod

-?, -h, --help

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:

RequestResponse
dotnet sitecore edge apikey revoke --hash <your-api-key-hash>

You can use the following options with the revoke subcommand:

Option

Description

--token

The Experience Edge API key value.

--hash

The Experience Edge API key hash.

--env, --environment

Specifies the Experience Edge environment to target.

Possible values: preprod, prod

Default: prod

-?, -h, --help

Displays developer help and usage information about the command.

Do you have some feedback for us?

If you have suggestions for improving this article,