# Huawei Health Kit API to FHIR: Huawei Health data in your app

> Huawei Health Kit REST API: approval, 100-user cap, OAuth, endpoints and data types, and how to store steps, sleep and heart data as FHIR R4.

Source: https://developers.anpheros.com/guides/huawei-health-api

**Huawei Health Kit, now called Health Service Kit, has a REST API that gives your app a person's steps, heart rate, HRV, SpO₂, sleep and blood glucose from Huawei Health after they sign in with HUAWEI ID and approve your app. Access needs Huawei's manual review, and test scopes stop at 100 users until a separate verification. You can store each reading as a LOINC-coded FHIR R4 Observation with one standard API call. Anpheros does not connect to Huawei's cloud itself: your code reads Huawei Health Kit, and Anpheros keeps the record with the person's consent. Huawei's privacy statement says Huawei Health shares fitness and sleep data with Apple Health when the person allows it. Huawei does not document a sync to Health Connect.**

## Read Huawei Health data and store it in FHIR

First, step samples from Huawei Health Kit (a HUAWEI ID access token with the `https://www.huawei.com/healthkit/step.read` scope; times in milliseconds):

```bash
curl -X POST 'https://health-api.cloud.huawei.com/healthkit/v2/sampleSet:polymerize' \
  -H 'Content-Type: application/json' \
  -H "Authorization: Bearer $HUAWEI_TOKEN" \
  -H "x-client-id: $HUAWEI_APP_ID" \
  -d '{"polymerizeWith":[{"dataTypeName":"com.huawei.continuous.steps.delta"}],"startTime":1793491200000,"endTime":1793664000000}'
```

Then the day's steps as a FHIR Observation in the person's record (sandbox key `sk_test_…`):

```bash
curl -X POST https://platform.anpheros.com/fhir/R4/Observation \
  -H "Authorization: Bearer $ANPHEROS_KEY" \
  -H "Content-Type: application/fhir+json" \
  -H "X-Anpheros-Author-Type: device" \
  -d '{"resourceType":"Observation","status":"final",
       "category":[{"coding":[{"system":"http://terminology.hl7.org/CodeSystem/observation-category","code":"activity"}]}],
       "code":{"coding":[{"system":"http://loinc.org","code":"41950-7","display":"Number of steps in 24 hour Measured"}]},
       "subject":{"reference":"Patient/<id>"},
       "effectivePeriod":{"start":"2026-11-02","end":"2026-11-02"},
       "valueQuantity":{"value":9215,"unit":"{steps}","system":"http://unitsofmeasure.org","code":"{steps}"},
       "device":{"display":"Huawei Watch (via Huawei Health Kit)"}}'
```

The same in Python: steps per day, sent together in one transaction Bundle. The `x-health-app-privacy` response header tells you whether the person has granted access in the Huawei Health app.

```python
import os, requests

HUAWEI = "https://health-api.cloud.huawei.com/healthkit/v2"
FHIR = "https://platform.anpheros.com/fhir/R4"
huawei = {"Authorization": f"Bearer {os.environ['HUAWEI_TOKEN']}", "Content-Type": "application/json",
          "x-client-id": os.environ["HUAWEI_APP_ID"]}
fhir = {"Authorization": f"Bearer {os.environ['ANPHEROS_KEY']}", "Content-Type": "application/fhir+json"}

r = requests.post(f"{HUAWEI}/sampleSet:polymerize", headers=huawei, json={
    "polymerizeWith": [{"dataTypeName": "com.huawei.continuous.steps.delta"}],
    "startTime": 1793491200000, "endTime": 1793664000000})  # milliseconds, at most 30 days
if r.headers.get("x-health-app-privacy") != "1":  # 2 = not granted, 3 = not a Huawei Health user
    raise SystemExit("No access to this person's Huawei Health data")

def steps_per_day(huawei_json):
    """Return [("2026-11-01", 8412), ...]. Read the sample points as described in Huawei's polymerize reference."""
    raise NotImplementedError

entries = [{
    "request": {"method": "POST", "url": "Observation"},
    "resource": {
        "resourceType": "Observation", "status": "final",
        "category": [{"coding": [{"system": "http://terminology.hl7.org/CodeSystem/observation-category", "code": "activity"}]}],
        "code": {"coding": [{"system": "http://loinc.org", "code": "41950-7", "display": "Number of steps in 24 hour Measured"}]},
        "subject": {"reference": "Patient/<id>"},
        "effectivePeriod": {"start": day, "end": day},
        "valueQuantity": {"value": steps, "unit": "{steps}", "system": "http://unitsofmeasure.org", "code": "{steps}"},
        "device": {"display": "Huawei Watch (via Huawei Health Kit)"},
    },
} for day, steps in steps_per_day(r.json())]

r = requests.post(FHIR, headers=fhir, json={"resourceType": "Bundle", "type": "transaction", "entry": entries})
print(r.status_code, len(entries), "days saved")
```

