Swimming Data API: Strokes, Laps and Swim Distance by Platform
Last verified October 18, 2026 · 5 min read
Covered here:Health ConnectHealthKitFitbit
A swim is a sequence of lengths, and each platform keeps a different slice of it: per-length detail, a running total, or nothing outside the workout. Which slice you can read decides whether your app can show strokes by type, count lengths, or only report a number of strokes.
What each platform has#
| Metric | Google Health API | Apple HealthKit | Wear OS Health Services | Android Health Connect |
|---|---|---|---|---|
| Stroke count | swim-lengths-data: strokeCount per data point | swimmingStrokeCount: cumulative, count units | SWIMMING_STROKES: a Long since the last update | none |
| Stroke type | swimStrokeType on each data point | HKMetadataKeySwimmingStrokeStyle on workout lap events | none | none |
| Laps or lengths | data points over an interval; the exercise summary's totalSwimLengths | workout lap events; HKMetadataKeyLapLength | SWIMMING_LAP_COUNT: a Long since the last update | an optional laps list on ExerciseSessionRecord |
| Swim distance | no swim type | distanceSwimming: cumulative, length units | no swim type | no swim type; the general DistanceRecord |
| Pool length | poolLengthMillimeters in exercise metadata | HKMetadataKeyLapLength | none among the data types | none in the record data |
Read from Google's documentation on 2026-10-17, its Health Services reference on 2026-10-04 and its Health Connect reference on 2026-10-03, and from Apple's identifier documentation on 2026-10-02 and metadata-key documentation on 2026-10-04. General distance on every platform is covered by the distance tracking API guide.
Google: per-length detail, totals by rollup#
swim-lengths-data is an Interval type. Each data point carries its observed interval, a strokeCount that Google describes as the "Number of strokes in the lap," and a swimStrokeType of FREESTYLE, BACKSTROKE, BREASTSTROKE, BUTTERFLY or SWIM_STROKE_TYPE_UNSPECIFIED. You can list and reconcile the data points or call rollUp and dailyRollUp, whose result has one field: strokeCountSum, "Total number of swim strokes in the interval." A rollup keeps no stroke types and no count of data points, so strokes by type, or a count of lengths, means listing the data points.
Google's table gives the type no webhook support and no true-zeros support, lists 23 compatible devices, all Fitbit devices or Pixel Watch models, and maps the Fitbit Web API's swimming-strokes activity time series to it. Both activity-and-fitness scopes cover it.
The exercise type adds two swim fields: totalSwimLengths, "Number of full pool lengths completed during the exercise," and poolLengthMillimeters in exercise metadata, both present only for swimming exercises. Exercise data is otherwise outside this page's scope.
Apple: cumulative types plus workout metadata#
HealthKit has two swimming quantity types, both cumulative and both from iOS 10.0 and watchOS 3.0: swimmingStrokeCount measures "the number of strokes performed while swimming," and distanceSwimming "the distance the user has moved while swimming." A statistics query sums them over any interval, but a stroke-count sample carries no stroke style.
The structure lives on the workout instead. Apple's Swimming group of workout metadata keys documents three:
HKMetadataKeySwimmingStrokeStyle: "the predominant stroke style for a lap of swimming," set on workout lap events, with a value from theHKSwimmingStrokeStyleenumeration.HKMetadataKeyLapLength: "the length of a lap during a workout," anHKQuantityin length units, set on a workout, a workout segment or a distance sample.HKMetadataKeySwimmingLocationType: "the location for a swimming workout," a value from theHKWorkoutSwimmingLocationTypeenumeration.
"Predominant" is Apple's word: a lap with mixed strokes still gets one style. Google's field description does not say how a mixed length is typed. The same group lists HKMetadataKeySWOLFScore from iOS 16.0 and HKMetadataKeyWaterSalinity from iOS 17.0, both without an abstract in Apple's documentation as read, so this site cannot tell you their units or where they are set. This site's data does not list the cases of HKSwimmingStrokeStyle either; read Apple's page for that enumeration before mapping Google's four stroke names onto it.
Wear OS: counts since the last update#
Health Services has SWIMMING_STROKES, the "Number of swimming strokes taken since the last update," and SWIMMING_LAP_COUNT, the "Count of swimming laps since the last update." Both are DeltaDataType<Long, IntervalDataPoint<Long>>, with SWIMMING_STROKES_TOTAL and SWIMMING_LAP_COUNT_TOTAL counting from the start of the current active exercise, and both sit under ACTIVITY_RECOGNITION in Google's permissions table. None of the 65 data types is a stroke type or a swim distance.
Health Connect: no swimming record#
None of Health Connect's 42 record types is a stroke count, lap count or swim distance. Swimming exists there as two exercise types, EXERCISE_TYPE_SWIMMING_POOL and EXERCISE_TYPE_SWIMMING_OPEN_WATER, on ExerciseSessionRecord, whose optional laps field holds "ExerciseLaps of the session" that Google says should fall within the session and not overlap. A swim's distance goes in the general DistanceRecord, which does not name the activity that produced it. Stroke counts from a watch have no record to go into.
Traps#
- Lap, length, or both. Google's type is called swim lengths, its field counts strokes "in the lap," and its exercise summary counts "full pool lengths"; Wear OS counts laps; Apple keys a lap length. None of these descriptions says whether a lap is one length of the pool or two, so check on a device before you turn a count into distance.
- Rollups drop stroke types. Google's rollup returns
strokeCountSumand nothing else. - Per data point, cumulative, or delta. Google stores strokes per data point, Apple as cumulative samples with the style on lap events, Wear OS as deltas since the last update. Totals agree in kind; per-length detail exists only where a platform keeps it.
- Polling, not push. With no webhook support, Google's swim data has to be fetched.
- Nothing to write on Android. A Wear OS app that counts strokes has no Health Connect record to store them in; keep them in your own store.
Before you ship#
Re-read the type pages and metadata keys linked here before each release; they regenerate from Google's and Apple's documentation. Store each stroke type in the vocabulary it came from, record the pool length beside every count, and design the Android path for strokes without Health Connect.
Swimming strokes and lengths, by platform
Each type links its reference page on this site. The quote is the platform's own description of the type, copied from the generated reference data, and it is the reason the type is listed: nothing here is paired by name. A platform with nothing listed has no type with a page here whose description names this metric.
Google Health API · read 2026-10-17
- swim-lengths-data — Interval record · operations: list, reconcile, rollup, dailyRollup · no webhook support in Google's table
“Swim lengths data over the time interval.” — Google
Apple HealthKit · read 2026-10-02
- swimmingStrokeCount — cumulative values · count units · iOS 10.0+
“A quantity sample type that measures the number of strokes performed while swimming.” — Apple
- distanceSwimming — cumulative values · length units · iOS 10.0+
“A quantity sample type that measures the distance the user has moved while swimming.” — Apple
Android Health Connect · read 2026-10-03
Nothing listed.
Wear OS Health Services · read 2026-10-04
- DataType.SWIMMING_STROKES — DeltaDataType · IntervalDataPoint<Long> · permission ACTIVITY_RECOGNITION
“Number of swimming strokes taken since the last update.” — Google
- DataType.SWIMMING_LAP_COUNT — DeltaDataType · IntervalDataPoint<Long> · permission ACTIVITY_RECOGNITION
“Count of swimming laps since the last update.” — Google
Bluetooth GATT · read 2026-10-17
Nothing listed.
Frequently asked questions
- Does Health Connect have a swimming stroke count record?
- No. Health Connect's record types, read from Google's reference on 2026-10-03, include no stroke count, lap count or swim distance record. Swimming is an exercise type there, EXERCISE_TYPE_SWIMMING_POOL or EXERCISE_TYPE_SWIMMING_OPEN_WATER on ExerciseSessionRecord, which has an optional laps list, and distance goes in the general DistanceRecord. On a Wear OS watch, Health Services counts SWIMMING_STROKES and SWIMMING_LAP_COUNT instead.
- Which swim stroke types does the Google Health API record?
- Four named strokes plus unspecified. Each swim-lengths-data point has a swimStrokeType of FREESTYLE, BACKSTROKE, BREASTSTROKE, BUTTERFLY or SWIM_STROKE_TYPE_UNSPECIFIED, beside a strokeCount Google describes as the number of strokes in the lap. The rollUp and dailyRollUp methods return only strokeCountSum, the total strokes in the interval, so list the data points when you need strokes by type.
- Where does HealthKit keep swim stroke style and pool length?
- In workout metadata keys rather than sample types. HKMetadataKeySwimmingStrokeStyle holds the predominant stroke style for a lap, set on workout lap events; HKMetadataKeyLapLength holds a lap's length as a length quantity on a workout, a workout segment or a distance sample; HKMetadataKeySwimmingLocationType marks where a swimming workout took place. The quantity types swimmingStrokeCount and distanceSwimming hold cumulative totals.
- Is a swimming lap the same as a pool length in these APIs?
- None of the descriptions this site reads says. Google's swim-lengths-data counts strokes in the lap, while its exercise summary counts full pool lengths; Wear OS Health Services counts swimming laps; Apple's HKMetadataKeyLapLength is the length of a lap during a workout. Test on a device whether one lap is one length or two before you multiply a lap count by a pool length.
Keep reading
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 October 18, 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