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

# Get Workout Totals

> Returns the count, duration, energy and distance of the workouts the same filters would list.

Added up in the database, so it covers every matching workout however many
there are, without paging through them.



## OpenAPI

````yaml /openapi.json get /api/v1/users/{user_id}/events/workouts/totals
openapi: 3.1.0
info:
  title: Open Wearables API
  version: 1.0.0
servers: []
security: []
paths:
  /api/v1/users/{user_id}/events/workouts/totals:
    get:
      tags:
        - 'External: Events'
      summary: Get Workout Totals
      description: >-
        Returns the count, duration, energy and distance of the workouts the
        same filters would list.


        Added up in the database, so it covers every matching workout however
        many

        there are, without paging through them.
      operationId: get_workout_totals_api_v1_users__user_id__events_workouts_totals_get
      parameters:
        - name: user_id
          in: path
          required: true
          schema:
            type: string
            format: uuid
            title: User Id
        - name: start_date
          in: query
          required: true
          schema:
            type: string
            description: >-
              ISO 8601 datetime (e.g. `2023-11-07T05:31:56Z`) or Unix timestamp
              in seconds. Date-only strings (e.g. `2023-11-07`) are also
              accepted and cover the whole day, so a date-only range includes
              both boundary days.
            examples:
              - '2023-11-07T05:31:56Z'
              - '2023-11-07'
            format: date-time
            title: Start Date
          description: >-
            ISO 8601 datetime (e.g. `2023-11-07T05:31:56Z`) or Unix timestamp in
            seconds. Date-only strings (e.g. `2023-11-07`) are also accepted and
            cover the whole day, so a date-only range includes both boundary
            days.
        - name: end_date
          in: query
          required: true
          schema:
            type: string
            description: >-
              ISO 8601 datetime (e.g. `2023-11-07T05:31:56Z`) or Unix timestamp
              in seconds. Date-only strings (e.g. `2023-11-07`) are also
              accepted and cover the whole day, so a date-only range includes
              both boundary days.
            examples:
              - '2023-11-07T05:31:56Z'
              - '2023-11-07'
            format: date-time
            title: End Date
          description: >-
            ISO 8601 datetime (e.g. `2023-11-07T05:31:56Z`) or Unix timestamp in
            seconds. Date-only strings (e.g. `2023-11-07`) are also accepted and
            cover the whole day, so a date-only range includes both boundary
            days.
        - name: record_type
          in: query
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            title: Record Type
        - name: type
          in: query
          required: false
          schema:
            anyOf:
              - $ref: '#/components/schemas/WorkoutType'
              - type: 'null'
            description: >-
              Exact normalized workout type. Unlike `record_type`, does not
              substring-match.
            title: Type
          description: >-
            Exact normalized workout type. Unlike `record_type`, does not
            substring-match.
        - name: provider
          in: query
          required: false
          schema:
            anyOf:
              - $ref: '#/components/schemas/ProviderName'
              - type: 'null'
            title: Provider
        - name: source
          in: query
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            title: Source
        - name: device_model
          in: query
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            title: Device Model
        - name: data_source_id
          in: query
          required: false
          schema:
            anyOf:
              - type: string
                format: uuid
              - type: 'null'
            title: Data Source Id
        - name: source_selection
          in: query
          required: false
          schema:
            anyOf:
              - enum:
                  - all
                  - per_session
                type: string
              - type: 'null'
            description: >-
              `all` returns every source's sessions. `per_session` drops a
              session when the sessions of one source ranked higher by provider,
              then device type priority, cover at least
              `SESSION_DUPLICATE_OVERLAP` of it (default 0.5); sessions nothing
              better covers stay, and equally ranked sources never hide each
              other. Source filters narrow which sessions compete. Defaults to
              `all`.
            title: Source Selection
          description: >-
            `all` returns every source's sessions. `per_session` drops a session
            when the sessions of one source ranked higher by provider, then
            device type priority, cover at least `SESSION_DUPLICATE_OVERLAP` of
            it (default 0.5); sessions nothing better covers stay, and equally
            ranked sources never hide each other. Source filters narrow which
            sessions compete. Defaults to `all`.
        - 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:
                $ref: '#/components/schemas/WorkoutTotals'
        '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:
    WorkoutType:
      type: string
      enum:
        - running
        - trail_running
        - treadmill
        - walking
        - hiking
        - mountaineering
        - cycling
        - mountain_biking
        - indoor_cycling
        - cyclocross
        - swimming
        - pool_swimming
        - open_water_swimming
        - strength_training
        - cardio_training
        - fitness_equipment
        - elliptical
        - rowing_machine
        - stair_climbing
        - yoga
        - pilates
        - stretching
        - meditation
        - cross_country_skiing
        - alpine_skiing
        - backcountry_skiing
        - downhill_skiing
        - snowboarding
        - snowshoeing
        - ice_skating
        - snowmobiling
        - winter_sports
        - snow_sports
        - rowing
        - kayaking
        - canoeing
        - paddling
        - stand_up_paddleboarding
        - surfing
        - kitesurfing
        - windsurfing
        - sailing
        - water_polo
        - wakeboarding
        - water_skiing
        - boating
        - water_sports
        - soccer
        - basketball
        - football
        - american_football
        - baseball
        - tennis
        - badminton
        - volleyball
        - handball
        - rugby
        - hockey
        - floorball
        - lacrosse
        - cricket
        - squash
        - table_tennis
        - padel
        - pickleball
        - racquetball
        - racket_sports
        - boxing
        - martial_arts
        - wrestling
        - fencing
        - rock_climbing
        - indoor_climbing
        - bouldering
        - trail_hiking
        - orienteering
        - archery
        - fishing
        - hunting
        - paragliding
        - parkour
        - golf
        - skating
        - inline_skating
        - skateboarding
        - horseback_riding
        - gymnastics
        - bowling
        - curling
        - disc_sports
        - triathlon
        - multisport
        - motorcycling
        - motor_sports
        - dance
        - aerobics
        - group_exercise
        - e_biking
        - virtual_activity
        - diving
        - snorkeling
        - walking_fitness
        - casual_walking
        - transition
        - team_sports
        - para_sports
        - play
        - wheelchair
        - recovery
        - gaming
        - chores
        - lifestyle
        - work
        - operations
        - generic
        - other
        - sport
      title: WorkoutType
      description: >-
        Unified workout/activity types for Polar, Suunto, and Garmin.


        Based on FIT SDK sport types and common activities across platforms.

        Excludes branded/niche activities (e.g., LES MILLS classes, specific
        dance types).
    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.
    WorkoutTotals:
      properties:
        count:
          type: integer
          title: Count
          description: Workouts that match the filters
          example: 42
        duration_seconds:
          type: integer
          title: Duration Seconds
          description: Sum of their durations
          example: 95400
        calories_kcal:
          anyOf:
            - type: number
            - type: 'null'
          title: Calories Kcal
          description: Sum of reported energy burned; null when none reported any
          example: 18250.5
        distance_meters:
          anyOf:
            - type: number
            - type: 'null'
          title: Distance Meters
          description: Sum of reported distance; null when none reported any
          example: 212400
      type: object
      required:
        - count
        - duration_seconds
      title: WorkoutTotals
      description: Workouts matching a filter, added up in the database rather than paged.
    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
    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
  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.