Google 健康 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 行動應用程式/網頁應用程式中的手動記錄項目填入,且只能透過 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):記錄連續差異的均方根 (rmssd),以毫秒為單位表示 HRV。
REST 表示法範例
如要查詢心率測量結果,請將 GET 要求傳送至 list 端點。
以下範例顯示傳回清單中的單一 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"
}
}
]
}心電圖和通知
對於搭載醫療級感應器的裝置,API 會公開進階心臟健康資料類型:
- 心電圖 (
electrocardiogram):單導程心電圖測量結果,包含分類 (SINUS_RHYTHM、ATRIAL_FIBRILLATION、INCONCLUSIVE)、平均心率、取樣頻率和原始波形電壓樣本。 - 心律不整通知 (
irregular-rhythm-notification): 在被動監測期間偵測到疑似心房顫動跡象時,系統會發出情境式快訊。
REST 表示法範例
如要查詢心電圖記錄資料,請將 GET 要求傳送至 list 端點。以下範例顯示傳回清單中的單一 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等範圍。