whoop-query-cli
v0.1.2
Published
Unofficial CLI for authenticating with WHOOP and querying v2 user data
Maintainers
Readme
Unofficial WHOOP Query CLI
Unofficial tool. Not affiliated with or endorsed by WHOOP.
CLI to authenticate with the official WHOOP API and query your account data, including:
- OAuth login URL generation + authorization-code exchange
- one-step local OAuth callback capture (
login-local) - profile and body measurements
- cycles, recoveries, sleep, and workouts collections
- endpoint lookups:
cycle-by-id,activity-map,sleep-by-id,workout-by-id,cycle-recovery,cycle-sleep - day snapshot across core WHOOP datasets
- agent-friendly filtering, field projection, and JSON/JSONL/CSV output
- automatic token refresh with cross-process lock protection and retry/backoff for rate limits
Install
Run without install (npx)
npx --yes whoop-query-cli helpGlobal install
npm install -g whoop-query-cli
whoop-query-cli helpLocal development (from source)
git clone https://github.com/quinnsprouse/whoop-cli.git
cd whoop-cli
npm install
npm run helpRun from local source
node src/cli.mjs helpWHOOP App Setup (Developer Dashboard)
- Create a WHOOP app in the dashboard.
- Set Privacy Policy URL:
https://github.com/quinnsprouse/whoop-cli/blob/main/PRIVACY.md
- Add Redirect URL(s):
http://localhost:8787/callback(recommended forlogin-local)
- Request scopes your CLI needs (recommended):
read:profileread:body_measurementread:workoutread:sleepread:recoveryread:cyclesoffline(required if you want refresh tokens)
Local Environment
export WHOOP_CLIENT_ID="..."
export WHOOP_CLIENT_SECRET="..."
export WHOOP_REDIRECT_URI="http://localhost:8787/callback"Optional:
WHOOP_SCOPE(space/comma-separated scopes)WHOOP_SESSION_FILE(default:~/.whoop/session.json)WHOOP_TIMEZONE(default: system timezone)
Quickstart
- Authenticate (recommended)
whoop-query-cli login-local --open- Query data
whoop-query-cli whoami --json
whoop-query-cli workouts --days 14 --json
whoop-query-cli recoveries --days 30 --max-recovery 50 --json
whoop-query-cli sleep --days 14 --json
whoop-query-cli day --date 2026-02-24 --include-records --json- Query endpoint-specific records
whoop-query-cli sleep-by-id --sleep-id <uuid> --json
whoop-query-cli workout-by-id --workout-id <uuid> --json
whoop-query-cli cycle-by-id --cycle-id <int> --json
whoop-query-cli activity-map --activity-v1-id <int> --json
whoop-query-cli cycle-recovery --cycle-id <int> --json
whoop-query-cli cycle-sleep --cycle-id <int> --json- Discover commands progressively
whoop-query-cli help
whoop-query-cli help workouts --json
whoop-query-cli discover --level 3 --json
whoop-query-cli capabilities --jsonAuth Modes
login-local: starts local callback server, capturescode, exchanges token automatically.login+exchange-code: manual OAuth flow if you do not want local callback capture.- Access tokens are auto-refreshed using the stored refresh token (
offlinescope required).
Output
- default: pretty JSON
--json: structured JSON--jsonl: one record per line--csv: comma-separated rows (supports--fieldsprojection)--fields a,b,c: project record fields--records-only: lighter record payloads--tz <IANA timezone>: localize day boundaries/timestamps (defaults toWHOOP_TIMEZONEor system timezone)
Agent Filters
Available on collection commands (cycles, recoveries, sleep, workouts):
--from YYYY-MM-DD--to YYYY-MM-DD--type a,b,c--contains <text>--min-strain <n>/--max-strain <n>--min-recovery <n>/--max-recovery <n>--sort date|date-desc|strain|strain-desc|recovery|recovery-desc|name|name-desc--result-limit <n>--fields a,b,c
Security
- Session/token data is stored at
~/.whoop/session.jsonby default. - Treat session files, exported JSON, and terminal logs as sensitive.
- Do not commit secrets or session files.
- Use
whoop-query-cli revoketo revoke OAuth access and clear local session data. - Use
whoop-query-cli logoutto clear local session data only.
Troubleshooting
- Redirect mismatch:
- Ensure WHOOP dashboard Redirect URL exactly matches
WHOOP_REDIRECT_URI.
- Ensure WHOOP dashboard Redirect URL exactly matches
login-local requires an http://localhost redirect URI:- Set
WHOOP_REDIRECT_URItohttp://localhost:8787/callback.
- Set
No access token found:- Re-run
whoop-query-cli login-local --open.
- Re-run
- Cron/auth drift:
- Ensure
WHOOP_CLIENT_ID,WHOOP_CLIENT_SECRET, andWHOOP_REDIRECT_URIare available in the cron environment. - Use a stable session file path (recommended:
WHOOP_SESSION_FILE="$HOME/.whoop/session.json"). - If refresh token is revoked/expired, re-authenticate with
whoop-query-cli login-local --open.
- Ensure
