---
title: "Sync Sdk Data"
method: POST
path: "/api/v1/sdk/users/{user_id}/sync"
tags: ["External: Mobile SDK"]
---

# Sync Sdk Data

`POST /api/v1/sdk/users/{user_id}/sync`

Import health data from SDK provider asynchronously via Celery.

Supports Apple HealthKit and Samsung Health SDK formats (identical payloads):
```json
{
    "provider": "apple",
    "sdkVersion": "1.0.0",
    "syncTimestamp": "2021-01-01T00:00:00Z",
    "data": {
        "records": [...],
        "sleep": [...],
        "workouts": [...]
    }
}
```

Args:
    user_id: SDK user identifier
    body: Health data payload
    auth: SDK authentication (Bearer token or API key)

Returns:
    UploadDataResponse with 202 status and task queued message

Raises:
    HTTPException: 403 if token doesn't match user_id, 400 if provider unsupported.
    Payload validation runs async in the worker, not here.

## Path parameters

- `user_id` string, required

## Headers

- `X-Open-Wearables-API-Key` string, nullable

## Request body

- object — Schema for Apple HealthKit data import via SDK. This schema represents the structure of health data exported from Apple HealthKit and sent to the SDK sync endpoint. The data is processed asynchronously via Celery. Structure: - `data.records`: Time-series measurements (heart rate, steps, distance, etc.) - `data.sleep`: Sleep phase records (in bed, awake, light, deep, REM) - `data.workouts`: Exercise/workout sessions with statistics All fields within `data` are optional - you can send any combination of records, sleep, and workouts.
  - `provider` string, required
  - `sdkVersion` string, required
  - `syncTimestamp` string, date-time, required
  - `data` object — Container for health data arrays (records, sleep, workouts)
    - `records` object[] — Time-series health measurements (heart rate, steps, distance, etc.)
      - `id` string, nullable
      - `parentId` string, nullable
      - `type` union
        - 'HKQuantityTypeIdentifierHeartRate' | 'HEART_RATE' | 'HKQuantityTypeIdentifierRestingHeartRate' | 'RESTING_HEART_RATE' | 'HKQuantityTypeIdentifierHeartRateVariabilitySDNN' | 'HEART_RATE_VARIABILITY' | 'HKQuantityTypeIdentifierHeartRateRecoveryOneMinute' | 'HKQuantityTypeIdentifierWalkingHeartRateAverage' | 'HKQuantityTypeIdentifierOxygenSaturation' | 'OXYGEN_SATURATION' | 'HKQuantityTypeIdentifierBloodGlucose' | 'BLOOD_GLUCOSE' | 'HKQuantityTypeIdentifierBloodPressureSystolic' | 'BLOOD_PRESSURE_SYSTOLIC' | 'HKQuantityTypeIdentifierBloodPressureDiastolic' | 'BLOOD_PRESSURE_DIASTOLIC' | 'HKQuantityTypeIdentifierRespiratoryRate' | 'RESPIRATORY_RATE' | 'HKQuantityTypeIdentifierHeight' | 'HEIGHT' | 'WEIGHT' | 'HKQuantityTypeIdentifierBodyMass' | 'LEAN_BODY_MASS' | 'SKELETAL_MUSCLE_MASS' | 'BODY_FAT_MASS' | 'HKQuantityTypeIdentifierBodyFatPercentage' | 'BODY_FAT' | 'HKQuantityTypeIdentifierBodyMassIndex' | 'BMI' | 'HKQuantityTypeIdentifierLeanBodyMass' | 'HKQuantityTypeIdentifierBodyTemperature' | 'BODY_TEMPERATURE' | 'HKQuantityTypeIdentifierVO2Max' | 'VO2_MAX' | 'HKQuantityTypeIdentifierSixMinuteWalkTestDistance' | 'HKQuantityTypeIdentifierStepCount' | 'STEP_COUNT' | 'HKQuantityTypeIdentifierActiveEnergyBurned' | 'HKQuantityTypeIdentifierBasalEnergyBurned' | 'ACTIVE_CALORIES_BURNED' | 'BASAL_METABOLIC_RATE' | 'HKQuantityTypeIdentifierAppleStandTime' | 'HKQuantityTypeIdentifierAppleExerciseTime' | 'HKQuantityTypeIdentifierFlightsClimbed' | 'FLOORS_CLIMBED' | 'DISTANCE' | 'HKQuantityTypeIdentifierDistanceWalkingRunning' | 'HKQuantityTypeIdentifierDistanceCycling' | 'HKQuantityTypeIdentifierDistanceSwimming' | 'HKQuantityTypeIdentifierDistanceDownhillSnowSports' | 'HKQuantityTypeIdentifierDistancePaddleSports' | 'HKQuantityTypeIdentifierDistanceRowing' | 'HKQuantityTypeIdentifierDistanceSkatingSports' | 'HKQuantityTypeIdentifierDistanceWheelchair' | 'HKQuantityTypeIdentifierDistanceCrossCountrySkiing' | 'HKQuantityTypeIdentifierWalkingStepLength' | 'HKQuantityTypeIdentifierWalkingSpeed' | 'HKQuantityTypeIdentifierWalkingDoubleSupportPercentage' | 'HKQuantityTypeIdentifierWalkingAsymmetryPercentage' | 'HKQuantityTypeIdentifierAppleWalkingSteadiness' | 'HKQuantityTypeIdentifierStairDescentSpeed' | 'HKQuantityTypeIdentifierStairAscentSpeed' | 'HKQuantityTypeIdentifierRunningPower' | 'HKQuantityTypeIdentifierRunningSpeed' | 'HKQuantityTypeIdentifierRunningVerticalOscillation' | 'HKQuantityTypeIdentifierRunningGroundContactTime' | 'HKQuantityTypeIdentifierRunningStrideLength' | 'HKQuantityTypeIdentifierSwimmingStrokeCount' | 'HKQuantityTypeIdentifierEnvironmentalAudioExposure' | 'HKQuantityTypeIdentifierHeadphoneAudioExposure' | 'HKQuantityTypeIdentifierEnvironmentalSoundReduction' | 'HKQuantityTypeIdentifierTimeInDaylight' | 'HKQuantityTypeIdentifierPhysicalEffort' | 'HKQuantityTypeIdentifierWorkoutEffortScore' | 'HKQuantityTypeIdentifierEstimatedWorkoutEffortScore' | 'HKQuantityTypeIdentifierAppleMoveTime' | 'HKQuantityTypeIdentifierAppleSleepingWristTemperature' | 'HKQuantityTypeIdentifierBloodAlcoholContent' | 'HKQuantityTypeIdentifierPeripheralPerfusionIndex' | 'HKQuantityTypeIdentifierForcedVitalCapacity' | 'HKQuantityTypeIdentifierForcedExpiratoryVolume1' | 'HKQuantityTypeIdentifierPeakExpiratoryFlowRate' | 'HKQuantityTypeIdentifierBasalBodyTemperature' | 'HKQuantityTypeIdentifierAppleSleepingBreathingDisturbances' | 'HKQuantityTypeIdentifierWaistCircumference' | 'HKQuantityTypeIdentifierInsulinDelivery' | 'HKQuantityTypeIdentifierNumberOfTimesFallen' | 'HKQuantityTypeIdentifierInhalerUsage' | 'HKQuantityTypeIdentifierNumberOfAlcoholicBeverages' | 'HYDRATION' | 'HKQuantityTypeIdentifierElectrodermalActivity' | 'HKQuantityTypeIdentifierUVExposure' | 'HKQuantityTypeIdentifierPushCount' | 'HKQuantityTypeIdentifierAtrialFibrillationBurden' | 'HKQuantityTypeIdentifierUnderwaterDepth' | 'HKQuantityTypeIdentifierWaterTemperature' | 'HKQuantityTypeIdentifierCyclingCadence' | 'HKQuantityTypeIdentifierCyclingFunctionalThresholdPower' | 'HKQuantityTypeIdentifierCyclingPower' | 'HKQuantityTypeIdentifierCyclingSpeed' | 'POWER' | 'SPEED' | 'CYCLING_PEDALING_CADENCE' | 'TOTAL_CALORIES_BURNED' | 'HKQuantityTypeIdentifierCrossCountrySkiingSpeed' | 'HKQuantityTypeIdentifierPaddleSportsSpeed' | 'HKQuantityTypeIdentifierRowingSpeed' | 'HKQuantityTypeIdentifierNikeFuel' — Metric type identifiers for Apple HealthKit and Samsung/Health Connect SDK. Apple types use HKQuantityTypeIdentifier... strings. Samsung/HC types use uppercase SCREAMING_SNAKE_CASE strings (e.g. "HEART_RATE").
        - string
      - `startDate` string, date-time, required
      - `endDate` string, date-time, required
      - `zoneOffset` string, nullable
      - `source` object, nullable — Source/device information for HealthKit records.
        - `appId` string, nullable
        - `name` string, nullable
        - `bundleIdentifier` string, nullable
        - `version` string, nullable
        - `productType` string, nullable
        - `operatingSystemVersion` object, nullable — Operating system version info from HealthKit source.
          - `majorVersion` integer, required
          - `minorVersion` integer, required
          - `patchVersion` integer, required
        - `deviceId` string, nullable
        - `deviceName` string, nullable
        - `deviceManufacturer` string, nullable
        - `deviceType` union
          - 'phone' | 'watch' | 'scale' | 'ring' | 'fitness_band' | 'chest_strap' | 'head_mounted' | 'smart_display' | 'unknown' — Device type for HealthKit records.
          - string
        - `deviceModel` string, nullable
        - `deviceHardwareVersion` string, nullable
        - `deviceSoftwareVersion` string, nullable
        - `recordingMethod` union
          - 'active' | 'automatic' | 'manual' | 'unknown' — Recording method for HealthKit records.
          - string
      - `value` union, required
        - number
        - string
      - `unit` string, nullable, required
      - `metadata` union
        - object[]
        - object
    - `sleep` object[] — Sleep phase records (in bed, awake, light, deep, REM).
      - `id` string, nullable
      - `parentId` string, nullable
      - `stage` union, required
        - 'in_bed' | 'sleeping' | 'awake' | 'light' | 'deep' | 'rem' | 'unknown'
        - string
      - `startDate` string, date-time, required
      - `endDate` string, date-time, required
      - `zoneOffset` string, nullable
      - `source` object, nullable — Source/device information for HealthKit records.
        - `appId` string, nullable
        - `name` string, nullable
        - `bundleIdentifier` string, nullable
        - `version` string, nullable
        - `productType` string, nullable
        - `operatingSystemVersion` object, nullable — Operating system version info from HealthKit source.
          - `majorVersion` integer, required
          - `minorVersion` integer, required
          - `patchVersion` integer, required
        - `deviceId` string, nullable
        - `deviceName` string, nullable
        - `deviceManufacturer` string, nullable
        - `deviceType` union
          - 'phone' | 'watch' | 'scale' | 'ring' | 'fitness_band' | 'chest_strap' | 'head_mounted' | 'smart_display' | 'unknown' — Device type for HealthKit records.
          - string
        - `deviceModel` string, nullable
        - `deviceHardwareVersion` string, nullable
        - `deviceSoftwareVersion` string, nullable
        - `recordingMethod` union
          - 'active' | 'automatic' | 'manual' | 'unknown' — Recording method for HealthKit records.
          - string
      - `values` object[], nullable
      - `metadata` union
        - object[]
        - object
    - `workouts` object[] — Exercise/workout sessions with optional statistics (distance, heart rate, calories, etc.)
      - `id` string, nullable
      - `parentId` string, nullable
      - `type` union
        - 'walking' | 'running' | 'cycling' | 'wheelchair_walk' | 'wheelchair_run' | 'hand_cycling' | 'elliptical' | 'stair_climbing' | 'stairs' | 'jump_rope' | 'core_training' | 'functional_strength_training' | 'strength_training' | 'cross_training' | 'mixed_cardio' | 'hiit' | 'step_training' | 'fitness_gaming' | 'preparation_and_recovery' | 'flexibility' | 'cooldown' | 'barre' | 'cardio_dance' | 'social_dance' | 'yoga' | 'mind_and_body' | 'pilates' | 'american_football' | 'australian_football' | 'baseball' | 'basketball' | 'cricket' | 'disc_sports' | 'handball' | 'hockey' | 'lacrosse' | 'rugby' | 'soccer' | 'softball' | 'volleyball' | 'badminton' | 'pickleball' | 'racquetball' | 'squash' | 'table_tennis' | 'tennis' | 'climbing' | 'equestrian' | 'fishing' | 'golf' | 'hiking' | 'hunting' | 'play' | 'cross_country_skiing' | 'curling' | 'downhill_skiing' | 'snow_sports' | 'snowboarding' | 'skating' | 'paddle_sports' | 'rowing' | 'sailing' | 'surfing' | 'swimming' | 'underwater_diving' | 'water_fitness' | 'water_polo' | 'water_sports' | 'boxing' | 'kickboxing' | 'martial_arts' | 'tai_chi' | 'wrestling' | 'archery' | 'bowling' | 'fencing' | 'gymnastics' | 'track_and_field' | 'swim_bike_run' | 'transition' | 'dance' | 'dance_inspired_training' | 'mixed_metabolic_cardio_training' | 'cycling_stationary' | 'boot_camp' | 'calisthenics' | 'dancing' | 'exercise_class' | 'football_american' | 'football_australian' | 'frisbee_disc' | 'guided_breathing' | 'ice_hockey' | 'ice_skating' | 'paddling' | 'paragliding' | 'rock_climbing' | 'roller_hockey' | 'rowing_machine' | 'running_treadmill' | 'scuba_diving' | 'skiing' | 'snowshoeing' | 'stair_climbing_machine' | 'stretching' | 'swimming_open_water' | 'swimming_pool' | 'weightlifting' | 'wheelchair' | 'other' — Apple HealthKit SDK workout activity types. These are the workout types sent from the iOS SDK in snake_case format.
        - string
      - `startDate` string, date-time, required
      - `endDate` string, date-time, required
      - `zoneOffset` string, nullable
      - `source` object, nullable — Source/device information for HealthKit records.
        - `appId` string, nullable
        - `name` string, nullable
        - `bundleIdentifier` string, nullable
        - `version` string, nullable
        - `productType` string, nullable
        - `operatingSystemVersion` object, nullable — Operating system version info from HealthKit source.
          - `majorVersion` integer, required
          - `minorVersion` integer, required
          - `patchVersion` integer, required
        - `deviceId` string, nullable
        - `deviceName` string, nullable
        - `deviceManufacturer` string, nullable
        - `deviceType` union
          - 'phone' | 'watch' | 'scale' | 'ring' | 'fitness_band' | 'chest_strap' | 'head_mounted' | 'smart_display' | 'unknown' — Device type for HealthKit records.
          - string
        - `deviceModel` string, nullable
        - `deviceHardwareVersion` string, nullable
        - `deviceSoftwareVersion` string, nullable
        - `recordingMethod` union
          - 'active' | 'automatic' | 'manual' | 'unknown' — Recording method for HealthKit records.
          - string
      - `title` string, nullable
      - `notes` string, nullable
      - `values` object[], nullable
        - `type` union, required
          - 'duration' | 'totalDuration' | 'activeEnergyBurned' | 'basalEnergyBurned' | 'calories' | 'totalCalories' | 'distance' | 'stepCount' | 'swimmingStrokeCount' | 'minHeartRate' | 'averageHeartRate' | 'maxHeartRate' | 'meanHeartRate' | 'meanSpeed' | 'meanCadence' | 'maxCadence' | 'averageRunningPower' | 'averageRunningSpeed' | 'averageRunningStrideLength' | 'averageVerticalOscillation' | 'averageGroundContactTime' | 'vo2Max' | 'elevationAscended' | 'elevationDescended' | 'altitudeGain' | 'altitudeLoss' | 'maxAltitude' | 'minAltitude' | 'averageSpeed' | 'maxSpeed' | 'averageMETs' | 'lapLength' | 'swimmingLocationType' | 'indoorWorkout' | 'weatherTemperature' | 'weatherHumidity' — Apple HealthKit workout statistic types. These represent the different metrics that can be recorded during a workout session.
          - string
        - `unit` string, required
        - `value` union, required
          - number
          - integer
      - `segments` object[], nullable
      - `laps` object[], nullable
      - `route` object[], nullable
      - `samples` object[], nullable
      - `metadata` union
        - object[]
        - object

## Response `202`

Successful Response

- UploadDataResponse — Response schema for data upload/sync operations. Returned when health data is queued for asynchronous processing via Celery. The actual import happens in the background - this response indicates the task was queued successfully.
  - `status_code` integer, required — HTTP status code (typically 202 for async operations)
  - `response` string, required — Human-readable response message
  - `user_id` string, nullable — User ID associated with the import operation
  - `dropped_count` integer — Number of individual records dropped by per-record validation
  - `records_saved` integer — Time-series samples saved
  - `workouts_saved` integer — Workouts saved
  - `sleep_saved` integer — Sleep records saved

## Other responses

- `422` — Validation Error

---

[API](https://skmtc.net/openwearables/apis/open-wearables-api.md) · [All operations](https://skmtc.net/openwearables/apis/open-wearables-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/openwearables/open-wearables-api/versions/37c1c527cd8f/schema)