And in JavaScript (Node 18+), sleep records (scope `https://www.huawei.com/healthkit/sleep.read`):

```js
const huawei = { Authorization: `Bearer ${process.env.HUAWEI_TOKEN}`, 'x-client-id': process.env.HUAWEI_APP_ID };
const fhir = { Authorization: `Bearer ${process.env.ANPHEROS_KEY}`, 'Content-Type': 'application/fhir+json' };

// Huawei's example uses 19-digit (nanosecond) timestamps; at most 31 days
const url = 'https://health-api.cloud.huawei.com/healthkit/v2/healthRecords'
  + '?startTime=1793491200000000000&endTime=1793664000000000000&dataType=com.huawei.health.record.sleep';
const json = await (await fetch(url, { headers: huawei })).json();

// Returns [{ start, end, minutes }, ...] from fall_asleep_time, wakeup_time and all_sleep_time.
// Where these sit in the JSON, and their units, are in Huawei's sleep record reference.
const readSleep = (json) => { throw new Error('map Huawei sleep records here'); };

for (const night of readSleep(json)) {
  await fetch('https://platform.anpheros.com/fhir/R4/Observation', {
    method: 'POST', headers: { ...fhir, 'X-Anpheros-Author-Type': 'device' },
    body: JSON.stringify({
      resourceType: 'Observation', status: 'final',
      category: [{ coding: [{ system: 'http://terminology.hl7.org/CodeSystem/observation-category', code: 'activity' }] }],
      code: { coding: [{ system: 'http://loinc.org', code: '93832-4', display: 'Sleep duration' }] },
      subject: { reference: 'Patient/<id>' },
      effectivePeriod: { start: night.start, end: night.end },
      valueQuantity: { value: night.minutes, unit: 'min', system: 'http://unitsofmeasure.org', code: 'min' },
      device: { display: 'Huawei Watch (via Huawei Health Kit)' },
    }),
  });
}
```

Paths, headers, data type names and sleep record fields (`all_sleep_time`, `fall_asleep_time`, `wakeup_time`) are from Huawei's Health Kit REST reference. The full response layout is in that reference, so the two mapping functions are left for you to fill in. The Anpheros side is standard FHIR R4, so the same requests work with any FHIR server.

## Ways to get Huawei Health data into FHIR

| Path | Status | What you need |
|---|---|---|
| Your backend reads Huawei Health Kit, then writes FHIR to Anpheros | **Works today** | Health Service Kit approval in the HUAWEI Developers Console (manual review, about 10 workdays), HUAWEI ID OAuth and the person's consent. Test scopes cover the first 100 users until verification. Individual developers get basic data only, for an app on AppGallery; advanced data is for enterprises |
| Huawei Health → Apple Health → your iPhone app reads HealthKit → Anpheros | **Works today** | Fitness and sleep data, according to Huawei's privacy statement; the exact types are not listed. HealthKit permissions. See [Apple Health to FHIR](https://developers.anpheros.com/guides/apple-health-fhir) |
| Huawei Health → Health Connect → your Android app → Anpheros | **Not available** | Not documented by Huawei |
| A direct Huawei connector inside Anpheros | **On our roadmap** | Not available yet. Use the button below to tell us you need it |

