> ## Documentation Index
> Fetch the complete documentation index at: https://openwearables.io/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Sync User Data

> Synchronize data from fitness provider API for a specific user.

**Data Types:**
- `workouts`: Workouts/exercises/activities
- `247`: 24/7 data including sleep, recovery, and activity samples
- `all`: All available data types

**Provider-specific:**
- **Suunto**: Supports workouts and 247 data with pagination
- **Polar**: Supports workouts (exercises) only
- **Garmin**: Data arrives via webhooks (backfill for 30-day history)
- **Whoop**: Supports workouts and 247 data (sleep/recovery)

**Execution Mode:**
- `async=true` (default): Dispatches sync to background Celery worker. Returns immediately with task ID.
- `async=false`: Executes synchronously (may timeout for large data sets).

Requires valid API key and active connection for the user.



## OpenAPI

````yaml /openapi.json post /api/v1/providers/{provider}/users/{user_id}/sync
openapi: 3.1.0
info:
  title: Open Wearables API
  version: 1.0.0
servers: []
security: []
paths:
  /api/v1/providers/{provider}/users/{user_id}/sync:
    post:
      tags:
        - 'External: Data Sync'
      summary: Sync User Data
      description: >-
        Synchronize data from fitness provider API for a specific user.


        **Data Types:**

        - `workouts`: Workouts/exercises/activities

        - `247`: 24/7 data including sleep, recovery, and activity samples

        - `all`: All available data types


        **Provider-specific:**

        - **Suunto**: Supports workouts and 247 data with pagination

        - **Polar**: Supports workouts (exercises) only

        - **Garmin**: Data arrives via webhooks (backfill for 30-day history)

        - **Whoop**: Supports workouts and 247 data (sleep/recovery)


        **Execution Mode:**

        - `async=true` (default): Dispatches sync to background Celery worker.
        Returns immediately with task ID.

        - `async=false`: Executes synchronously (may timeout for large data
        sets).


        Requires valid API key and active connection for the user.
      operationId: sync_user_data_api_v1_providers__provider__users__user_id__sync_post
      parameters:
        - name: provider
          in: path
          required: true
          schema:
            $ref: '#/components/schemas/ProviderName'
            description: Data provider
          description: Data provider
        - name: user_id
          in: path
          required: true
          schema:
            type: string
            format: uuid
            title: User Id
        - name: data_type
          in: query
          required: false
          schema:
            $ref: '#/components/schemas/SyncDataType'
            description: >-
              Type of data to sync: workouts, 247 (sleep/recovery/activity), or
              all
            default: all
          description: >-
            Type of data to sync: workouts, 247 (sleep/recovery/activity), or
            all
        - name: since
          in: query
          required: false
          schema:
            type: integer
            description: Unix timestamp to synchronize data since (0 = all, Suunto only)
            default: 0
            title: Since
          description: Unix timestamp to synchronize data since (0 = all, Suunto only)
        - name: limit
          in: query
          required: false
          schema:
            type: integer
            maximum: 100
            description: 'Maximum number of items (Suunto: max 100)'
            default: 50
            title: Limit
          description: 'Maximum number of items (Suunto: max 100)'
        - name: offset
          in: query
          required: false
          schema:
            type: integer
            description: Offset for pagination (Suunto only)
            default: 0
            title: Offset
          description: Offset for pagination (Suunto only)
        - name: filter_by_modification_time
          in: query
          required: false
          schema:
            type: boolean
            description: Filter by modification time instead of creation time (Suunto only)
            default: true
            title: Filter By Modification Time
          description: Filter by modification time instead of creation time (Suunto only)
        - name: samples
          in: query
          required: false
          schema:
            type: boolean
            description: Synchronize sample data (Polar only)
            default: false
            title: Samples
          description: Synchronize sample data (Polar only)
        - name: zones
          in: query
          required: false
          schema:
            type: boolean
            description: Synchronize zones data (Polar only)
            default: false
            title: Zones
          description: Synchronize zones data (Polar only)
        - name: route
          in: query
          required: false
          schema:
            type: boolean
            description: Synchronize route data (Polar only)
            default: false
            title: Route
          description: Synchronize route data (Polar only)
        - name: summary_start_time
          in: query
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            description: >-
              Activity start time as Unix timestamp or ISO 8601 date (Garmin
              only)
            title: Summary Start Time
          description: Activity start time as Unix timestamp or ISO 8601 date (Garmin only)
        - name: summary_end_time
          in: query
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            description: Activity end time as Unix timestamp or ISO 8601 date (Garmin only)
            title: Summary End Time
          description: Activity end time as Unix timestamp or ISO 8601 date (Garmin only)
        - name: async
          in: query
          required: false
          schema:
            type: boolean
            description: >-
              Run sync asynchronously via Celery (default: true). Set false for
              sync.
            default: true
            title: Async
          description: >-
            Run sync asynchronously via Celery (default: true). Set false for
            sync.
        - name: X-Open-Wearables-API-Key
          in: header
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            title: X-Open-Wearables-Api-Key
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                anyOf:
                  - $ref: '#/components/schemas/SyncResponse'
                  - $ref: '#/components/schemas/SyncQueuedResponse'
                title: >-
                  Response Sync User Data Api V1 Providers  Provider  Users 
                  User Id  Sync Post
        '422':
          description: Validation Error
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ValidationProblem'
        4XX:
          description: Client error
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Problem'
        5XX:
          description: Server error
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Problem'
      security:
        - OAuth2PasswordBearer: []
