CLI: login, logout and where the key lives

Three ways to authenticate, and which one wins.

The CLI accepts an ag_live_ key. Create one at Profile, API keys, then choose how to supply it.

Interactive

npx argorant login

It prompts for the key with the input masked, validates it against the account endpoint, and stores it. A rejected key fails immediately with a clear message rather than being saved and failing later. You can also pass the key inline: argorant login <key>.

Environment

export ARGORANT_API_KEY=ag_live_...

This is the right shape for scripts, CI and agents. Nothing touches disk.

Precedence

  1. ARGORANT_API_KEY in the environment wins over everything.
  2. Otherwise the key saved by argorant login is used.
  3. With neither, commands exit with code 2 and tell you to log in.

The saved key lives in ~/.argorant/config.json, written at mode 0600. A non-default --base is stored alongside it.

Logout

npx argorant logout

This removes the config file. If ARGORANT_API_KEY is still set in your environment, the CLI warns you, because that variable takes precedence and would keep you logged in. Unset it too.

Terminal showing argorant login followed by a confirmation line
Terminal showing argorant login followed by a confirmation line

Base URL

An explicit --base on any command wins over the stored one, and ARGORANT_API_BASE overrides both. You rarely need this outside of testing.

Still stuck? support@argorant.com