How to store your ClearRun API key in an environment variable

Set CLEARRUN_API_KEY to your key. The CLI, SDK and MCP server all read it, and it wins over the file saved by clearrun login.

Last updated

Steps

  1. macOS and Linux

    export CLEARRUN_API_KEY=YOUR_CLEARRUN_API_KEY

    To keep it, add that line to ~/.zshrc or ~/.bashrc.

  2. Windows PowerShell

    $env:CLEARRUN_API_KEY = "YOUR_CLEARRUN_API_KEY"
  3. Check

    npx @clearrun/cli whoami

    It shows Source: CLEARRUN_API_KEY.

In CI

Store the key as a secret and map it to CLEARRUN_API_KEY in the job. See How to use ClearRun in GitHub Actions.

.env files

If your app loads a .env file, add CLEARRUN_API_KEY=... there and make sure .env is in .gitignore.