garminconnect-js is an unofficial TypeScript client for retrieving health, fitness, and activity data from Garmin Connect so it can be used in Node.js or Next.js server-side code without scraping HTML or reverse-engineering the mobile app yourself. It communicates through the undocumented endpoints used by the Garmin mobile app and provides a fully typed, Promise-based API.
Key capabilities:
- Handles Garmin's undocumented SSO/OAuth flow, automatically refreshes tokens, and provides 222 typed methods covering categories such as health, activities, training metrics, workouts, gear, courses, devices, badges, body composition, women's health, golf, nutrition, and training plans.
- Provides a fluent workout builder, buildWorkout, that handles four pitfalls of Garmin workout JSON: global step numbering, id/key triple consistency, differences between rest and time fields, and pace target representation.
- Provides a type-checked exercise catalog, garminconnect-js/exercises, containing 1,830 exercise names verified against a live account, preventing typos from causing silent failures.
- Each method has a live verification status in AGENTS.md; write operations are considered verified only after the stored value is read back.
Usage:
- After installation, log in via GarminClient.login(email, password); tokens can be stored in FileTokenStore or a custom TokenStore.
- Supports MFA; login() returns mfaState so verification can be completed across HTTP requests.
- Provides client.connectapi() for calling unwrapped endpoints and client.upload() for uploading files.
- Provides the Next.js template garminconnect-nextjs-starter and the MCP server @dynamicsninja/garminconnect-mcp, which can be used in Claude.
Use cases:
- Integrate Garmin health and fitness data into Node.js or Next.js server-side applications.
- Build custom workouts, upload activity files, manage courses, and more.
- Query data or create workouts in Claude via MCP.or create workouts.
Limitations:
- Server-side only, requires Node.js 18+, and does not run in browser or Edge runtimes.
- Zero runtime dependencies, but login requires fetching an OAuth consumer key from a third-party URL.
- Version is 0.x; the public API may change.
- Garmin's APIs are undocumented and may change or break at any time; it should not be used to build security-critical applications.
- Writes for EU accounts require granting upload consent in Garmin Connect first; otherwise a 412 is returned.
- Some methods are unverified, such as golf scorecards and shot data; getWeightGoals has only been confirmed with an empty response.
- Dates are interpreted as UTC; be mindful of time zone issues.
- Tokens must persist expires_at and refresh_token_expires_at as numbers; otherwise every call will refresh.