<!-- visual:cta-wear-huawei -->

## The Huawei Health Kit API in short

**Access.** Apply in the HUAWEI Developers Console under Health Service Kit, pick your data scopes and send the application materials (separate forms for individuals and enterprises). A person reviews it in about 10 workdays. Test scopes work for the first 100 users only. To lift the cap, apply for verification within a year, or the scopes may be revoked. Individual developers get only "basic openness" data, and only for a mobile app on AppGallery; "advanced openness" data is enterprise-only. Team member accounts cannot use the kit on their own. Huawei states no fee.

**History and regions.** By default your app reads only data created after the person authorized it. The scopes `historydata.open.week`, `historydata.open.month` and `historydata.open.year` reach back at most one year. Users are tied to a region: a request to the wrong site returns 403 with code 121001 and a `Location` header pointing to the right domain.

**Auth.** HUAWEI ID OAuth 2.0, authorization code flow. Authorize at `https://oauth-login.cloud.huawei.com/oauth2/v3/authorize` (`scope` must include `openid`; add `access_type=offline` for a refresh token), and exchange the code with `POST https://oauth-login.cloud.huawei.com/oauth2/v3/token`. The code lasts 5 minutes and works once. The access token lasts 1 hour. The refresh token lasts 180 days by default; when it expires, the token call returns code 1203. Scopes look like `https://www.huawei.com/healthkit/step.read`; others are `heartrate.read` (heart rate and HRV), `sleep.read`, `oxygensaturation.read` and `bloodglucose.read`, each with a `.write` twin.

| Call (base `https://health-api.cloud.huawei.com/healthkit/v2`) | What you get | Limits |
|---|---|---|
| `POST /sampleSet:polymerize` | detailed samples for up to 20 data types | milliseconds, at most 30 days, nothing before 1 January 2014 |
| `POST /sampleSet:dailyPolymerize` | per-day statistics, with a `timeZone` such as `+0800` | at most 31 days |
| `GET /sampleSets/latestSamplePoint?dataType=…` | the latest value | |
| `GET /healthRecords?startTime=&endTime=&dataType=` | sleep records and ECG records | at most 31 days |

Data type names: steps `com.huawei.continuous.steps.delta`, heart rate `com.huawei.instantaneous.heart_rate` (statistics: `com.huawei.continuous.heart_rate.statistics`), HRV `com.huawei.heart_rate_variability`, SpO₂ `com.huawei.instantaneous.spo2`, glucose `com.huawei.instantaneous.blood_glucose` and `com.huawei.cgm_blood_glucose`, sleep record `com.huawei.health.record.sleep`. Send `Content-Type` and `Authorization`; Huawei recommends `x-client-id`, `x-version` and `x-caller-trace-id` too. The `x-health-app-privacy` response header is 1 when access is granted, 2 when it is not, and 3 when the person does not use Huawei Health. Subscriptions notify you about updates, for example `SAMPLESET_EVENT$UPDATE$com.huawei.instantaneous.heart_rate`. Huawei publishes no numeric rate limit; data becomes available within minutes or hours, depending on the type. Only TLS 1.2 or later is accepted.

**Recent changes.** HRV and respiratory rate types arrived on 17 April 2025, together with new enterprise requirements. Sleep records gained heart rate, SpO₂ and HRV details on 9 June 2025. Baselines for heart rate, SpO₂, respiratory rate and HRV came on 6 December 2025. Strength training and pickleball types followed on 30 June 2026. The kit is now branded Health Service Kit and adds "Login-Free Authorization" for Android and iOS apps. HarmonyOS NEXT also has an on-device API, `healthService`.

