---
title: "Swimming Data API: Strokes, Laps and Swim Distance by Platform"
canonical: "https://aifitnessapi.com/data/swimming-data-api"
cluster: "Health Data"
primary_query: "swimming data api"
last_reviewed: "2026-10-18"
description: "Swim strokes, laps and distance in the Google Health API, HealthKit and Wear OS: per-lap or cumulative counts, stroke types, and Health Connect's gap."
publisher: "AIFitnessAPI — independent, not sponsored"
cite_as: "\"Swimming Data API: Strokes, Laps and Swim Distance by Platform\", AIFitnessAPI, https://aifitnessapi.com/data/swimming-data-api"
---

# Swimming Data API: Strokes, Laps and Swim Distance by Platform

> Three platforms have a dedicated swimming type, each shaped differently: the Google Health API's swim-lengths-data gives each data point a stroke count and a stroke type of FREESTYLE, BACKSTROKE, BREASTSTROKE or BUTTERFLY, and its rollup returns only a total stroke count. Apple HealthKit has swimmingStrokeCount and distanceSwimming, cumulative types from iOS 10.0, and keeps stroke style, lap length and pool or open water in workout metadata keys. Wear OS Health Services reports SWIMMING_STROKES and SWIMMING_LAP_COUNT as counts since the last update, with totals for the current exercise and no stroke type. Health Connect has no swimming record: swimming is an exercise type there, and a swim's distance goes in the general DistanceRecord.

- Canonical: https://aifitnessapi.com/data/swimming-data-api
- Last reviewed: 2026-10-18
- Publisher: AIFitnessAPI (https://aifitnessapi.com) — independent, not sponsored
- Cite as: "Swimming Data API: Strokes, Laps and Swim Distance by Platform", AIFitnessAPI, https://aifitnessapi.com/data/swimming-data-api

---

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`](/google-health-api/swim-lengths-data): `strokeCount` per data point | [`swimmingStrokeCount`](/healthkit-identifiers/swimming-stroke-count): cumulative, count units | [`SWIMMING_STROKES`](/wear-os-data-types/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`](/wear-os-data-types/swimming-lap-count): a `Long` since the last update | an optional `laps` list on `ExerciseSessionRecord` |
| Swim distance | no swim type | [`distanceSwimming`](/healthkit-identifiers/distance-swimming): 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](/data/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`](/healthkit-metadata-keys#key-hkmetadatakeyswimmingstrokestyle): "the predominant stroke style for a lap of swimming," set on workout lap events, with a value from the `HKSwimmingStrokeStyle` enumeration.
- [`HKMetadataKeyLapLength`](/healthkit-metadata-keys#key-hkmetadatakeylaplength): "the length of a lap during a workout," an `HKQuantity` in length units, set on a workout, a workout segment or a distance sample.
- [`HKMetadataKeySwimmingLocationType`](/healthkit-metadata-keys#key-hkmetadatakeyswimminglocationtype): "the location for a swimming workout," a value from the `HKWorkoutSwimmingLocationType` enumeration.

"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`](/wear-os-data-types/swimming-strokes), the "Number of swimming strokes taken since the last update," and [`SWIMMING_LAP_COUNT`](/wear-os-data-types/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`](/health-connect/exercise-session-record), 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`](/health-connect/distance-record), 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 `strokeCountSum` and 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.

## FAQ

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

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

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

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

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

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

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

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