# Health tracker API

> Store steps, heart rate, HRV, sleep and SpO₂ from any wearable as LOINC-coded FHIR Observations: which devices reach which health store, why there is no web API, and working requests.

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

**A health tracker API lets an application send and read the data that watches, rings, bands and scales collect — steps, heart rate, heart rate variability, sleep, oxygen saturation, weight — as structured data on a server.** Most devices do not offer one shared API: their data reaches the phone's health store (Apple HealthKit or Android Health Connect), and your app reads it from there. Anpheros is the server side: your app writes the readings as LOINC-coded FHIR R4 Observations, and every other app, clinic or AI agent with the person's consent reads the same data through one API.

<!-- visual:tracker-flow -->

## Which devices reach which health store

| Device | Reaches | Read it with |
|---|---|---|
| Apple Watch, iPhone, many iOS apps | Apple HealthKit | Swift on the iPhone ([Apple Health to FHIR](https://developers.anpheros.com/guides/apple-health-fhir)) |
| Galaxy Watch, Wear OS, Fitbit, Garmin, Oura, Withings (Android apps) | Android Health Connect | Kotlin or Flutter on the phone ([Health Connect to FHIR](https://developers.anpheros.com/guides/health-connect-fhir)) |
| Galaxy Watch details not in Health Connect | Samsung Health | Samsung Health Data SDK ([Samsung Health to FHIR](https://developers.anpheros.com/guides/samsung-health-fhir)) |

Neither HealthKit nor Health Connect has a web or REST API: the data lives on the phone, and only an app the person installed and allowed can read it. A health tracker API on a server therefore always starts with a small mobile app.

<!-- visual:tracker-codes -->

## Write one day of steps

```bash
curl -X POST https://platform.anpheros.com/fhir/R4/Observation \
  -H "Authorization: Bearer $KEY" -H "Content-Type: application/fhir+json" \
  -H "Idempotency-Key: steps-$PID-2026-10-15" \
  -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/'"$PID"'"},
    "effectivePeriod": {"start": "2026-10-15T00:00:00+03:00", "end": "2026-10-16T00:00:00+03:00"},
    "valueQuantity": {"value": 8412, "unit": "steps", "system": "http://unitsofmeasure.org", "code": "{steps}"}
  }'
```

Store one Observation per metric per local day, with the person's time zone in the period. The `Idempotency-Key` makes a resend harmless. [Wearable data in FHIR](https://developers.anpheros.com/guides/wearable-data-fhir) has the full LOINC table and a tested daily upsert.

## Read it back

```bash
# the last 30 daily step counts
curl "https://platform.anpheros.com/fhir/R4/Observation?patient=$PID&code=http://loinc.org|41950-7&_sort=-date&_count=30" \
  -H "Authorization: Bearer $KEY"
```

Another application reads the same data only with the person's consent (OAuth 2.1, SMART scopes such as `patient/Observation.rs?category=activity`), and every read is logged where the person can see it.

## Frequently asked questions

### Is there a free health tracker API?
Anpheros has a free sandbox: store and read tracker data as FHIR Observations with 30 synthetic patients. Device makers' own APIs (Fitbit, Garmin, Oura, Withings) have their own access rules and terms.

### Is there a web API for Apple Health or Health Connect?
No. HealthKit and Health Connect keep data on the phone; an installed app reads it with the person's permission and can send it to a server such as Anpheros.

### Which codes should a health tracker API use?
LOINC: 41950-7 steps, 8867-4 heart rate, 40443-4 resting heart rate, 80404-7 heart rate variability (RMSSD), 59408-5 oxygen saturation, 93832-4 sleep duration, 29463-7 body weight. Units in UCUM.

### Does Anpheros connect to Fitbit or Garmin directly?
No. Their data reaches Anpheros through the phone's health store and your app; there is no direct cloud-to-cloud connection.

<!-- visual:cta-tracker -->

## Related

- [Wearable APIs: Fitbit, Garmin, Oura and Withings](https://developers.anpheros.com/guides/wearable-apis)
- [Fitbit Web API shutdown (October 2026)](https://developers.anpheros.com/guides/fitbit-web-api-shutdown)
- [Wearable data in FHIR (Apple Health, Health Connect)](https://developers.anpheros.com/guides/wearable-data-fhir)
- [Remote patient monitoring with FHIR](https://developers.anpheros.com/guides/remote-patient-monitoring-fhir)
- [Personal health record (PHR) app with FHIR](https://developers.anpheros.com/guides/personal-health-record-app)
- [Medical data API](https://developers.anpheros.com/guides/medical-data-api)
