Manage API keys using the CLI

To use the Preview or Delivery API, you require a valid API key. These API keys can be created, renamed, or revoked using the CLI.

Create an API key

Note

You will only see the API key once after the command completes, so store it in a safe location for later use.

RequestResponse
# Create an API key for the Delivery API
ch-one-cli delivery keys add --name "<API key name>" --type delivery

# Create an API key for the Preview API
ch-one-cli delivery keys add --name "<API key name>" --type preview

List available API keys

Listing the API keys is a convenient way to get an overview of all API keys presently available in the connected tenant, including the hash values required to rename or revoke API keys.

RequestResponse
# List all API keys
ch-one-cli delivery keys list

# List all API keys (as JSON)
ch-one-cli delivery keys list --output Json

Rename an existing API key

Renaming an API key requires the hash, which can be obtained from the list command.

RequestResponse
# Rename an API key
ch-one-cli delivery keys rename --hash "<API key hash>" --name "<New API key name>"

Revoke an existing API key

Revoking an API key requires the hash, which can be obtained from the list command.

RequestResponse
# Revoke an API key
ch-one-cli delivery keys revoke --hash "<API key hash>"

Do you have some feedback for us?

If you have suggestions for improving this article,