CLI

# hotcfg login

Check a secret API key with the API and save it for later commands.

usage

```
hotcfg login [--key <key>] [--api-url <url>]
```

Asks for a secret key (input is hidden), checks it with the API, and saves it with the API URL to `~/.config/hotcfg/credentials` (mode `0600`). Later commands use it when neither `--key` nor `HOTCFG_API_KEY` is set.

terminal

```
$ hotcfg login
Secret API key (sk_live_...):
✓ Logged in to Acme (acme)
  key      sk_live_4f9a…  Laptop
  api      https://api.hotcfg.run
  saved    /home/alex/.config/hotcfg/credentials
```

A key limited to some bins or environments, or with an expiry, shows those limits as `bins`, `envs` and `expires` lines. A key whose environments leave out production also shows `prod no: this key can't publish, promote to or roll back production`.

## Flags

| Flag | Default | Description |
| --- | --- | --- |
| `--key` | prompt | The key to save. Without a terminal, `login` reads one line from standard input, so `echo "$KEY" \| hotcfg login` works. |
| `--api-url` | `HOTCFG_API_URL`, then `https://api.hotcfg.run` | The API to log in to, also saved. |

## Errors

- A publishable key (`pk_…`) is refused: it can't write.
- An unknown, revoked or expired key is refused, and nothing is saved.
- If `HOTCFG_API_KEY` is set to a different key, `login` still saves, and warns that the variable wins.

Tip

In CI, don't run `login`. Set `HOTCFG_API_KEY` from your secret store: nothing is written to disk.

Last updated 10 November 2026
