Step Counting API: How to Get Step Data
Last verified July 24, 2026 · 3 min read
Covered here:HealthKitHealth ConnectFitbitGarminTerraJunction
For how on-device stores differ from cloud APIs, see on-device vs cloud health data.
Where you can get steps#
Steps are available from a phone alone (its pedometer) as well as from wearables. Provider-specific field names, records, and device coverage change often, so treat this table as a starting point and confirm against each vendor's live data dictionary (as of 2026, verify).
| Source | How you access it | Notes |
|---|---|---|
| Apple HealthKit (iOS) | On-device read with per-type permission; no cloud pull | HKQuantityTypeIdentifier.stepCount. HealthKit aggregates and de-duplicates across sources when you query statistics |
| Core Motion (iOS) | On-device pedometer via CMPedometer | Live, low-level phone pedometer, separate from HealthKit; verify exact fields in Apple's Core Motion docs |
| Android Health Connect | On-device read with per-record permission; no cloud pull | StepsRecord (count, startTime, endTime, zone offsets); primary aggregation is StepsRecord.COUNT_TOTAL |
| Garmin Health API | Cloud OAuth 2.0 (post-sync) | Steps listed among daily/interval summary metrics; verify current fields |
| Fitbit / Samsung Health / Polar / Withings | Cloud OAuth 2.0 (post-sync) | Each exposes daily or interval step summaries via its own API |
| Aggregators (Terra, Junction, Rook) | One normalized schema over many providers | All normalize steps (Terra day-level summaries include steps); see wearable data APIs |
Measured or estimated?#
Steps are counted, but the count comes from motion-sensor pattern-recognition algorithms interpreting accelerometer data, not from a sensor that registers each literal foot-fall. Treat step counts as algorithmic and close, not exact, and do not attach an accuracy percentage — none is sourced, and figures vary by device, gait, and where the device is carried. This is wellness-grade activity data, not a clinical measurement.
The headline gotcha is double-counting across a phone and a paired watch. When a user carries a phone and wears a watch, both log steps, so a naive sum roughly doubles the total. The platforms provide de-duplication, and you should lean on it rather than summing raw samples yourself:
- Health Connect: use
aggregate()(for exampleStepsRecord.COUNT_TOTAL) rather than summing rawreadRecords(). Be aware that attribution can span multipleDataOriginpackage names, and that on-device step attribution changed in 2026 — legacy readings attributed to the"android"package versus a newer device Synthetic Package Name. Read and verify the current Health Connect steps guidance before you filter or de-duplicate by origin. - HealthKit: it de-duplicates across sources when you query statistics rather than raw samples. Verify the current behavior in Apple's HealthKit docs before assuming a given query already merges phone and watch.
Because both platforms already reconcile multiple sources, the safest design is to read the aggregated total the OS gives you instead of stitching sources together by hand.
Which source should you pick?#
- Widest reach, least friction: read the on-device platform store — HealthKit
HKQuantityTypeIdentifier.stepCounton iOS, Health ConnectStepsRecordon Android — so you inherit the OS's own multi-source de-duplication and avoid the double-counting trap. See the setup guides for HealthKit and Google Health Connect. - Live, in-the-moment step count on iOS: Core Motion's
CMPedometergives you low-level pedometer data directly, separate from HealthKit's stored samples. - Server-side without the phone present: a cloud wearable API (Garmin, Fitbit, Samsung Health, and others) delivers daily or interval step summaries after the device syncs — useful when your backend needs the data and the user's phone is not in the loop.
- Many brands at once: an aggregator (Terra, Junction, Rook) hands you one normalized steps schema instead of N integrations.
Before you ship#
Field names, records, aggregation methods, and device coverage are volatile — re-verify each against the vendor's current data dictionary as of 2026. In particular, confirm the 2026 Health Connect step-attribution change before shipping any de-duplication logic. Prefer the platform's aggregated total over hand-summed sources to avoid phone-plus-watch double-counting, and frame step counts as an algorithmic wellness signal rather than an exact measurement.
Frequently asked questions
- Can a phone count steps without a wearable?
- Yes. Step counting is one of the few fitness metrics fully available from a phone alone - its accelerometer feeds a pedometer. On iOS you can read stored counts via HealthKit (HKQuantityTypeIdentifier.stepCount) or live data via Core Motion's CMPedometer; on Android you read Health Connect's StepsRecord. A wearable only adds coverage for times the phone is not carried. As of 2026, verify exact fields in each platform's data dictionary.
- Why do my step counts look doubled?
- Because a phone and a paired watch both log steps, so naively summing every source roughly doubles the total. Use the platform's de-duplication instead: on Android, use Health Connect's aggregate() (for example StepsRecord.COUNT_TOTAL) rather than summing raw readRecords(); on iOS, query HealthKit statistics, which de-duplicate across sources. Read the aggregated total the OS provides rather than stitching sources together yourself.
- Are step counts measured or estimated?
- They are counted, but algorithmically - motion-sensor pattern recognition interpreting accelerometer data, not a sensor that registers each literal foot-fall. Treat step counts as a close algorithmic estimate, not ground truth, and do not rely on an exact accuracy figure; accuracy varies by device, gait, and where the device is carried. It is wellness-grade activity data, not a clinical measurement.
- Did Health Connect change how steps are attributed in 2026?
- There is a reported 2026 change to on-device step attribution in Health Connect - legacy readings attributed to the "android" package versus a newer device Synthetic Package Name - which affects how you filter or de-duplicate by DataOrigin. Confirm the current Health Connect steps guidance before shipping any de-duplication logic, as this behavior is volatile; verify in the official docs.
- Which source should I use for step data?
- For the widest reach with least friction, read the on-device platform store (HealthKit on iOS, Health Connect on Android) so you inherit the OS's multi-source de-duplication. Use Core Motion's CMPedometer for live counts on iOS. Use a cloud wearable API (Garmin, Fitbit, Samsung Health) when your backend needs data without the user's phone present, or an aggregator to normalize many brands at once.
Keep reading
Steps on the platform stores
Read from Apple’s documentation on 2026-08-28 and from our verified cross-platform reference. Not hand-written — regenerated with the dataset.
| Apple HealthKit | Aggregate with | Unit | iOS |
|---|---|---|---|
| stepCount | .cumulativeSum | count | 8.0 |
- Android Health Connect
- StepsRecord, StepsCadenceRecord
- Query shape
- Cumulative: sum the samples over your interval.
Watch out: De-duplicate: phone and watch both write steps. On Android, from the June 2026 update on-device steps are attributed to a per-device Synthetic Package Name — read it via getCurrentDeviceDataSource(), never hardcode it.
Full set: every HealthKit type identifier · every HealthKit error code
From the blog
Findings counted out of this site’s own datasets.
- 64 Cumulative, 53 Discrete: Sum or Average64 HealthKit quantity types state cumulative aggregation, 53 state discrete. Choose wrong and nothing errors, no test fails, and the chart still renders.
Elsewhere on the site
Pages that share this one’s concepts and sources, from other sections.
Next steps
Was this page useful?
Independent comparison, last reviewed July 24, 2026. Pricing, rate limits, and feature availability change often — confirm current details in each provider’s official documentation before you commit. Product and company names are trademarks of their respective owners; AIFitnessAPI is not affiliated with, endorsed by, or sponsored by any product listed here.
← All health data · by AIFitnessAPI