With a few minor exceptions, the EnvKey CLI can do everything the UI can do.


If you install the EnvKey UI, the EnvKey CLI will be automatically installed the first time you start the UI. It will also be automatically updated to the latest version whenever the UI is updated.

To install the CLI independently without installing the UI, use this command:

LATEST_VERSION=$(curl https://envkey-releases.s3.amazonaws.com/latest/cli-version.txt) && curl -s https://envkey-releases.s3.amazonaws.com/cli/release_artifacts/$LATEST_VERSION/install.sh | bash

Verify and install:

You can verify the install script and CLI binaries before running them by installing minisign and running this:

LATEST_VERSION=$(curl https://envkey-releases.s3.amazonaws.com/latest/cli-version.txt) \
&& ARTIFACT_URL=https://envkey-releases.s3.amazonaws.com/cli/release_artifacts/$LATEST_VERSION/install.sh \
&& curl -O $ARTIFACT_URL -O $ARTIFACT_URL.minisig \
&& { minisign -Vm install.sh -P "RWQ5lgVbbidOxaoIEsqZjbI6hHdS5Ri/SrDk9rNFFgiQZ4COuk6Li2HK" || { rm install.sh && install.sh.minisig &&  echo "Error: install.sh signature invalid. Exiting with error." >&2; exit 1; }; } \
&& echo install.sh verified \
&& chmod +x install.sh \
&& ./install.sh \
&& rm install.sh install.sh.minisig


Alpine Linux

To install the CLI on Alpine Linux, you'll need to install the following dependencies first:

apk add gcompat libstdc++ libgcc

CLI Help

envkey -h
envkey command -h
envkey category -h
envkey category command -h

Interactive mode

By default, the EnvKey CLI runs in interactive mode. If you don't supply enough arguments or flags for a command, you'll be prompted. Output is in text form, optimized for readability.

So if you just type:

envkey invite

You'll then be prompted to input the user's email and name, then select their org role.

Auto mode

If you pass the --json, --json-pretty, or --cli-envkey flags, or if a CLI_ENVKEY environment variable is detected, the CLI will run in auto mode. In this mode, there will be no prompts for input, so if a required argument or flag is missing, the command will return an error message instead. Instead of returning text, the command's output will be returned as json. There will be no progress indicators or other output aside from the json result.

CLI Keys

If you want to use the CLI in auto-mode somewhere where you won't be signed in to a user account, like on a server, you'll need a CLI key for authentication. Like human users, these can be assigned an org role, and granted access to specific apps with an app role. A caveat is that CLI keys cannot be assigned the Org Owner org role.

App auto-detection

If you run the CLI in an EnvKey-enabled directory (one with a .envkey file or a .env file containing an ENVKEY), EnvKey will automatically detect the app, allowing you to omit the app argument from any commands that require it.

So instead of:

envkey set some-app staging SOME_VAR=val

You can do:

envkey set staging SOME_VAR=val

Default environment for envkey set

When using envkey set, Development will be the default environment if no environment is specified. So, assuming an EnvKey-enabled directory where the app can be auto-detected, if you do:

envkey set SOME_VAR=val

It will set SOME_VAR on the Development environment, assuming it exists and you have access (otherwise you'd be prompted to select a valid environment).

If you use envkey branch checkout to set a new default development branch, the branch you checked out will be the new default.

Shell tab-completion

When the CLI is auto-installed by the EnvKey UI, tab completion should also be added for each supported shell type (currently bash, zsh, and fish).

You can also install tab completion manually for your shell with this command:

$ envkey completion install

By default, it will attempt to auto-detect your shell type and your shell config file. To specify the type of shell or config file, use the --shell or --profile flag:

$ envkey completion install --shell zsh
$ envkey completion install --profile ~/.zshrc

To remove the autocompletion block from your shell profile, you can use envkey completion uninstall with the same options (--shell or --profile).