Where does the ClearRun CLI look for my API key?
In this order: --api-key, then CLEARRUN_API_KEY, then the file saved by clearrun login, then apiKey in clearrun.config.json. The first one found wins.
Last updated
The order
| Order | Where | Notes |
|---|---|---|
| 1 | --api-key <key> | Can end up in shell history and CI logs |
| 2 | CLEARRUN_API_KEY | Best for CI |
| 3 | ~/.config/clearrun/config.json | Saved by clearrun login. Uses $XDG_CONFIG_HOME/clearrun/config.json when set |
| 4 | apiKey in clearrun.config.json | Avoid. The file is usually committed |
Check which one is used
clearrun whoami
The Source: line names it.
The SDK and MCP server
The SDK and MCP server use the first three, in the same order. They do not read clearrun.config.json.