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
macOS and Linux
export CLEARRUN_API_KEY=YOUR_CLEARRUN_API_KEYTo keep it, add that line to
~/.zshrcor~/.bashrc.Windows PowerShell
$env:CLEARRUN_API_KEY = "YOUR_CLEARRUN_API_KEY"Check
npx @clearrun/cli whoamiIt 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.