Sources: [applying for Health Service Kit](https://developer.huawei.com/consumer/en/doc/hmscore-guides/apply-kitservice-0000001050707556), [verification](https://developer.huawei.com/consumer/en/doc/hmscore-guides/verification-0000001211786611), [historical data](https://developer.huawei.com/consumer/en/doc/hmscore-guides/historydata-open-0000001209921350), [OAuth example](https://developer.huawei.com/consumer/en/doc/hmscore-guides/auth-example-0000001054581058), [REST overview](https://developer.huawei.com/consumer/en/doc/HMSCore-References/rest-overview-0000001254420693), [polymerize](https://developer.huawei.com/consumer/en/doc/development/HMSCore-References/sampleset_polymerize_detailed-0000001050114864), [health records](https://developer.huawei.com/consumer/en/doc/HMSCore-References/get-health-record-by-datatype-0000001142843917), [version history](https://developer.huawei.com/consumer/en/doc/hmscore-guides/version-change-history-0000001233272401), [Huawei Health privacy statement](https://consumer.huawei.com/minisite/cloudservice/health/HKGroup/b0/latest/default/privacy-statement-en-us.htm), November 2026.

## Huawei Health data as FHIR Observations

| Huawei data type | LOINC | UCUM unit | Note |
|---|---|---|---|
| Steps (`com.huawei.continuous.steps.delta`) | 41950-7 | `{steps}` | one per day; sum the day or use `dailyPolymerize` |
| Heart rate (`com.huawei.instantaneous.heart_rate`) | 8867-4 | `/min` | daily average, minimum and maximum rather than every sample |
| SpO₂ (`com.huawei.instantaneous.spo2`) | 59408-5 | `%` | category vital-signs |
| Sleep (`com.huawei.health.record.sleep`, `all_sleep_time`) | 93832-4 | `min` | one per night |
| Deep and light sleep time (in the sleep record) | 93831-6, 93830-8 | `min` | check how Huawei defines its "dream" time before filing it as REM (93829-0) |
| Blood glucose (`com.huawei.instantaneous.blood_glucose`) | 2339-0 | `mg/dL` | meter readings; convert if you receive mmol/L. CGM values (`com.huawei.cgm_blood_glucose`) are not blood samples, so do not file them under this code |
| HRV (`com.huawei.heart_rate_variability`) | see note | `ms` | use LOINC 80404-7 only if Huawei's reference says the value is SDNN. See [Wearable data in FHIR](https://developers.anpheros.com/guides/wearable-data-fhir) |

## Frequently asked questions

### Does Huawei Health have an API?
Yes. Huawei Health Kit (Health Service Kit) has a REST API at `https://health-api.cloud.huawei.com/healthkit/v2`, with HUAWEI ID OAuth 2.0. Your app needs Huawei's approval first.

### How long does Huawei Health Kit approval take?
Huawei reviews each application by hand, in about 10 workdays. Lifting the 100-user cap on test scopes needs a separate verification step.

### Can individual developers use Huawei Health Kit?
Yes, with limits: individuals get only basic data, and only for a mobile app released on AppGallery. Advanced data is for enterprise developers.

### Can I read older Huawei Health data?
By default, only data created after the person authorized your app. The `historydata.open.week`, `.month` and `.year` scopes extend this to at most one year back.

### Does Huawei Health sync with Health Connect?
Huawei does not document it. Its privacy statement mentions sharing fitness and sleep data with Apple Health and Google Fit, with the person's permission. For Android users, read Huawei Health Kit from your backend.

### Does Anpheros connect to Huawei directly?
Not yet. Today your code reads Huawei Health Kit (or Apple Health on iPhone) and writes standard FHIR to Anpheros. A direct Huawei connector is on our roadmap; tell us with the button on this page if you need it.

## Related

- [Wearable APIs: every brand compared](https://developers.anpheros.com/guides/wearable-apis)
- [Wearable data in FHIR (Apple Health, Health Connect)](https://developers.anpheros.com/guides/wearable-data-fhir)
- [Apple Health (HealthKit) to FHIR](https://developers.anpheros.com/guides/apple-health-fhir)
- [Health Connect to FHIR](https://developers.anpheros.com/guides/health-connect-fhir)
- [Xiaomi Mi Band API to FHIR](https://developers.anpheros.com/guides/xiaomi-mi-band-api) · [Amazfit and Zepp API to FHIR](https://developers.anpheros.com/guides/amazfit-zepp-api) · [Samsung Health to FHIR](https://developers.anpheros.com/guides/samsung-health-fhir)
