---
title: "Step Counting API: How to Get Step Data"
canonical: "https://aifitnessapi.com/data/step-counting-api"
cluster: "Health Data"
primary_query: "step counting api"
last_reviewed: "2026-07-24"
description: "Get step counts from the phone (HealthKit, CMPedometer, Health Connect) or wearables. Handle phone+watch double-counting and pick the right source."
publisher: "AIFitnessAPI — independent, not sponsored"
cite_as: "\"Step Counting API: How to Get Step Data\", AIFitnessAPI, https://aifitnessapi.com/data/step-counting-api"
---

# Step Counting API: How to Get Step Data

> Step counts are widely available because the phone itself can count them - no wearable needed. You get them from an on-device store (Apple HealthKit's stepCount, iOS Core Motion CMPedometer, or Android Health Connect's StepsRecord) or from a cloud wearable API (Garmin, Fitbit, Samsung Health) after the device syncs. Steps are counted, but algorithmically from motion sensors, so treat them as a close estimate rather than exact. Best pick: read the on-device platform store so you inherit the OS's own de-duplication - which matters because a phone plus a paired watch will otherwise double-count.

- Canonical: https://aifitnessapi.com/data/step-counting-api
- Last reviewed: 2026-07-24
- Publisher: AIFitnessAPI (https://aifitnessapi.com) — independent, not sponsored
- Cite as: "Step Counting API: How to Get Step Data", AIFitnessAPI, https://aifitnessapi.com/data/step-counting-api

---

For how on-device stores differ from cloud APIs, see [on-device vs cloud health data](/learn/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](/fitness-apis/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 example `StepsRecord.COUNT_TOTAL`) rather than summing raw `readRecords()`. Be aware that attribution can span multiple `DataOrigin` package 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.stepCount` on iOS, Health Connect `StepsRecord` on Android — so you inherit the OS's own multi-source de-duplication and avoid the double-counting trap. See the setup guides for [HealthKit](/integrate/healthkit) and [Google Health Connect](/integrate/google-health-connect).
- **Live, in-the-moment step count on iOS:** Core Motion's `CMPedometer` gives 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.

## FAQ

### 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.

[Permalink](https://aifitnessapi.com/data/step-counting-api#faq-1)

### 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.

[Permalink](https://aifitnessapi.com/data/step-counting-api#faq-2)

### 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.

[Permalink](https://aifitnessapi.com/data/step-counting-api#faq-3)

### 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.

[Permalink](https://aifitnessapi.com/data/step-counting-api#faq-4)

### 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.

[Permalink](https://aifitnessapi.com/data/step-counting-api#faq-5)
