create api-key

Learn how to create an API key.

This command creates an API key for your application. You can specify the name, permissions, and environment for the key.

Usage

This command has the following syntax:

croct create api-key <options>

Example

Create an API key interactively:

npx croct@latest create api-key

Create a named API key for the production environment with specific permissions and copy it to the clipboard:

npx croct@latest create api-key --name "My API Key" --env prod --permissions resource_read_access,token_issue --copy

Options

Besides the global options, this command accepts the following options:

--name(optional)
string

The name of the API key.

--permissions(optional)
string

A comma-separated list of permissions to grant to the API key.

PermissionDescription
resource_read_accessAllows reading resources such as content and slots.
token_issueAllows issuing authentication tokens.
data_exportAllows exporting analytics and event data.
--env(optional)
string

The environment of the API key.

The accepted values are prod and dev.

--copy, -c(optional)
boolean

Copy the API key to the clipboard.