Key Takeaways
- HealthKit is an on-device store with no server API, so your iOS app must read the data and upload it to your backend.
- Reliable sync combines HKObserverQuery with background delivery, anchored queries with persisted anchors, and retries for locked-device errors.
- App Store rules prohibit using HealthKit data for advertising, marketing or data mining and storing personal health data in iCloud.
- Once HealthKit data reaches a covered entity or business associate it is PHI, so plan BAAs, encryption, audit logs and FHIR mapping early.
- Google Health Connect and cloud aggregators solve different parts of the problem; aggregators still rely on an SDK inside your iOS app.
Is Your HealthTech Product Built for Success in Digital Health?
.avif)
Apple HealthKit integration is usually the first technical decision a digital health product makes on iOS, and an often misunderstood one. HealthKit is not a cloud service you call from your backend. It is an encrypted, on-device store that aggregates data from the iPhone, Apple Watch and third-party apps and devices, and it only hands that data to a native app the user has explicitly authorized, one data type at a time.
That design has real consequences for remote monitoring, clinical trials, coaching and care management products. You need a native iOS client, a background sync strategy, a privacy model that satisfies App Review, and a backend ready to treat the data as protected health information once it arrives. This guide covers each of those layers, compares HealthKit with Google Health Connect and aggregator APIs, and ends with an implementation checklist built around the pitfalls teams most often hit.
What Apple HealthKit is and which data you can access
HealthKit is a framework in the iOS SDK that gives apps controlled access to the Health app's data. Apple Watch, the iPhone's own motion sensors, and any app or connected device that writes to HealthKit all feed the same store. Your app reads from it and, if the user allows, writes back to it.
The data model is typed, and the type determines which query you use:
- Quantity types (
HKQuantityType): numeric samples with units, such as step count, heart rate, heart rate variability, resting heart rate, blood glucose, oxygen saturation and active energy. Blood pressure is stored as a correlation of two quantity samples. - Category types (
HKCategoryType): enumerated values such as sleep analysis stages, mindful sessions or menstrual flow. - Workouts (
HKWorkout): activity sessions with duration, energy, distance and associated samples and routes. - Clinical records: FHIR-based records that users download from supported providers into the Health app. Access requires an additional entitlement and its own usage description.
Every sample carries a source and device, start and end dates, and optional metadata. Keep them when you sync. Provenance matters when you explain a reading to a clinician or resolve duplicates.
Permissions, privacy and App Store rules for HealthKit apps
HealthKit authorization is granular. Your app calls requestAuthorization(toShare:read:) with explicit sets of types to write and read, and the user can approve or deny each type individually. The project needs the HealthKit capability enabled, plus NSHealthShareUsageDescription and NSHealthUpdateUsageDescription strings in Info.plist that explain in plain language why you need the data. Background delivery needs its own entitlement.
One rule surprises almost every team: for read permissions, HealthKit does not tell your app whether the user said no. A denied read simply returns no data, which looks identical to a user who has no data of that type. Design your UX and your analytics around that ambiguity instead of treating empty results as an error, and only request the types your feature actually uses, at the moment it needs them.
Apple's App Store Review Guidelines add policy constraints on top of the API:
- Health data obtained through HealthKit may not be used for advertising, marketing or use-based data mining, and may not be sold or disclosed to third parties for those purposes. Permitted uses are improving health management or health research, and research use requires the user's permission.
- You must not write false or inaccurate data into HealthKit.
- Personal health information may not be stored in iCloud.
- You need a privacy policy that explains what you collect and how you use it, and the HealthKit integration should be clearly visible in your app.
Practically, keep health data out of any marketing or product analytics pipeline from day one.
HealthKit architecture: syncing on-device data to your backend
Apple does not offer a server-side HealthKit API. Every byte that reaches your servers is read by your iOS app on the user's device and uploaded by that app. Your sync layer is therefore a mobile engineering problem as much as a backend one.

