Google Health API Gets CLI Tool: ghealth Simplifies Fitbit Data Access
A new open-source command-line interface (CLI) tool, ghealth, has emerged as a streamlined way to access and manage health data from the Google Health API, which now supports Fitbit and Pixel Watch signals. Developed under the Apache 2.0 license, this single-binary tool wraps the Google Health API v4, enabling developers to retrieve structured JSON data for metrics like heart rate, sleep patterns, and step counts directly from terminal environments or AI agents.
What is ghealth?
ghealth is designed as an agent-first tool, prioritizing simplicity and consistency. It exposes 40 verified data types, including steps, heart rate, and sleep, in a standardized JSON format. Developers can use commands like ghealth data heart-rate list to fetch recent readings or ghealth data steps daily-rollup for aggregated weekly totals. The tool’s deterministic exit codes and flags like --dry-run and --raw provide flexibility, while its modular SKILL.md files guide users through authentication and data operations.
Key Features and Data Types
The CLI’s strength lies in its structured output and compatibility with AI workflows. For instance, sleep data can be queried with the --detail flag to reveal stage-by-stage breakdowns (awake, deep, REM), aiding pattern analysis over time. Writable data types like weight or exercise allow updates, while reconciliation operations merge overlapping data from multiple sources. All 40 types adhere to Google’s restricted API scopes, requiring privacy and security reviews for production use.
Setup and Security
Setting up ghealth involves a guided ghealth setup command that walks users through Google Cloud Platform (GCP) project configuration and OAuth 2.0 authentication. The tool stores credentials securely in ~/.config/ghealth/ with file permissions set to 0600. While the headless flow uses PKCE with S256 challenges for enhanced security, personal use requires users to authorize their own projects against their accounts.
For developers, ghealth bridges the gap between raw API data and actionable insights, offering a flexible yet secure way to integrate health metrics into workflows. Whether for analytics or AI training, its structured approach ensures compatibility with modern data pipelines.
Source: MarkTechPost. AI-assisted editorial synthesis — TechnoExpress.

