The Health Service Kit cloud provides a subscription mechanism which notifies your app of user data changes in real time, ensuring that your app can always obtain the latest data.
Use an enterprise developer account to register the subscription notification capability. Individual accounts are not supported.
Currently, Health Service Kit provides the following types of events for you to subscribe to:

Your app will be notified of user data changes in real time. In this way, the user data of your app is always up to date. The procedure is as follows:
| Role/Component | Description |
|---|---|
| Subscriber | The app is the subscriber. When the user data changes, Health Service Kit notifies the callback address of the app's server. The subscriber is uniquely identified by a subscriber ID. |
| Event | User activity events, including authorization cancellation, exercise record change (update or deletion), change of atomic data (update or deletion), and more. |
| Subscription record | Records the mappings between subscribers, users, and user events that subscribers listen for. The subscription record is uniquely identified by a subscription ID. |
| Notification | Health Service Kit sends a notification to the subscriber's callback address to notify the subscriber of changes of the user event. |
| Event Type (type) | Event Subtype (subType) | Event Type ID (eventType) | Description | Metadata |
|---|---|---|---|---|
| USER_EVENT User account event | REVOKE_ALL | USER_EVENT$REVOKE_ALL | The user cancels the authorization. | None. |
| DELETE_USER | USER_EVENT$DELETE_USER | The user deletes the account. | ||
| REFRESH_TOKEN_INVALID | ||||
| ACTIVITY_RECORD_EVENT User exercise record event | UPDATE | ACTIVITY_RECORD_EVENT$UPDATE | The user adds/updates an exercise record. | metaKey:
|
| DELETE | ACTIVITY_RECORD_EVENT$DELETE | The user deletes an exercise record. | metaKey:
| |
| SAMPLESET_EVENT Sampling data event | UPDATE | SAMPLESET_EVENT$UPDATE${DATATYPE} | The user adds/updates the sampling data. | metaKey:
|
| DELETE | SAMPLESET_EVENT$DELETE${DATATYPE} | The user deletes the sampling data. | metaKey:
| |
| HEALTH_RECORD_EVENT Health record event | UPDATE | HEALTH_RECORD_EVENT$UPDATE${DATATYPE} | The user adds/updates a health record. | metaKey:
|
| DELETE | HEALTH_RECORD_EVENT$DELETE${DATATYPE} | The user deletes a health record. | metaKey:
| |
| SCENARIO_GOAL_EVENT Scenario-based goal event | ACHIEVE | SCENARIO_GOAL_EVENT$ACHIEVE | The user achieves a goal. | metaKey:
|
| DEVICE_EVENT GPRS device event | BIND | DEVICE_EVENT$BIND | The user binds a device. | metaKey: deviceCode: device binding code. |
| UNBIND | DEVICE_EVENT$UNBIND | The user unbinds a device. | ||
| CONNECTION_VERIFY_EVENT Connectivity test event | VERIFY | CONNECTION_VERIFY_EVENT$VERIFY | A test is performed to check the callback URL connectivity. | None. |
| SAMPLE_CONFIG_EVENT Configuration update event | UPDATE | SAMPLE_CONFIG_EVENT$UPDATE | The configuration is updated. | metaKey:
|
| HEALTH_ALARM_EVENT Health alert event | ATRIAL_PREMATURE_BEAT | HEALTH_ALARM_EVENT$ATRIAL_PREMATURE_BEAT | An atrial premature beat alert event occurs. | metaKey:
|
| VENTRICULAR_PREMATURE_BEAT | HEALTH_ALARM_EVENT$VENTRICULAR_PREMATURE_BEAT | A ventricular premature beat alert event occurs. | metaKey:
| |
| ATRIAL_FIBRILLATION | HEALTH_ALARM_EVENT$ATRIAL_FIBRILLATION | An atrial fibrillation alert event occurs. | metaKey:
| |
| TACHYCARDIA | HEALTH_ALARM_EVENT$TACHYCARDIA | A tachycardia alert event occurs. | metaKey:
| |
| BRADYCARDIA | HEALTH_ALARM_EVENT$BRADYCARDIA | A bradycardia alert event occurs. | metaKey:
| |
| LOW_SPO2 | HEALTH_ALARM_EVENT$LOW_SPO2 | A low SpO2 alert event occurs. | metaKey:
| |
| HYPERTHERMIA | HEALTH_ALARM_EVENT$HYPERTHERMIA | A high body temperature alert event occurs. | metaKey:
| |
| HYPOTHERMIA | HEALTH_ALARM_EVENT$HYPOTHERMIA | A low body temperature alert event occurs. | metaKey:
|
Currently, health alert events are only available to certain developers. If you have any interest, submit a ticket or send an email to hihealth@huawei.com to learn more information.
| Event Type | Data Type | Activity Type/Data Type | Description |
|---|---|---|---|
| User exercise record event | Exercise record | ||
| Sampling data event | Personal information sampling data | com.huawei.instantaneous.body_weight | Weight. |
| Health sampling data | com.huawei.instantaneous.blood_glucose | Blood glucose. | |
| com.huawei.instantaneous.blood_pressure | Blood pressure. | ||
| com.huawei.instantaneous.spo2 | SpO2 | ||
| com.huawei.instantaneous.heart_rate | Heart rate. | ||
| com.huawei.instantaneous.resting_heart_rate | Resting heart rate. | ||
| com.huawei.instantaneous.stress | Stress. | ||
| com.huawei.instantaneous.skin.temperature | Skin temperature. | ||
| com.huawei.sleep.on_off_bed_record | Getting in and out of bed record. | ||
| com.huawei.instantaneous.body.temperature | Body temperature. | ||
| Activity sampling data | com.huawei.continuous.steps.delta | Steps. | |
| com.huawei.continuous.distance.delta | Distance. | ||
| com.huawei.continuous.calories.burnt | Calories burned. | ||
| com.huawei.continuous.exercise_intensity.v2 | Moderate to high intensity. | ||
| Activity statistics | com.huawei.continuous.steps.total | Total number of steps. | |
| com.huawei.continuous.distance.total | Total distance. | ||
| com.huawei.continuous.calories.burnt.total | Calorie statistics. | ||
| com.huawei.continuous.exercise_intensity.v2.statistics | Moderate to high intensity statistics. | ||
| Health record event | Health record data | com.huawei.continuous.ecg_record | ECG measurement records. |
| com.huawei.health.record.sleep | Sleep records. | ||
| com.huawei.health.record.menstrual_cycle | Menstrual cycle data. | ||
| com.huawei.health.record.tachycardia | Tachycardia data. | ||
| com.huawei.health.record.bradycardia | Bradycardia data. | ||
| com.huawei.health.record.dynamic_bp | Ambulatory blood pressure monitoring (ABPM) |
Currently, total step count is supported by SCENARIO_GOAL_EVENT.
| Data Type | Description | Supported Goal Type |
|---|---|---|
| com.huawei.continuous.steps.total | Total step count. | Measurement goal: MetricGoal Duration goal: DurationGoal |
| Data Type | Description | Application Scenario |
|---|---|---|
| com.huawei.continuous.ecg_record | ECG measurement records. | If you only want to query ECG exception events, select the health alert event corresponding to ECG exceptions. |
| com.huawei.health.record.tachycardia | Tachycardia. | Only available for certain developers. For details, please refer to Tachycardia and Bradycardia. |
| com.huawei.health.record.bradycardia | Bradycardia. | |
| com.huawei.health.record.lowSpo2Alert | Low SpO2 level. | Only available for certain developers. For details, please refer to Low SpO2 Level Data. |
| com.huawei.health.record.hyperthermia | High body temperature | Only available for certain developers. For details, please refer to high body temperature data. |
When applying for Health Service Kit on HUAWEI Developers, select a product you have created, and select Registering the Subscription Notification Capability. You can select the HTTP subscription mode, and then specify a callback address and test the connectivity of the callback address.

