Google Health API 可跟踪用户生命体征和生理健康指标,例如心率、血氧饱和度、血糖、核心体温和每日睡眠温度派生数据。
了解如何在应用中读取和请求用户授权以获取健康指标数据,从而为用户提供最佳体验。
支持的数据类型
该 API 支持以下数据类型,用于跟踪生命体征和健康指标:
数据类型dataType
filter 参数 |
可用的 操作 |
范围 |
|---|---|---|
|
血糖
|
list、get、reconcile、rollup、dailyRollup | .health_metrics_and_measurements.readonly.health_metrics_and_measurements.writeonly |
|
核心体温
|
list、get、reconcile、rollup、dailyRollup | .health_metrics_and_measurements.readonly.health_metrics_and_measurements.writeonly |
每日心率变异性
daily-heart-rate-variabilitydaily_heart_rate_variability
记录类型: 每日
兼容的设备
|
list、reconcile | .health_metrics_and_measurements.readonly.health_metrics_and_measurements.writeonly |
|
每日心率区间
|
list、reconcile | .health_metrics_and_measurements.readonly.health_metrics_and_measurements.writeonly |
每日血氧饱和度
daily-oxygen-saturationdaily_oxygen_saturation
记录类型: 每日
兼容的设备
|
list、reconcile | .health_metrics_and_measurements.readonly.health_metrics_and_measurements.writeonly |
每日呼吸频率
daily-respiratory-ratedaily_respiratory_rate
记录类型: 每日
兼容的设备
|
list、reconcile | .health_metrics_and_measurements.readonly.health_metrics_and_measurements.writeonly |
每日静息心率
daily-resting-heart-ratedaily_resting_heart_rate
记录类型: 每日
兼容的设备
|
list、reconcile | .health_metrics_and_measurements.readonly.health_metrics_and_measurements.writeonly |
每日睡眠温度推导
daily-sleep-temperature-derivationsdaily_sleep_temperature_derivations
记录类型: 每日
兼容的设备
|
list、reconcile | .health_metrics_and_measurements.readonly.health_metrics_and_measurements.writeonly |
心电图 (ECG)
electrocardiogramelectrocardiogram
记录类型: 会话
兼容的设备
|
list | .ecg.readonly |
心率
heart-rateheart_rate
记录类型: 示例
兼容的设备
|
list、reconcile、rollup、dailyRollup | .health_metrics_and_measurements.readonly.health_metrics_and_measurements.writeonly |
心率变异性
heart-rate-variabilityheart_rate_variability
记录类型: 示例
兼容的设备
|
list、reconcile | .health_metrics_and_measurements.readonly.health_metrics_and_measurements.writeonly |
|
心律不齐通知
|
list | .irn.readonly |
血氧饱和度
oxygen-saturationoxygen_saturation
记录类型: 示例
兼容的设备
|
list、reconcile | .health_metrics_and_measurements.readonly.health_metrics_and_measurements.writeonly |
呼吸频率睡眠摘要
respiratory-rate-sleep-summaryrespiratory_rate_sleep_summary
记录类型: 示例
兼容的设备
|
list、reconcile | .health_metrics_and_measurements.readonly.health_metrics_and_measurements.writeonly |
只读要求
生理生命体征数据类型通过设备同步或 Fitbit 移动应用/Web 应用中的手动日志条目进行填充,并通过 REST API 以只读方式提供(无法通过 Google Health API 端点直接写入或修改)。
以下各部分提供了生命体征数据的技术细节和 REST 表示格式。
心率和心脏健康
该 API 提供心率指标的详细日内测量数据和每日汇总数据:
- 心率 (
heart-rate):包含beatsPerMinute个数的时间点心率测量值,以及用户的motionContext(例如SEDENTARY或ACTIVE)和sensorLocation(例如WRIST或CHEST)。 - 每日静息心率 (
daily-resting-heart-rate):每日基准静息心率值。 - 心率变异性(
heart-rate-variability和daily-heart-rate-variability):记录连续差值的均方根(以毫秒为单位),以表示 HRV。rmssd
REST 表示法示例
如需查询心率测量结果,请向 list 端点发送 GET 请求。
以下示例展示了返回列表中的单个 heart-rate 数据点:
请求
GET https://health.googleapis.com/v4/users/me/dataTypes/heart-rate/dataPoints?startTime=2026-04-20T08:00:00Z&endTime=2026-04-20T08:05:00Z Authorization: Bearer access-token Accept: application/json
响应
{
"dataPoints": [
{
"name": "users/me/dataTypes/heart-rate/dataPoints/hr-123456789",
"dataSource": {
"recordingMethod": "ACTIVELY_MEASURED"
},
"heartRate": {
"sampleTime": {
"physicalTime": "2026-04-20T08:00:00Z",
"utcOffset": "0s"
},
"beatsPerMinute": "72",
"metadata": {
"motionContext": "SEDENTARY",
"sensorLocation": "WRIST"
}
}
}
]
}血糖
blood-glucose 数据类型表示用户的血糖水平。血糖点包含以毫克/分升 (mg/dL) 为单位的浓度、用餐或时间背景信息以及样本信息。
REST 表示法示例
如需查询血糖测量结果,请向 list 端点发送 GET 请求。以下示例显示了返回列表中的单个 blood-glucose 数据点:
请求
GET https://health.googleapis.com/v4/users/me/dataTypes/blood-glucose/dataPoints?startTime=2026-04-20T08:00:00Z&endTime=2026-04-20T09:00:00Z Authorization: Bearer access-token Accept: application/json
响应
{
"dataPoints": [
{
"name": "users/me/dataTypes/blood-glucose/dataPoints/bg-987654321",
"dataSource": {
"recordingMethod": "MANUALLY_ENTERED"
},
"bloodGlucose": {
"sampleTime": {
"physicalTime": "2026-04-20T08:30:00Z",
"utcOffset": "-25200s"
},
"bloodGlucoseMilligramsPerDeciliter": 95.0,
"measurementSource": "SELF_MONITORING_BLOOD_GLUCOSE",
"mealType": "BREAKFAST",
"measurementTiming": "AFTER_MEAL",
"specimen": "CAPILLARY_BLOOD",
"notes": "Post-breakfast fingerstick reading"
}
}
]
}血氧饱和度 (SpO2)
该 API 使用 oxygen-saturation(日内样本值)和 daily-oxygen-saturation(每日汇总统计信息)跟踪血氧水平。百分比浓度以 0 到 100 之间的数字表示。
REST 表示法示例
如需查询血氧饱和度测量结果,请向 list 端点发送 GET 请求。以下示例显示了返回列表中的单个 oxygen-saturation 数据点:
请求
GET https://health.googleapis.com/v4/users/me/dataTypes/oxygen-saturation/dataPoints?startTime=2026-04-20T03:00:00Z&endTime=2026-04-20T03:05:00Z Authorization: Bearer access-token Accept: application/json
响应
{
"dataPoints": [
{
"name": "users/me/dataTypes/oxygen-saturation/dataPoints/spo2-555555",
"dataSource": {
"recordingMethod": "ACTIVELY_MEASURED"
},
"oxygenSaturation": {
"sampleTime": {
"physicalTime": "2026-04-20T03:00:00Z",
"utcOffset": "0s"
},
"percentage": 98.2
}
}
]
}温度
体温追踪功能包括核心体温指标和夜间睡眠体表温度趋势:
- 核心体温 (
core-body-temperature):记录内部器官温度(以摄氏度为单位),并指明具体测量部位(例如ARMPIT、EAR或FOREHEAD)。 - 睡眠温度派生变量 (
daily-sleep-temperature-derivations):夜间记录的高频体表温度方差。
REST 表示法示例
如需查询核心体温测量结果,请向 list 端点发送 GET 请求。以下示例显示了返回列表中的单个 core-body-temperature 数据点:
请求
GET https://health.googleapis.com/v4/users/me/dataTypes/core-body-temperature/dataPoints?startTime=2026-04-20T22:00:00Z&endTime=2026-04-20T23:00:00Z Authorization: Bearer access-token Accept: application/json
响应
{
"dataPoints": [
{
"name": "users/me/dataTypes/core-body-temperature/dataPoints/cbt-666666",
"dataSource": {
"recordingMethod": "ACTIVELY_MEASURED"
},
"coreBodyTemperature": {
"sampleTime": {
"physicalTime": "2026-04-20T22:30:00Z",
"utcOffset": "-18000s"
},
"temperatureCelsius": 36.8,
"measurementLocation": "FOREHEAD"
}
}
]
}心电图 (ECG) 和通知
对于配备医疗级传感器的设备,该 API 会公开高级心脏健康数据类型:
- 心电图 (
electrocardiogram):单导联心电图会话结果,包含分类(SINUS_RHYTHM、ATRIAL_FIBRILLATION、INCONCLUSIVE)、平均心率、采样频率和原始波形电压样本。 - 心律不齐通知 (
irregular-rhythm-notification):在被动监测期间检测到疑似心房颤动迹象的上下文相关提醒事件。
REST 表示法示例
如需查询心电图会话数据,请向 list 端点发送 GET 请求。以下示例显示了返回列表中的单个 electrocardiogram 数据点:
请求
GET https://health.googleapis.com/v4/users/me/dataTypes/electrocardiogram/dataPoints?startTime=2026-04-20T10:00:00Z&endTime=2026-04-20T10:05:00Z Authorization: Bearer access-token Accept: application/json
响应
{
"dataPoints": [
{
"name": "users/me/dataTypes/electrocardiogram/dataPoints/ecg-777777",
"dataSource": {
"recordingMethod": "ACTIVELY_MEASURED"
},
"electrocardiogram": {
"interval": {
"startTime": "2026-04-20T10:00:00Z",
"startUtcOffset": "0s",
"endTime": "2026-04-20T10:00:30Z",
"endUtcOffset": "0s"
},
"resultClassification": "SINUS_RHYTHM",
"beatsPerMinuteAvg": "70",
"samplingFrequencyHertz": 250,
"millivoltsScalingFactor": 1000,
"leadNumber": 1,
"waveformSamples": [
-12, -8, 4, 18, 30, 42, 50, 48, 32, 10
]
}
}
]
}范围和授权
如需使用生命体征和心脏健康数据功能,您的应用必须请求以下 OAuth 范围:
- 朗读:
https://www.googleapis.com/auth/googlehealth.ecg.readonly - 朗读:
https://www.googleapis.com/auth/googlehealth.health_metrics_and_measurements.readonly - 撰写:
https://www.googleapis.com/auth/googlehealth.health_metrics_and_measurements.writeonly - 朗读:
https://www.googleapis.com/auth/googlehealth.irn.readonly
指南
在设计包含生命体征和健康指标的功能时,请遵循以下准则:
- 处理单位换算:温度值以摄氏度为单位提供。 根据用户的本地化偏好设置,在前端代码中转换为华氏度。
- 管理 Webhook 通知:订阅生命体征的 Webhook 提醒,以便在用户同步新读数(例如心率或血糖)后立即触发后端分析。
- 尊重数据敏感性:确保您的产品向用户明确说明读取高频生理生命体征数据的临床或健康背景。在调用授权提示之前,说明为什么需要
health_metrics_and_measurements或ecg等范围。