unkey auth login command stores your root key in a local config file so you don’t have to pass --root-key on every CLI invocation.
Prerequisites
- An Unkey account with a root key
- The Unkey CLI installed (see installation)
Installation
Install the CLI with npm:Log in
Run theauth login command and paste your root key when prompted:
How it works
Your root key is saved to~/.unkey/config.toml. Once stored, other CLI commands (like unkey deploy) use it automatically instead of requiring a --root-key flag.
~/.unkey/config.toml
Best practices
- Use a dedicated root key for the CLI — create a separate key with only the permissions your CLI workflows need. See root key permissions for guidance.
- Don’t commit the config file — add
~/.unkey/to your global gitignore or verify it’s excluded from your project repositories. - Rotate periodically — run
unkey auth loginagain with a new key to replace the stored one.
Next steps
Root keys
Learn how to create and manage root keys
Quickstart
Get started with Unkey API key management

