How to save your API key with clearrun login

Run clearrun login, then paste your key. The CLI saves it on your computer so you don't have to type it again.

Last updated

Steps

  1. Run the login command

    npx @clearrun/cli login

    Your browser opens the API keys page at api.clearrun.net/account/keys. If it doesn't open, use the link printed in the terminal.

  2. Create a key and copy it

    On that page, choose Create API key and copy it. The full key is shown only once.

  3. Paste the key and press Enter

    The characters don't show while you paste.

  4. Check that it worked

    npx @clearrun/cli whoami

    It shows the masked key and where it came from.

Where the key goes

~/.config/clearrun/config.json. If you set XDG_CONFIG_HOME, it goes in $XDG_CONFIG_HOME/clearrun/config.json. Only your user account can read the file (mode 0600).

The SDK and the MCP server read the same file, so one login covers all three.

Login does not test the key

clearrun login saves the key. It does not send it to ClearRun. A wrong key is saved without an error. You find out on your first score. See Does clearrun login check my key with ClearRun?

Which key wins

  1. --api-key on the command line
  2. The CLEARRUN_API_KEY environment variable
  3. The file saved by clearrun login
  4. apiKey in clearrun.config.json

So if CLEARRUN_API_KEY is set, it overrides your saved login.

Remove the saved key

clearrun logout

This deletes the key from the file on your computer. The key itself still works. To turn it off, revoke it on the API keys page. See How to revoke a ClearRun API key.