If you select HTTP subscription mode, you can add multiple callback addresses and assign labels (for example, test environment or production environment) to them. Then the subscriber ID corresponding to each callback URL is generated. Each user can be associated with only one subscriber ID when you create subscription records for them.

For details about the HTTP request, please refer to the API for Adding/Updating a Subscription Record.
POST https://health-api.cloud.huawei.com/healthkit/v2/subscriptions
Request example
POST https://health-api.cloud.huawei.com/healthkit/v2/subscriptions
Request body
POST
https://health-api.cloud.huawei.com/healthkit/v2/subscriptions
Content-Type: application/json
Authorization: Bearer ***
x-client-id: ***
x-version: ***
x-caller-trace-id: ***
{
"subscriberId": "08666998-78f6-46b9-8620-faa06cdbac2b",
"eventTypes": [
// Subscribe to exercise record update events.
{
"type": "ACTIVITY_RECORD_EVENT",
"subType": "UPDATE",
"eventType": "ACTIVITY_RECORD_EVENT$UPDATE"
},
// Subscribe to exercise record deletion events.
{
"type": "ACTIVITY_RECORD_EVENT",
"subType": "DELETE",
"eventType": "ACTIVITY_RECORD_EVENT$DELETE"
},
// Subscribe to sampling data update events. Here weight data is taken as an example.
{
"type": "SAMPLESET_EVENT",
"subType": "UPDATE",
"eventType": "SAMPLESET_EVENT$UPDATE$com.huawei.instantaneous.body_weight"
},
// Subscribe to health record update events. Here sleep record data is taken as an example.
{
"type": "HEALTH_RECORD_EVENT",
"subType": "UPDATE",
"eventType": "HEALTH_RECORD_EVENT$UPDATE$com.huawei.health.record.sleep"
}
]
} Response body
HTTP/1.1 200 OK
Content-type: application/json;charset=utf-8
[
{
"appId": "101524371",
"eventType": "ACTIVITY_RECORD_EVENT$UPDATE",
"subscriberId": "a2613ab0-19d8-4126-b18f-7779405b5992",
"subscriptionId": "0924d8d1-6d4a-4f81-99b9-b96b1a0c970c",
"goalInfo": "null",
"alarmThreshold": "null",
"subscriptionMode": 0,
"type": "ACTIVITY_RECORD_EVENT",
"subType": "UPDATE",
"openId": "MDFAMTAxNTI0MzcxQGQ0Y2M3N2UxZTVmNjcxNWFkMWQ5Y2JjYjlmZDZiaNTY3QDVhNmNkY2FiaMTFhYzc4NDk4NDI0MzJiaNjg0MzViaYmUyMGEzZjZkNzUzYWVjM2Q5ZTgwYWM5NTgzNmY"
},
{
"appId": "101524371",
"eventType": "ACTIVITY_RECORD_EVENT$DELETE",
"subscriberId": "a2613ab0-19d8-4126-b18f-7779405b5992",
"subscriptionId": "641eeec8-a9c1-4c4c-9789-4963b92a6c46",
"goalInfo": "null",
"alarmThreshold": "null",
"subscriptionMode": 0,
"type": "ACTIVITY_RECORD_EVENT",
"subType": "DELETE",
"openId": "MDFAMTAxNTI0MzcxQGQ0Y2M3N2UxZTVmNjcxNWFkMWQ5Y2JjYjlmZDZiaNTY3QDVhNmNkY2FiaMTFhYzc4NDk4NDI0MzJiaNjg0MzViaYmUyMGEzZjZkNzUzYWVjM2Q5ZTgwYWM5NTgzNmY"
},
{
"appId": "101524371",
"eventType": "SAMPLESET_EVENT$UPDATE$com.huawei.instantaneous.body_weight",
"subscriberId": "a2613ab0-19d8-4126-b18f-7779405b5992",
"subscriptionId": "536sfgc8-a6c1-3tt5c-9369-2643b92g7g46",
"goalInfo": "null",
"alarmThreshold": "null",
"subscriptionMode": 0,
"type": "SAMPLESET_EVENT",
"subType": "UPDATE",
"openId": "MDFAMTAxNTI0MzcxQGQ0Y2M3N2UxZTVmNjcxNWFkMWQ5Y2JjYjlmZDZiaNTY3QDVhNmNkY2FiaMTFhYzc4NDk4NDI0MzJiaNjg0MzViaYmUyMGEzZjZkNzUzYWVjM2Q5ZTgwYWM5NTgzNmY"
},
{
"appId": "101524371",
"eventType": "HEALTH_RECORD_EVENT$UPDATE$com.huawei.health.record.sleep",
"subscriberId": "a2613ab0-19d8-4126-b18f-7779405b5992",
"subscriptionId": "138sfdc8-a6c1-7yt5c-9759-26e33dhh5g67",
"goalInfo": "null",
"alarmThreshold": "null",
"subscriptionMode": 0,
"type": "HEALTH_RECORD_EVENT",
"subType": "UPDATE",
"openId": "MDFAMTAxNTI0MzcxQGQ0Y2M3N2UxZTVmNjcxNWFkMWQ5Y2JjYjlmZDZiaNTY3QDVhNmNkY2FiaMTFhYzc4NDk4NDI0MzJiaNjg0MzViaYmUyMGEzZjZkNzUzYWVjM2Q5ZTgwYWM5NTgzNmY"
}
] Notes on processing event notifications:
For details about the HTTP request, please refer to the API for subscribing to event notifications.
POST https://www.example.com/healthkit/notifications
Request example
POST https://www.example.com/healthkit/notifications
Request body
POST
https://www.example.com/healthkit/notifications
Content-Type: application/json
x-notification-signature: ***
{
"eventTime":1607514090688,
"eventType":"ACTIVITY_RECORD_EVENT$UPDATE",
"metaData":[
{
"metaKey":"startTime",
"metaValue":"1606856007879" // Start time of the data update.
},
{
"metaKey":"endTime",
"metaValue":"1606916007879" // End time of the data update.
},
{
"metaKey":"activityType", // Data type of the data update.
"metaValue":"1"
}
],
"openId":"MDFAMTAxNTI0MzcxQGQ0Y2M3N2UxZTVmNjcxNWFkMWQ5Y2JjYjlmZDZiaNTY3QDVhNmNkY2FiaMTFhYzc4NDk4NDI0MzJiaNjg0MzViaYmUyMGEzZjZkNzUzYWVjM2Q5ZTgwYWM5NTgzNmY"
} Response body
HTTP/1.1 204 No Content Content-type: application/json;charset=utf-8
Obtain data from the Health Service Kit server based on the pushed notifications. For details, please refer to Step Count Statistics of Multiple Days or Reading Running Data.
For details about the HTTP request, please refer to the API for creating/updating subscription records.
POST https://health-api.cloud.huawei.com/healthkit/v2/subscriptions
Request example
POST https://health-api.cloud.huawei.com/healthkit/v2/subscriptions
Request body
POST
https://health-api.cloud.huawei.com/healthkit/v2/subscriptions
Content-Type: application/json
Authorization: Bearer ***
x-client-id: ***
x-version: ***
x-caller-trace-id: ***
{
"subscriberId": "08666998-78f6-46b9-8620-faa06cdbac2b",
"eventTypes": [
{
"type": "SCENARIO_GOAL_EVENT",
"subType": "ACHIEVE",
"eventType": "SCENARIO_GOAL_EVENT$ACHIEVE",
"goalInfo": {
"createTime": 1654660859105,
"startDay": 20220608, // Start date of a goal. Note that the start date must be later than the date on which the goal is created.
"recurrence": {
"unit": 1, // Period unit: day
"count": 30, // An entire period is 30 days.
"expectedAchievedCount": 28
},
"goals": [
{
"goalType": 1,
"metricGoal": {
"value": 10000, // Set the goal to 10,000 steps.
"fieldName": "steps",
"dataType": "com.huawei.continuous.steps.total"
}
}
]
}
}
]
} Response body
HTTP/1.1 200 OK
Content-type: application/json;charset=utf-8
[
{
"appId": "101524371",
"eventType": "SCENARIO_GOAL_EVENT$ACHIEVE",
"subscriberId": "1b57117f-8a7a-4584-b90e-149039216af6",
"subscriptionId": "3a82f885-97bf-47f8-84d1-21e558fe6e99",
"openId": "MDFAMTAxNTI0MzcxQGQ0Y2M3N2UxZTVmNjcxNWFkMWQ5Y2JjYjlmZDZiaNTY3QDVhNmNkY2FiaMTFhYzc4NDk4NDI0MzJiaNjg0MzViaYmUyMGEzZjZkNzUzYWVjM2Q5ZTgwYWM5NTgzNmY",
"goalInfo": "{\"createTime\":1654660859105,\"goals\":[{\"goalType\":1,\"metricGoal\":{\"dataType\":\"com.huawei.continuous.steps.total\",\"fieldName\":\"steps\",\"value\":10000.0}}],\"recurrence\":{\"count\":30,\"expectedAchievedCount\":28,\"unit\":1},\"startDay\":20220608}",
"alarmThreshold": "null",
"subscriptionMode": 0,
"type": "SCENARIO_GOAL_EVENT",
"subType": "ACHIEVE"
}
] Notes on processing event notifications:
For details about the HTTP request, please refer to the API for subscribing to event notifications.
POST https://www.example.com/healthkit/notifications
Request example
POST https://www.example.com/healthkit/notifications
Request body
POST
https://www.example.com/healthkit/notifications
Content-Type: application/json
x-notification-signature: ***
[{
"appId": "101524371",
"subscriptionId": "3a82f885-97bf-47f8-84d1-21e558fe6e99",
"periodIndex": 0,
"periodStartDay": 20220608,
"periodEndDay": 20220608,
"goalAchieve": [{
"goalType": 1,
"metricGoal": {
"value": 10000.0,
"fieldName": "steps",
"dataType": "com.huawei.continuous.steps.total"
},
"achievedFlag": true // Goal achieved.
}
]
} HTTP/1.1 204 No Content Content-type: application/json;charset=utf-8
For details about the HTTP request, please refer to Querying Scenario-Based Event Results.
GET https://health-api.cloud.huawei.com/healthkit/v2/subscriptions/3a82f885-97bf-47f8-84d1-21e558fe6e99/achievedRecord
Request example
GET https://health-api.cloud.huawei.com/healthkit/v2/subscriptions/3a82f885-97bf-47f8-84d1-21e558fe6e99/achievedRecord
Request body
None.
HTTP/1.1 200 OK
Content-type: application/json;charset=utf-8
[
{
"openId": "MDFAMTAxNTI0MzcxQGQ0Y2M3N2UxZTVmNjcxNWFkMWQ5Y2JjYjlmZDZiaNTY3QDVhNmNkY2FiaMTFhYzc4NDk4NDI0MzJiaNjg0MzViaYmUyMGEzZjZkNzUzYWVjM2Q5ZTgwYWM5NTgzNmY",
"appId": "101524371",
"subscriptionId": "3a82f885-97bf-47f8-84d1-21e558fe6e99",
"periodIndex": 0,
"periodStartDay": 20220608,
"periodEndDay": 20220608,
"goalAchieve": [{
"goalType": 1,
"metricGoal": {
"value": 10000.0, // Target value.
"fieldName": "steps",
"dataType": "com.huawei.continuous.steps.total"
},
"achievedResult": "20023", // Actual value.
"achievedFlag": true // Flag indicating that the goal is achieved.
}]
},
{
"openId": "MDFAMTAxNTI0MzcxQGQ0Y2M3N2UxZTVmNjcxNWFkMWQ5Y2JjYjlmZDZiaNTY3QDVhNmNkY2FiaMTFhYzc4NDk4NDI0MzJiaNjg0MzViaYmUyMGEzZjZkNzUzYWVjM2Q5ZTgwYWM5NTgzNmY",
"appId": "101524371",
"subscriptionId": "3a82f885-97bf-47f8-84d1-21e558fe6e99",
"periodIndex": 1,
"periodStartDay": 20220609,
"periodEndDay": 20220609,
"goalAchieve": [{
"goalType": 1,
"metricGoal": {
"value": 10000.0, // Target value.
"fieldName": "steps",
"dataType": "com.huawei.continuous.steps.total"
},
"achievedResult": "9800", // Actual value.
"achievedFlag": false // Flag indicating that the goal is not achieved.
}]
}
]