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

The order
OrderWhereNotes
1--api-key <key>Can end up in shell history and CI logs
2CLEARRUN_API_KEYBest for CI
3~/.config/clearrun/config.jsonSaved by clearrun login. Uses $XDG_CONFIG_HOME/clearrun/config.json when set
4apiKey in clearrun.config.jsonAvoid. 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.