Authentication
API keys, scopes, and where the CLI stores credentials.
CLI authentication
Three sources, in priority order
--api-keyflag on the command line (highest priority)HAPPYUPTIME_API_KEYenvironment variable~/.happyuptime/config.json(created byhappy login)
happy login (recommended)
bashhappy login
Walks through the OAuth device flow:
- Prints a URL + 8-character code.
- Opens your browser.
- You confirm in the dashboard.
- The CLI stores your API key locally.
bashhappy whoami# Logged in as you@example.com (org: Acme)happy logout# Removes ~/.happyuptime/config.json
Manual API key
Dashboard → Settings → API Keys → Create Key. Pick a scope (read, write, admin). Copy the hu_… token (shown once).
Use it via env var or flag:
bashexport HAPPYUPTIME_API_KEY=hu_xxxxx_yyyyyhappy monitors list
Scopes
| Scope | Permissions |
|---|---|
read | GET endpoints only |
write | GET + POST + PUT + DELETE on monitors, incidents, status pages, alerts, on-call |
admin | Everything including settings, team, billing |
Most CI use cases want write. Tools that just check status from a script can use read.
Rotating
Create a new key, update your CI secrets, then revoke the old one. Revoke is instant.
Storage details
~/.happyuptime/config.json:
json{ "api_key": "hu_xxxxx", "endpoint": "https://happyuptime.com/api/v1", "user_email": "you@example.com", "logged_in_at": "2026-04-18T15:23:11Z"}
File is created with mode 0600 (read/write owner only).