Use gccli for Garmin Connect health, fitness, and activity data. Requires Garmin SSO authentication.
Setup (once)
gccli auth login you@example.com (opens browser for Garmin SSO)gccli auth login you@example.com --headless (with --mfa-code for MFA)export GCCLI_ACCOUNT=you@example.comgccli auth statusOutput
--json / -j for JSON, --plain for TSV.--json when parsing output programmatically.Date shortcuts
today, yesterday, 3d (N days ago), YYYY-MM-DD (specific date).--start/--end flags for date ranges.Common commands
gccli auth statusgccli auth tokengccli auth export (pipe to file or copy to another machine)gccli auth import (from auth export output)gccli auth removegccli activities list --limit 20gccli activities list --type runninggccli activities countgccli activities search --start-date 2024-01-01 --end-date 2024-12-31gccli activity summary gccli activity details gccli activity splits gccli activity weather gccli activity hr-zones gccli activity power-zones gccli activity exercise-sets gccli activity exercise-sets set -e "CATEGORY/NAME:reps@weightkg[:dSECS][:rSECS]" [-e ...] gccli activity gear gccli activity download --format fit gccli activity download --format gpx --output track.gpx gccli activity upload ./activity.fitgccli activity create --name "Morning Run" --type running --date 2024-06-15T07:30:00 --duration 1800 --distance 5000gccli activity rename "New Name" gccli activity retype running gccli activity delete --force gccli activities typesgccli health summary [date]gccli health steps [date]gccli health steps daily --start 2024-01-01 --end 2024-01-31gccli health steps weekly --weeks 4gccli health hr [date]gccli health rhr [date]gccli health floors [date]gccli health sleep [date]gccli health respiration [date]gccli health spo2 [date]gccli health hrv [date]gccli health stress [date]gccli health stress weekly --weeks 4gccli health body-battery [date]gccli health body-battery range --start 2024-01-01 --end 2024-01-07gccli health training-readiness [date]gccli health training-status [date]gccli health fitness-age [date]gccli health max-metrics [date]gccli health lactate-thresholdgccli health cycling-ftpgccli health race-predictions [date]gccli health race-predictions range --start 2024-01-01 --end 2024-06-30gccli health endurance-score [date]gccli health hill-score [date]gccli health intensity-minutes [date]gccli health intensity-minutes weekly --start 2024-01-01 --end 2024-01-31gccli health events [date]gccli body composition [date]gccli body composition --start 2024-01-01 --end 2024-01-31gccli body weigh-ins --start 2024-01-01 --end 2024-01-31gccli body add-weight 75.5 --unit kggccli body add-composition 75.5 --body-fat 15.2 --muscle-mass 35.0gccli body blood-pressure --start 2024-01-01 --end 2024-01-31gccli body add-blood-pressure --systolic 120 --diastolic 80 --pulse 65gccli workouts list --limit 20gccli workouts detail gccli workouts download --output workout.fit gccli workouts upload ./workout.jsongccli workouts schedule add 2024-06-20 gccli workouts schedule list 2024-06-20gccli workouts schedule list --start 2024-06-01 --end 2024-06-30gccli workouts schedule remove (use --force to skip confirmation)gccli workouts delete gccli workouts create "Easy Run" --type run --step "warmup:5m" --step "run:20m@pace:5:00-5:30" --step "cooldown:5m"gccli workouts create "HR Run" --type run --step "warmup:10m" --step "run:20m@hr:140-160" --step "cooldown:10m"gccli workouts create "FTP Intervals" --type bike --step "warmup:10m" --step "run:5m@power:250-280" --step "recovery:3m" --step "run:5m@power:250-280" --step "cooldown:10m"gccli courses listgccli courses favoritesgccli courses detail gccli courses import route.gpxgccli courses import route.gpx --name "Sunday Ride"gccli courses import route.gpx --type gravel_cyclinggccli courses import route.gpx --privacy 1gccli courses send gccli courses delete (use -f to skip confirmation)gccli devices listgccli devices settings gccli devices primarygccli devices last-usedgccli devices alarmsgccli devices solar --start 2024-06-01 --end 2024-06-30 gccli gear listgccli gear stats gccli gear activities --limit 20 gccli gear defaultsgccli gear link gccli gear unlink gccli goals list --status activegccli badges earnedgccli badges availablegccli badges in-progressgccli challenges listgccli challenges badgegccli recordsgccli profilegccli profile settingsgccli hydration [date]gccli hydration add 500gccli nutrition [date]gccli nutrition meals [date]gccli nutrition settings [date]gccli training plans --locale engccli training plan gccli wellness menstrual-cycle --start-date 2024-01-01 --end-date 2024-03-31gccli wellness pregnancy-summarygccli events listgccli events list --start 2024-06-01 --limit 50gccli events add --name "Berlin Marathon" --date 2026-09-27 --type running --race --location "Berlin, Germany" --distance 42.195km --time 09:15 --timezone Europe/Berlingccli events add --name "Spring 10K" --date 2026-05-10 --type running --race --distance 10km --goal 40m --traininggccli events delete (use -f to skip confirmation)gccli reload [date]gccli exercises listgccli exercises list -c BENCH_PRESSgccli exercises list --jsonStrength training workflow (LLM-assisted exercise matching)
When a user wants to log a strength training activity with exercises described in free text (e.g. "Bench Press 3x12@20kg, Lat Pulldowns 3x12@41kg"), follow this workflow:
gccli exercises list --jsongccli activity create --name "Upper Body" --type strength_training --duration 34m --date 2024-06-15T19:01:00gccli activity exercise-sets set -e "CATEGORY/NAME:reps@weightkg[:dSECS][:rSECS]" [-e ...] Exercise set format: CATEGORY/NAME:reps@weightkg[:dSECS][:rSECS]
Each -e flag is one set. For 3 sets of 12 reps, use three -e flags with the same exercise.
Example full workflow:
gccli activity create --name "Upper Body" --type strength_training --duration 34m --date 2026-03-13T19:01:00 --json
# Extract activityId from JSON response
gccli activity exercise-sets set <id> \
-e "PULL_UP/WIDE_GRIP_LAT_PULLDOWN:12@41:d30:r60" \
-e "PULL_UP/WIDE_GRIP_LAT_PULLDOWN:12@41:d30:r60" \
-e "PULL_UP/WIDE_GRIP_LAT_PULLDOWN:12@41:d30:r90" \
-e "LATERAL_RAISE/DUMBBELL_LATERAL_RAISE:12@8:d25:r60" \
-e "LATERAL_RAISE/DUMBBELL_LATERAL_RAISE:12@8:d25:r60" \
-e "LATERAL_RAISE/DUMBBELL_LATERAL_RAISE:12@8:d25:r90" \
-e "BENCH_PRESS/BARBELL_BENCH_PRESS:12@20:d30:r60" \
-e "BENCH_PRESS/BARBELL_BENCH_PRESS:8@20:d35:r60" \
-e "BENCH_PRESS/BARBELL_BENCH_PRESS:5@20:d40"
Notes
GCCLI_ACCOUNT=you@example.com to avoid repeating --account.--json for JSON output or --plain for TSV.today, yesterday, 3d, or YYYY-MM-DD.export GCCLI_DOMAIN=garmin.cn.--force).type:duration[@target:low-high] — types: warmup, run, recovery, cooldown; targets: pace (min:sec), hr (bpm), power (watts), cadence.共 5 个版本