components:
  schemas:
    ProviderName:
      type: string
      enum:
        - apple
        - samsung
        - garmin
        - health_connect
        - google_health
        - polar
        - suunto
        - whoop
        - strava
        - oura
        - fitbit
        - ultrahuman
        - sensorbio
        - withings
        - unknown
        - internal
      title: ProviderName
      description: Supported data providers.
    SyncDataType:
      type: string
      enum:
        - workouts
        - '247'
        - all
      title: SyncDataType
      description: Types of data to sync from provider.
    SyncResponse:
      properties:
        success:
          type: boolean
          title: Success
        details:
          $ref: '#/components/schemas/SyncDetails'
      type: object
      required:
        - success
        - details
      title: SyncResponse
      description: A synchronous sync's outcome.
    SyncQueuedResponse:
      properties:
        success:
          type: boolean
          title: Success
        async:
          type: boolean
          title: Async
        task_id:
          type: string
          title: Task Id
        message:
          type: string
          title: Message
      type: object
      required:
        - success
        - async
        - task_id
        - message
      title: SyncQueuedResponse
      description: A sync queued to run in the background.
    ValidationProblem:
      description: A 422 for a request that failed validation, listing every failure.
      examples:
        - code: VALIDATION_ERROR
          detail: >-
            body.email: value is not a valid email address: An email address
            must have an @-sign. (and 1 more)
          errors:
            - loc:
                - body
                - email
              msg: >-
                value is not a valid email address: An email address must have
                an @-sign.
              type: value_error
            - loc:
                - body
                - first_name
              msg: String should have at most 100 characters
              type: string_too_long
          status: 422
          title: Unprocessable Content
      properties:
        title:
          description: HTTP status phrase
          title: Title
          type: string
        status:
          description: HTTP status code, the same as the response's
          title: Status
          type: integer
        detail:
          description: Human-readable explanation of this occurrence
          title: Detail
          type: string
        code:
          description: Machine-readable error code, stable across releases
          title: Code
          type: string
        errors:
          description: Every validation failure in the request
          items:
            $ref: '#/components/schemas/ValidationErrorItem'
          title: Errors
          type: array
      required:
        - title
        - status
        - detail
        - code
        - errors
      title: ValidationProblem
      type: object
    Problem:
      description: >-
        An error response: RFC 9457 Problem Details, served as
        ``application/problem+json``.


        ``type`` is omitted, which per the RFC means ``about:blank``: ``title``
        is the status

        phrase, and ``code`` tells errors with the same status apart.
      examples:
        - code: NOT_FOUND
          detail: 'User with ID: 123e4567-e89b-12d3-a456-426614174000 not found.'
          status: 404
          title: Not Found
      properties:
        title:
          description: HTTP status phrase
          title: Title
          type: string
        status:
          description: HTTP status code, the same as the response's
          title: Status
          type: integer
        detail:
          description: Human-readable explanation of this occurrence
          title: Detail
          type: string
        code:
          description: Machine-readable error code, stable across releases
          title: Code
          type: string
      required:
        - title
        - status
        - detail
        - code
      title: Problem
      type: object
    SyncDetails:
      properties:
        workouts:
          anyOf:
            - type: integer
            - type: 'null'
          title: Workouts
          description: Workouts saved, when workouts were synced
        data_247:
          anyOf:
            - $ref: '#/components/schemas/Sync247Summary'
            - type: 'null'
      type: object
      title: SyncDetails
    ValidationErrorItem:
      properties:
        loc:
          description: Where the invalid value is, e.g. ['body', 'email']
          items:
            anyOf:
              - type: string
              - type: integer
          title: Loc
          type: array
        msg:
          description: What is wrong with it
          title: Msg
          type: string
        type:
          description: Pydantic error type, e.g. 'missing'
          title: Type
          type: string
      required:
        - loc
        - msg
        - type
      title: ValidationErrorItem
      type: object
    Sync247Summary:
      properties:
        status:
          $ref: '#/components/schemas/SyncStatus'
        items_inserted:
          anyOf:
            - type: integer
            - type: 'null'
          title: Items Inserted
        items_updated:
          anyOf:
            - type: integer
            - type: 'null'
          title: Items Updated
        items_reported:
          anyOf:
            - type: integer
            - type: 'null'
          title: Items Reported
        error_code:
          anyOf:
            - type: string
            - type: 'null'
          title: Error Code
          description: Set when the whole sync failed before any task ran
        tasks:
          additionalProperties:
            $ref: '#/components/schemas/Sync247TaskSummary'
          type: object
          title: Tasks
      type: object
      required:
        - status
        - items_inserted
        - items_updated
        - items_reported
        - tasks
      title: Sync247Summary
      description: 'A 24/7 sync: totals over its provider fetch tasks, and each task.'
    SyncStatus:
      type: string
      enum:
        - in_progress
        - success
        - partial
        - failed
        - cancelled
        - skipped
        - unfinished
        - stale
      title: SyncStatus
      description: Overall outcome state for the run.
    Sync247TaskSummary:
      properties:
        status:
          $ref: '#/components/schemas/SyncStatus'
        items_inserted:
          anyOf:
            - type: integer
            - type: 'null'
          title: Items Inserted
          description: New rows, when the write path reports the split
        items_updated:
          anyOf:
            - type: integer
            - type: 'null'
          title: Items Updated
          description: Rows refreshed in place, when the write path reports the split
        items_reported:
          anyOf:
            - type: integer
            - type: 'null'
          title: Items Reported
          description: Rows written, when only a total is known
        items_skipped:
          type: integer
          title: Items Skipped
          description: Records deliberately not stored, such as duplicates
        truncated:
          type: boolean
          title: Truncated
          description: The fetch stopped early, so the window is incomplete
        error_code:
          anyOf:
            - type: string
            - type: 'null'
          title: Error Code
          description: >-
            The provider's HTTP status (http_404) or the error's code
            (reauth_required) of the first failure
      type: object
      required:
        - status
        - items_inserted
        - items_updated
        - items_reported
        - items_skipped
        - truncated
        - error_code
      title: Sync247TaskSummary
      description: >-
        One provider fetch task of a 24/7 sync. Counters mean what they do in
        sync.data_type events.
  securitySchemes:
    OAuth2PasswordBearer:
      type: oauth2
      flows:
        password:
          scopes: {}
          tokenUrl: /api/v1/auth/login

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.