Google Health API を使用して主な指標と健康指標のエクスペリエンスを開発する

Google Health API は、心拍数、血中酸素飽和度、血糖値、深部体温、毎日の睡眠中の体温の変化など、ユーザーのバイタルと生理学的健康指標を追跡します。

アプリでバイタル データに対するユーザーの承認を読み取り、リクエストして、ユーザーに最適なエクスペリエンスを提供する方法について説明します。

サポートされるデータタイプ

この API は、主な指標と健康指標のトラッキングに次のデータ型をサポートしています。

表: Google Health API の主な指標データ型
データ型
  dataType
  filter パラメータ
利用可能な
オペレーション
スコープ
血糖値
blood-glucose
blood_glucose
レコードタイプ: サンプル
list、get、reconcile、rollup、dailyRollup .health_metrics_and_measurements.readonly
.health_metrics_and_measurements.writeonly
深部体温
core-body-temperature
core_body_temperature
レコードタイプ: サンプル
list、get、reconcile、rollup、dailyRollup .health_metrics_and_measurements.readonly
.health_metrics_and_measurements.writeonly
1 日の心拍変動
daily-heart-rate-variability
daily_heart_rate_variability
レコードタイプ: 毎日

対応デバイス

list、reconcile .health_metrics_and_measurements.readonly
.health_metrics_and_measurements.writeonly
1 日の心拍ゾーン
daily-heart-rate-zones
daily_heart_rate_zones
レコードタイプ: 毎日
list、reconcile .health_metrics_and_measurements.readonly
.health_metrics_and_measurements.writeonly
1 日の酸素飽和度
daily-oxygen-saturation
daily_oxygen_saturation
レコードタイプ: 毎日

対応デバイス

list、reconcile .health_metrics_and_measurements.readonly
.health_metrics_and_measurements.writeonly
1 日の呼吸数
daily-respiratory-rate
daily_respiratory_rate
レコードタイプ: 毎日

対応デバイス

list、reconcile .health_metrics_and_measurements.readonly
.health_metrics_and_measurements.writeonly
1 日の安静時の心拍数
daily-resting-heart-rate
daily_resting_heart_rate
レコードタイプ: 毎日

対応デバイス

list、reconcile .health_metrics_and_measurements.readonly
.health_metrics_and_measurements.writeonly
毎日の睡眠時の体温の推移
daily-sleep-temperature-derivations
daily_sleep_temperature_derivations
レコードタイプ: 毎日

対応デバイス

list、reconcile .health_metrics_and_measurements.readonly
.health_metrics_and_measurements.writeonly
心電図(ECG)
electrocardiogram
electrocardiogram
レコードタイプ: セッション

対応デバイス

list .ecg.readonly
心拍数
heart-rate
heart_rate
レコードタイプ: サンプル

対応デバイス

list、reconcile、rollup、dailyRollup .health_metrics_and_measurements.readonly
.health_metrics_and_measurements.writeonly
心拍変動
heart-rate-variability
heart_rate_variability
レコードタイプ: サンプル

対応デバイス

list、reconcile .health_metrics_and_measurements.readonly
.health_metrics_and_measurements.writeonly
不整脈の通知
irregular-rhythm-notification
irregular_rhythm_notification
レコードタイプ: セッション
list .irn.readonly
酸素飽和度
oxygen-saturation
oxygen_saturation
レコードタイプ: サンプル

対応デバイス

list、reconcile .health_metrics_and_measurements.readonly
.health_metrics_and_measurements.writeonly
呼吸数の睡眠のまとめ
respiratory-rate-sleep-summary
respiratory_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 カウントを含む心拍数の測定値。ユーザーの motionContextSEDENTARYACTIVE など)と sensorLocationWRISTCHEST など)も含まれます。
  • 1 日の安静時の心拍数(daily-resting-heart-rate: 1 日の安静時の心拍数の基準値。
  • 心拍変動(heart-rate-variabilitydaily-heart-rate-variability: 心拍変動を表すために、連続する差の二乗平均平方根(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)(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"
      }
    }
  ]
}

血中酸素ウェルネス

API は、oxygen-saturation(1 日のサンプル値)と daily-oxygen-saturation(1 日の概要統計情報)を使用して酸素レベルをトラッキングします。濃度は 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: 測定部位(ARMPITEARFOREHEAD など)とともに、内臓の温度を摂氏で記録します。
  • 睡眠時の体温の変動(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_RHYTHMATRIAL_FIBRILLATIONINCONCLUSIVE)、平均心拍数、サンプリング周波数、未加工の波形電圧サンプルを含む、単一誘導心電図セッションの結果。
  • 不整脈の通知(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_measurementsecg などのスコープが必要な理由を説明します。