The Google Health API allows your application to receive notifications when a user's health data changes. Instead of polling for changes, your server receives an HTTPS POST request webhook as soon as data is available in the Google Health API.
This guide explains how to configure IAM permissions, register and verify subscriber endpoints, and manage automatic or manual user subscriptions. To learn about notification payload formats, response handling, signature verification, and delivery best practices, see Notifications.
Supported data types
Webhook notifications are supported for the following data types:
| Data type | Available operations |
Scope |
|---|---|---|
|
Active Minutes
dataType:
active-minutesfilter parameter: active_minutes
Record type: Interval
Storage resolution: 1 minute
Webhook support
Identifier support
Compatible devices
|
list, reconcile, rollup, dailyRollup | .activity_and_fitness.readonly |
|
Active Zone Minutes
dataType:
active-zone-minutesfilter parameter: active_zone_minutes
Record type: Interval
Storage resolution: 1 minute
Webhook support
Identifier support
Compatible devices
|
list, reconcile, rollup, dailyRollup | .activity_and_fitness.readonly |
|
Activity Level
dataType:
activity-levelfilter parameter: activity_level
Record type: Interval
Webhook support
Identifier support
|
list, reconcile | .activity_and_fitness.readonly |
|
Altitude
|
list, reconcile, rollup, dailyRollup | .activity_and_fitness.readonly |
|
Blood Glucose
dataType:
blood-glucosefilter parameter: blood_glucose
Record type: Sample
|
list, get, reconcile, rollup, dailyRollup | .health_metrics_and_measurements.readonly |
|
Body Fat
dataType:
body-fatfilter parameter: body_fat
Record type: Sample
Webhook support
Identifier support
Compatible devices
|
list, get, reconcile, rollup, dailyRollup, create, update, batchDelete | .health_metrics_and_measurements.readonly.health_metrics_and_measurements.writeonly |
|
Calories In Heart Rate Zone
dataType:
calories-in-heart-rate-zonefilter parameter: calories_in_heart_rate_zone
Record type: Interval
Storage resolution: 1 minute
Webhook support
Identifier support
|
rollup, dailyRollup | .activity_and_fitness.readonly |
|
Daily Heart Rate Variability
dataType:
daily-heart-rate-variabilityfilter parameter: daily_heart_rate_variability
Record type: Daily
Compatible devices
|
list, reconcile | .health_metrics_and_measurements.readonly |
|
Daily Heart Rate Zones
dataType:
daily-heart-rate-zonesfilter parameter: daily_heart_rate_zones
Record type: Daily
|
list, reconcile | .health_metrics_and_measurements.readonly |
|
Daily Oxygen Saturation
dataType:
daily-oxygen-saturationfilter parameter: daily_oxygen_saturation
Record type: Daily
Compatible devices
|
list, reconcile | .health_metrics_and_measurements.readonly |
|
Daily Respiratory Rate
dataType:
daily-respiratory-ratefilter parameter: daily_respiratory_rate
Record type: Daily
Compatible devices
|
list, reconcile | .health_metrics_and_measurements.readonly |
|
Daily Resting Heart Rate
dataType:
daily-resting-heart-ratefilter parameter: daily_resting_heart_rate
Record type: Daily
Compatible devices
|
list, reconcile | .health_metrics_and_measurements.readonly |
|
Daily Sleep Temperature Derivations
dataType:
daily-sleep-temperature-derivationsfilter parameter: daily_sleep_temperature_derivations
Record type: Daily
Compatible devices
|
list, reconcile | .health_metrics_and_measurements.readonly |
|
Distance
dataType:
distancefilter parameter: distance
Record type: Interval
Storage resolution: 1 minute
Compatible devices
|
list, reconcile, rollup, dailyRollup | .activity_and_fitness.readonly |
|
Exercise
dataType:
exercisefilter parameter: exercise
Record type: Session
Compatible devices
|
list, get, reconcile, create, update, batchDelete | .activity_and_fitness.readonly.activity_and_fitness.writeonly |
|
Floors
dataType:
floorsfilter parameter: floors
Record type: Interval
Storage resolution: 1 minute
Compatible devices
|
reconcile, rollup, dailyRollup | .activity_and_fitness.readonly |
|
Heart Rate
dataType:
heart-ratefilter parameter: heart_rate
Record type: Sample
Storage resolution: 1 second
Compatible devices
|
list, reconcile, rollup, dailyRollup | .health_metrics_and_measurements.readonly |
|
Heart Rate Notification
v4beta
dataType:
heart-rate-notificationfilter parameter: heart_rate_notification
Record type: Interval
|
list, get | .health_metrics_and_measurements.readonly |
|
Heart Rate Variability
dataType:
heart-rate-variabilityfilter parameter: heart_rate_variability
Record type: Sample
Compatible devices
|
list, reconcile | .health_metrics_and_measurements.readonly |
|
Height
|
list, get, reconcile, create, update, batchDelete | .health_metrics_and_measurements.readonly.health_metrics_and_measurements.writeonly |
|
Hydration Log
dataType:
hydration-logfilter parameter: hydration_log
Record type: Session
Webhook support
Identifier support
|
list, get, reconcile, rollup, dailyRollup, create, update, batchDelete | .nutrition.readonly.nutrition.writeonly |
|
Mindfulness Session
v4beta
dataType:
mindfulness-sessionfilter parameter: mindfulness_session
Record type: Session
|
list, get, reconcile, rollup, dailyRollup | .mindfulness.readonly — all fields except heartRateSummary.mindfulness.readonly + .health_metrics_and_measurements.readonly — all fields
|
|
Nutrition Log
dataType:
nutrition-logfilter parameter: nutrition_log
Record type: Session
|
list, get, reconcile, rollup, dailyRollup, create, update, batchDelete | .nutrition.readonly.nutrition.writeonly |
|
Respiratory Rate Sleep Summary
dataType:
respiratory-rate-sleep-summaryfilter parameter: respiratory_rate_sleep_summary
Record type: Sample
Compatible devices
|
list, reconcile | .health_metrics_and_measurements.readonly |
|
Run VO2 Max
dataType:
run-vo2-maxfilter parameter: run_vo2_max
Record type: Sample
Webhook support
Identifier support
Compatible devices
|
list, reconcile, rollup, dailyRollup | .activity_and_fitness.readonly |
|
Running Vertical Oscillation
v4beta
dataType:
running-vertical-oscillationfilter parameter: running_vertical_oscillation
Record type: Sample
Compatible devices |
list, reconcile, rollup, dailyRollup | .activity_and_fitness.readonly |
|
Sedentary Period
dataType:
sedentary-periodfilter parameter: sedentary_period
Record type: Interval
Webhook support
Identifier support
Compatible devices
|
list, reconcile, rollup, dailyRollup | .activity_and_fitness.readonly |
|
Sleep
dataType:
sleepfilter parameter: sleep
Record type: Session
Compatible devices
|
list, get, reconcile, create, update, batchDelete | .sleep.readonly.sleep.writeonly |
|
Speed
v4beta |
list, reconcile, rollup, dailyRollup | .activity_and_fitness.readonly |
|
Step Cadence
v4beta |
list, reconcile, rollup, dailyRollup | .activity_and_fitness.readonly |
|
Steps
dataType:
stepsfilter parameter: steps
Record type: Interval
Storage resolution: 1 minute
Compatible devices
|
list, reconcile, rollup, dailyRollup | .activity_and_fitness.readonly |
|
Stride Length
v4beta |
list, reconcile, rollup, dailyRollup | .activity_and_fitness.readonly |
|
Time in Heart Rate Zone
dataType:
time-in-heart-rate-zonefilter parameter: time_in_heart_rate_zone
Record type: Interval
Storage resolution: 1 minute
Webhook support
Identifier support
|
list, reconcile, rollup, dailyRollup | .activity_and_fitness.readonly |
|
Weight
dataType:
weightfilter parameter: weight
Record type: Sample
Webhook support
Identifier support
Compatible devices
|
list, get, reconcile, rollup, dailyRollup, create, update, batchDelete | .health_metrics_and_measurements.readonly.health_metrics_and_measurements.writeonly |
Notifications scopes
Notifications are sent for these data types only when a user has granted consent for one of the corresponding scopes:
- Activity, which covers active minutes, steps, altitude, distance, and
floors data types:
https://www.googleapis.com/auth/googlehealth.activity_and_fitness.readonlyhttps://www.googleapis.com/auth/googlehealth.activity_and_fitness.writeonly
- Health Metrics, which covers the weight data type:
https://www.googleapis.com/auth/googlehealth.health_metrics_and_measurements.readonlyhttps://www.googleapis.com/auth/googlehealth.health_metrics_and_measurements.writeonly
- Sleep, which covers the sleep data type:
https://www.googleapis.com/auth/googlehealth.sleep.readonlyhttps://www.googleapis.com/auth/googlehealth.sleep.writeonly
IAM service accounts
While not required, we recommend using an IAM Service Account when configuring subscribers for the Google Health API. Service accounts provide better security for application workloads compared to standard user accounts through the following features:
- Automated short-lived credentials: When attached to a Google Cloud execution environment (such as Compute Engine, Cloud Run, or Google Kubernetes Engine), service accounts automatically obtain and rotate secure, short-lived credentials. This removes the risks of managing and storing persistent static keys.
- Principle of least privilege: Service accounts provide dedicated identities for workloads. You can grant them only the specific permissions needed to manage subscriber endpoints, avoiding broader access to your Google Cloud resources.
- Lifecycle independence: Service accounts operate independently of any individual user's account, ensuring that personnel changes don't impact long-term authentication stability.
Set up a service account
To configure your subscriber application to authenticate using a service account:
- Create a service account: In the Google Cloud console, navigate to your project's IAM & Admin page to create a new user-managed service account.
- Grant necessary IAM roles: Assign the service account the appropriate roles required to manage subscribers on your Google Cloud project.
- Attach the service account to your workload: Configure the environment hosting your subscriber logic to run as the new service account.
This allows your application code (such as Google API client libraries) to
automatically detect and use the service account's short-lived credentials
when calling the
projects.subscribersREST API.
CPE roles
To manage Google Health API Subscribers or Subscriptions, you must grant the appropriate role to the impersonated Service Account making the API calls. Depending on the level of access needed, assign one of the following roles:
- Google Health API Read
- Google Health API Editor
- Google Health API Admin
Learn more about Google Health API IAM roles and permissions.
Manage subscribers
Before you can receive notifications, you must register a Subscriber, which
represents your application's notification endpoint. You can manage subscribers
using the REST API available at
projects.subscribers.
We recommend creating one subscriber per data type, especially for high-volume
data types such as steps, so that high-frequency updates are queued and
delivered independently from other data types. Multiple subscribers in your
project can share the same endpointUri webhook URL.
Your subscriber endpoint must use HTTPS (TLSv1.2+) and be publicly accessible.
During subscriber creation and updates, the Google Health API performs a
verification challenge to ensure you own the endpoint URI. If verification
fails, subscriber creation and update operations fail with a
FailedPreconditionException.
Create a subscriber
To register a new subscriber for your project, use the
create
endpoint. You need to provide:
project-id: The project number where the webhook service account was created.subscriberId: A unique identifier that you provide for the subscriber. This ID must be between 4 and 36 characters, and match the regular expression ([a-z]([a-z0-9-]{2,34}[a-z0-9])).endpointUri: The destination URL for webhook notifications.subscriberConfigs: The data types you want to receive notifications for, and the subscription policy for each.endpointAuthorization: The authorization mechanism for your endpoint. This must contain asecretthat you provide. The value ofsecretis sent in theAuthorizationheader with each notification message. You can use this token to verify that incoming requests are from the Google Health API. For example, you can setsecrettoBearer R4nd0m5tr1ng123for Bearer authentication, orBasic dXNlcjpwYXNzd29yZA==for Basic authentication.
In subscriberConfigs you must set subscriptionCreatePolicy for each data
type. Set it to AUTOMATIC to use automatic subscriptions, or MANUAL if you
intend to manage user subscriptions yourself. See
automatic subscriptions and
manual subscriptions for more details on each option.
This endpoint returns a synchronous
Operation resource with
done set to true wrapping the created Subscriber resource in response.
The endpointAuthorization object omits the secret value and sets
secretSet to true.
Request
POST https://health.googleapis.com/v4/projects/project-id/subscribers?subscriberId=subscriber-id
{
"endpointUri": "https://myapp.com/webhooks/health",
"subscriberConfigs": [
{
"dataTypes": ["steps", "altitude", "distance", "floors", "weight"],
"subscriptionCreatePolicy": "AUTOMATIC"
},
{
"dataTypes": ["sleep"],
"subscriptionCreatePolicy": "MANUAL"
}
],
"endpointAuthorization": {
"secret": "Bearer example-secret-token"
}
}Response
{
"name": "projects/project-id/operations/operation-id",
"metadata": {
"@type": "type.googleapis.com/google.devicesandservices.health.v4.CreateSubscriberMetadata"
},
"done": true,
"response": {
"@type": "type.googleapis.com/google.devicesandservices.health.v4.Subscriber",
"name": "projects/project-id/subscribers/subscriber-id",
"endpointUri": "https://myapp.com/webhooks/health",
"subscriberConfigs": [
{
"dataTypes": ["steps", "altitude", "distance", "floors", "weight"],
"subscriptionCreatePolicy": "AUTOMATIC"
},
{
"dataTypes": ["sleep"],
"subscriptionCreatePolicy": "MANUAL"
}
],
"endpointAuthorization": {
"secretSet": true
},
"state": "ACTIVE"
}
}List subscribers
Use the list endpoint
to retrieve all subscribers registered for your project.
Request
GET https://health.googleapis.com/v4/projects/project-id/subscribers
Response
{
"subscribers": [
{
"name": "projects/project-id/subscribers/subscriber-id",
"endpointUri": "https://myapp.com/webhooks/health",
"subscriberConfigs": [
{
"dataTypes": ["steps", "altitude", "distance", "floors", "weight"],
"subscriptionCreatePolicy": "AUTOMATIC"
},
{
"dataTypes": ["sleep"],
"subscriptionCreatePolicy": "MANUAL"
}
],
"endpointAuthorization": {
"secretSet": true
},
"state": "ACTIVE"
}
],
"totalSize": 1
}Update a subscriber
Use the patch endpoint
to update a subscriber in your project. The fields that can be updated are
endpointUri, subscriberConfigs, and endpointAuthorization.
You update fields by providing an updateMask query parameter and a request
body. The updateMask must contain a comma-separated list of field names that
you want to update, using camel case for field names
(for example, endpointUri). The request body must contain a partial Subscriber
object with the new values for fields you want to update. Only fields specified
in updateMask are updated. If you provide fields in the request body that are
not in updateMask, they are ignored.
If you update endpointUri or endpointAuthorization, endpoint verification is
performed. See Endpoint verification for details.
When updating subscriberConfigs, note that it's a full replacement, not a
merge. If subscriberConfigs is included in updateMask, all stored
configurations for that subscriber are overwritten with list provided in request
body. To add or remove a configuration, you must provide the complete set of
configurations. If you are updating other fields and want to keep your current
configurations, omit subscriberConfigs from updateMask.
Like create, this endpoint returns a synchronous
Operation resource wrapping
the updated Subscriber resource with endpointAuthorization.secretSet set to
true.
Request
PATCH https://health.googleapis.com/v4/projects/project-id/subscribers/subscriber-id?updateMask=endpointUri
{
"endpointUri": "https://myapp.com/new-webhooks/health"
}Response
{
"name": "projects/project-id/operations/operation-id",
"done": true,
"response": {
"@type": "type.googleapis.com/google.devicesandservices.health.v4.Subscriber",
"name": "projects/project-id/subscribers/subscriber-id",
"endpointUri": "https://myapp.com/new-webhooks/health",
"subscriberConfigs": [
{
"dataTypes": ["steps", "altitude", "distance", "floors", "weight"],
"subscriptionCreatePolicy": "AUTOMATIC"
},
{
"dataTypes": ["sleep"],
"subscriptionCreatePolicy": "MANUAL"
}
],
"endpointAuthorization": {
"secretSet": true
},
"state": "ACTIVE"
}
}Delete a subscriber
Use the delete
endpoint to remove a subscriber from your project. Once deleted, the subscriber
no longer receives notifications.
Request
DELETE https://health.googleapis.com/v4/projects/project-id/subscribers/subscriber-id
Response
{
"name": "projects/project-id/operations/operation-id",
"done": true,
"response": {
"@type": "type.googleapis.com/google.protobuf.Empty"
}
}Endpoint verification
To ensure the security and reliability of your notification delivery, the Google
Health API performs a mandatory two-step verification handshake whenever you
create a subscriber or update its endpoint configuration (endpointUri or
endpointAuthorization). This process is performed synchronously during the
API call. The service sends two automated POST requests to your endpoint URI,
using the User-Agent Google-Health-API-Webhooks, with the JSON body
{"type": "verification"}.
- Authorized Handshake: The first request is sent with your configured
Authorizationheader. Your server must respond with a200 OKor201 Createdstatus. - Unauthorized Challenge: The second request is sent without credentials.
Your server must respond with a
401 Unauthorizedor403 Forbiddenstatus.
This handshake confirms that your endpoint is active and correctly enforcing
security. If either step fails, the API request fails with a
FAILED_PRECONDITION error. Only after this handshake succeeds is your
subscriber saved and activated to receive health data notifications.
Key rotation
If you need to rotate keys for endpointAuthorization, follow these steps:
- Configure your endpoint to accept both old and new
endpointAuthorizationvalues. - Update the subscriber configuration with new
endpointAuthorizationvalue using apatchrequest with?updateMask=endpointAuthorization. - Configure your endpoint to accept only new
endpointAuthorizationvalue after confirming step 2 was successful.
User subscriptions
The Google Health API helps you manage user subscriptions efficiently, reducing the need for manual registration during user onboarding.
Automatic subscriptions
We recommend using automatic subscriptions. To enable this feature, set
subscriptionCreatePolicy to AUTOMATIC in your subscriberConfigs for the
specific data types. The dataTypes you specify with an AUTOMATIC policy are
the same data types for which the Google Health API sends notifications,
provided user consent is also granted for those data types.
When a user grants application consent for scopes that correspond to data
types with an AUTOMATIC policy, the Google Health API automatically tracks and
sends out notifications for the data types resulting from the intersection
between user consented data types and the automatic subscriber config data types
for that user. Notifications are then sent to your endpoint
whenever that user generates new data for those types. This works for users who
grant consent either before or after you create the subscriber. Notifications
are not backfilled for data generated before the subscriber was created.
If a user revokes consent, notifications for the corresponding data types will stop. Automatic subscriptions are managed by Google and cannot be listed or deleted individually; they are removed only when the parent subscriber is deleted.
Manual subscriptions
If your subscriber is configured with a MANUAL subscriptionCreatePolicy for
specific data types, you must explicitly create and manage subscriptions for
each user. A subscription links a specific user to your subscriber endpoint for
a defined set of data types:
- Use the
createendpoint to create a manual subscription for a specifichealthUserId. This method requires the subscriber to havesubscriptionCreatePolicyset toMANUALfor the requested data types. - Use the
patchendpoint to update the data types for an existing user subscription. - Use the
deleteendpoint to delete a specific user subscription. Once deleted, your subscriber endpoint no longer receives notifications for this user for the associated data types. - Use the
listendpoint to list all active manual subscriptions for a given subscriber. You can filter the results byuserordataType.
To list active manual subscriptions for a subscriber, send a GET request to
the list
endpoint:
Request
GET https://health.googleapis.com/v4/projects/project-id/subscribers/subscriber-id/subscriptions
Response
{
"subscriptions": [
{
"name": "projects/project-id/subscribers/subscriber-id/subscriptions/subscription-id",
"user": "users/health-user-id",
"dataTypes": [
"users/health-user-id/dataTypes/sleep"
]
}
]
}Subscriber status and recovery
When your endpoint times out, becomes unreachable, or returns an HTTP status code that triggers retries, the Google Health API retains pending notifications in the delivery queue for up to 24 hours and retries delivery with exponential backoff. For details on how the API handles each HTTP response, see Respond to a notification.
Once your endpoint recovers and responds with a status code below 400 (such
as 204), the API delivers the remaining queued messages. Notifications older
than 24 hours expire, are permanently discarded, and cannot be recovered.
Common errors
| Error code | Message | Description | Recommendation |
|---|---|---|---|
| 400 Bad Request | Invalid project number in resource name | When deleting or updating a subscriber using your Google Cloud project ID in the request URL instead of project number. This applies to webhook subscriptions using the projects.subscribers endpoint. |
Use your Google Cloud project number in the request URL, not the project ID. |
| 403 Forbidden | The caller does not have permission | When creating or listing subscribers using your Google Cloud project ID in the request URL instead of project number. This applies to webhook subscriptions using the projects.subscribers endpoint. |
Use your Google Cloud project number in the request URL, not the project ID. |