A reliable pattern combines three mechanisms:
- Observer queries with background delivery. Register an
HKObserverQueryfor each type and callenableBackgroundDelivery(for:frequency:). iOS wakes your app when new samples are written. The frequency is a request, not a guarantee, and Apple caps some types at hourly delivery. Always call the observer's completion handler, or the system will back off. - Anchored object queries for incremental reads. Inside the observer callback, run an
HKAnchoredObjectQuerywith the anchor saved from the last successful sync. It returns new samples and deleted objects, so your backend can mirror deletions instead of keeping data the user removed. Persist the new anchor only after the upload succeeds. - Statistics queries for aggregates. For daily step totals or energy,
HKStatisticsCollectionQuerymerges overlapping sources the way the Health app does, which avoids double counting when both the iPhone and the watch recorded steps.
Plan for the constraints of the device. The HealthKit store is encrypted while the phone is locked, so background reads can fail with a protected-data error and must be retried later. Background execution time is short, so batch uploads, keep payloads small, and queue them locally when the network is unavailable. Run a catch-up sync on every foreground launch, because background wake-ups are not guaranteed.
On the server side, accept idempotent uploads keyed by the HealthKit sample UUID, store source and device metadata, and normalize units before data reaches downstream consumers. If you also ingest data from other wearables, the same challenges appear across providers; our guide to multi-device wearable data normalization and deduplication covers how to decide which source wins.
HIPAA considerations once HealthKit data reaches your backend
HealthKit itself is a consumer platform, and data sitting on a user's own iPhone is not automatically covered by HIPAA. The picture changes when the data flows to a covered entity, such as a provider or health plan, or to a business associate building software on its behalf. At that point it is protected health information and the HIPAA Privacy, Security and Breach Notification Rules apply to the systems that store and process it.
For a HealthKit-connected product in that situation, the backend typically needs:
- Business associate agreements with every vendor that touches PHI, including hosting, logging, error tracking and any data aggregator.
- Encryption in transit and at rest, role-based access control, and audit logs of who accessed which patient's data.
- A documented risk analysis and data retention policy, including what happens to data when a user revokes HealthKit access or deletes their account.
- Consent records that capture what the user agreed to share and when.
Direct-to-consumer apps that are not covered by HIPAA are not free of obligations. In the United States, the FTC Health Breach Notification Rule can apply to health apps that collect data from consumers. If data will flow into an EHR, map it to FHIR resources such as Observation early.
HealthKit vs Google Health Connect vs wearable aggregator APIs
Most health products need both mobile platforms, and many also need direct device APIs such as Garmin, Oura or Withings.
Note that even cloud aggregators cannot read HealthKit from a server. They ship an iOS SDK that runs inside your app and performs the same on-device read and upload described above. The aggregator decision is really about who maintains the sync code and the provider connections, and whether you accept an extra processor in your PHI flow. We cover that trade-off in more depth in wearable API integration vs SaaS aggregators.
Apple HealthKit integration checklist and common pitfalls
Use this checklist before sprint planning:
- Define the data contract. List the exact HealthKit types, units, sampling needs and history depth each feature requires. Fewer types mean simpler permission prompts and an easier App Review.
- Design the permission flow. Ask in context, explain the benefit, and handle empty results gracefully because denied reads are invisible.
- Build the sync engine. Observer queries, background delivery, anchored queries with persisted anchors, a local upload queue and retry logic for locked-device errors.
- Handle deletions and duplicates. Mirror deleted objects, keep source metadata and use statistics queries for cumulative metrics.
- Separate health data from analytics. No HealthKit values in advertising, attribution or general product analytics tools.
- Prepare the compliant backend. BAAs, encryption, audit logging, retention and a FHIR mapping if clinical systems are in scope.
- Test on real devices. The simulator does not reproduce Apple Watch data or real background wake-up behavior. Test locked-device reads, offline periods and large backfills.
Common pitfalls: treating background delivery as real-time, losing anchors, double counting steps from iPhone and watch, backfills that time out for users with years of data, and analytics SDKs that capture health values. Each is cheaper to design out than to fix after launch. If HealthKit is joining an app that already has a backend, see how to add a wearable API to an existing backend.
Build your HealthKit integration with Momentum
Momentum is a healthcare software engineering company. We build iOS and Android health apps, HIPAA-ready backends and EHR/FHIR integrations, and we work on wearable data integration every day. We also maintain Open Wearables, our open-source platform for integrating wearable health data, so the sync, normalization and multi-provider problems described in this guide are ones our team works on directly.
If you are planning an Apple HealthKit integration, adding Health Connect alongside it, or moving wearable data into a clinical workflow, we can help you scope the architecture, compliance and delivery plan. Talk to our team.




%25201.png)

