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

# Summary

> Retrieve processed workout summary data for a specific user, including type, duration, and calorie metrics.

<RequestExample>
  ```bash cURL theme={null}
  curl --request GET \
       --url {{BASE_URL}}/v2/summary/workouts/{user_id} \
       --header 'Accept: application/json' \
       --header 'x-vital-api-key: <API_KEY>'
  ```

  ```python Python theme={null}
  from junction import Junction
  from junction.environment import JunctionEnvironment

  client = Junction(
      api_key="YOUR_API_KEY",
      environment=JunctionEnvironment.SANDBOX,
  )

  data = client.workouts.get(
      "<user_id>",
      start_date="2022-05-01",
      end_date="2022-06-01",
  )
  ```

  ```typescript TypeScript theme={null}
  import { JunctionClient, JunctionEnvironment } from "@junction-api/sdk";

  const client = new JunctionClient({
      apiKey: "YOUR_API_KEY",
      environment: JunctionEnvironment.Sandbox,
  });

  const data = await client.workouts.get({
      userId: "<user_id>",
      startDate: "2022-05-01",
      endDate: "2022-06-01",
  });
  ```

  ```java Java theme={null}
  import com.junction.api.Junction;
  import com.junction.api.core.Environment;
  import com.junction.api.resources.workouts.requests.GetWorkoutsRequest;

  Junction client = Junction.builder()
      .apiKey("YOUR_API_KEY")
      .environment(Environment.SANDBOX)
      .build();

  var data = client.workouts().get(
      "<user_id>",
      GetWorkoutsRequest.builder()
          .startDate("2022-05-01")
          .endDate("2022-06-01")
          .build()
  );
  ```

  ```go Go theme={null}
  import (
      "context"

      junction "github.com/junction-api/junction-go"
      "github.com/junction-api/junction-go/client"
      "github.com/junction-api/junction-go/option"
  )

  c := client.NewClient(
      option.WithApiKey("YOUR_API_KEY"),
      option.WithBaseURL(junction.Environments.Sandbox),
  )

  endDate := "2022-06-01"
  response, err := c.Workouts.Get(context.TODO(), &junction.GetWorkoutsRequest{
      UserId:    "<user_id>",
      StartDate: "2022-05-01",
      EndDate:   &endDate,
  })
  if err != nil {
      return err
  }
  fmt.Printf("Received data %s\n", response)
  ```
</RequestExample>


## OpenAPI

````yaml GET /v2/summary/workouts/{user_id}
openapi: 3.1.0
info:
  title: Junction API
  description: https://docs.junction.com/
  version: 0.4.483
servers:
  - url: https://api.us.junction.com
    x-fern-server-name: Production
  - url: https://api.eu.junction.com
    x-fern-server-name: ProductionEU
  - url: https://api.sandbox.us.junction.com
    x-fern-server-name: Sandbox
  - url: https://api.sandbox.eu.junction.com
    x-fern-server-name: SandboxEU
security:
  - apiKeyAuth: []
paths:
  /v2/summary/workouts/{user_id}:
    get:
      tags:
        - summary
      summary: Get User Workouts
      description: Get workout summary for user_id
      operationId: get_user_workouts_v2_summary_workouts__user_id__get
      parameters:
        - name: user_id
          in: path
          required: true
          schema:
            type: string
            format: uuid
            title: >-
              User id returned by vital create user id request. This id should
              be stored in your database against the user and used for all
              interactions with the vital api.
        - name: provider
          in: query
          required: false
          schema:
            type: string
            description: Provider oura/strava etc
            default: ''
            title: Provider
          description: Provider oura/strava etc
        - name: start_date
          in: query
          required: true
          schema:
            type: string
            description: >-
              Date from in YYYY-MM-DD or ISO formatted date time. If a date is
              provided without a time, the time will be set to 00:00:00
            title: Start Date
          description: >-
            Date from in YYYY-MM-DD or ISO formatted date time. If a date is
            provided without a time, the time will be set to 00:00:00
        - name: end_date
          in: query
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            description: >-
              Date to YYYY-MM-DD or ISO formatted date time. If a date is
              provided without a time, the time will be set to 23:59:59
            title: End Date
          description: >-
            Date to YYYY-MM-DD or ISO formatted date time. If a date is provided
            without a time, the time will be set to 23:59:59
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ClientWorkoutResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
components:
  schemas:
    ClientWorkoutResponse:
      properties:
        workouts:
          items:
            $ref: '#/components/schemas/ClientFacingWorkout'
          type: array
          title: Workouts
      type: object
      required:
        - workouts
      title: ClientWorkoutResponse
      example:
        workouts:
          - average_hr: 100
            average_speed: 4.2
            average_watts: 100
            calendar_date: '2023-02-27'
            calories: 300
            created_at: '2023-02-27T20:31:24+00:00'
            device_watts: 80
            distance: 1700
            elev_high: 20.2
            elev_low: -10.2
            hr_zones:
              - 100
              - 90
              - 10
              - 10
              - 200
            id: 185d0f34-dfc0-429f-84f9-b24030914bdd
            map:
              summary_polyline: agn~Ftb{uOvr@daBunBjdBkHwiD????~Ngn@ha@_N~Ql`@
            max_hr: 190
            max_speed: 7.8
            max_watts: 200
            moving_time: 100
            source:
              device_id: 550e8400-e29b-41d4-a716-446655440000
              provider: strava
              type: unknown
            sport:
              id: 1
              name: football
            time_end: '2023-02-27T12:31:24+00:00'
            time_start: '2023-02-27T11:31:24+00:00'
            total_elevation_gain: 10
            updated_at: '2023-02-28T01:22:38+00:00'
            user_id: 1449752e-0d8a-40e0-9206-91ab099b2537
            weighted_average_watts: 250
    HTTPValidationError:
      properties:
        detail:
          title: Detail
      type: object
      title: HTTPValidationError
    ClientFacingWorkout:
      properties:
        id:
          type: string
          format: uuid
          title: Id
        user_id:
          type: string
          format: uuid
          title: User Id
          description: >-
            User id returned by vital create user request. This id should be
            stored in your database against the user and used for all
            interactions with the vital api.
        title:
          anyOf:
            - type: string
            - type: 'null'
          title: Title
          description: Title given for the workout
        timezone_offset:
          anyOf:
            - type: integer
            - type: 'null'
          title: Timezone Offset
          description: >-
            Timezone offset from UTC as seconds. For example, EEST (Eastern
            European Summer Time, +3h) is 10800. PST (Pacific Standard Time,
            -8h) is -28800::seconds
        average_hr:
          anyOf:
            - type: integer
            - type: 'null'
          title: Average Hr
          description: Average heart rate during workout::bpm
        max_hr:
          anyOf:
            - type: integer
            - type: 'null'
          title: Max Hr
          description: Max heart rate during workout::bpm
        distance:
          anyOf:
            - type: number
            - type: 'null'
          title: Distance
          description: Distance travelled during workout::meters
        calendar_date:
          type: string
          format: date
          title: Calendar Date
          description: >-
            Date of the workout summary in the YYYY-mm-dd format. This generally
            matches the workout start date.
        time_start:
          type: string
          format: date-time
          title: Time Start
          description: Start time of the workout::time
        time_end:
          type: string
          format: date-time
          title: Time End
          description: End time of the workout::time
        calories:
          anyOf:
            - type: number
            - type: 'null'
          title: Calories
          description: Calories burned during the workout::kCal
        sport:
          $ref: '#/components/schemas/ClientFacingSport'
          description: Sport's name
          default: ''
        hr_zones:
          anyOf:
            - items:
                type: integer
              type: array
            - type: 'null'
          title: Hr Zones
          description: >-
            Time in seconds spent in different heart rate zones <50%, 50-60%,
            60-70%, 70-80%, 80-90%, 90%+. Due to rounding errors, it's possible
            that summing all values is different than the total time of the
            workout. Not available for all providers::seconds
        moving_time:
          anyOf:
            - type: integer
            - type: 'null'
          title: Moving Time
          description: Time spent active during the workout::seconds
        total_elevation_gain:
          anyOf:
            - type: number
            - type: 'null'
          title: Total Elevation Gain
          description: Elevation gain during the workout::meters
        elev_high:
          anyOf:
            - type: number
            - type: 'null'
          title: Elev High
          description: Highest point of elevation::meters
        elev_low:
          anyOf:
            - type: number
            - type: 'null'
          title: Elev Low
          description: Lowest point of elevation::meters
        average_speed:
          anyOf:
            - type: number
            - type: 'null'
          title: Average Speed
          description: Average speed during workout in m/s::meters/sec
        max_speed:
          anyOf:
            - type: number
            - type: 'null'
          title: Max Speed
          description: Max speed during workout in m/s::meters/sec
        average_watts:
          anyOf:
            - type: number
            - type: 'null'
          title: Average Watts
          description: Average watts burned during exercise::watts
        device_watts:
          anyOf:
            - type: number
            - type: 'null'
          title: Device Watts
          description: Watts burned during exercise::watts
        max_watts:
          anyOf:
            - type: number
            - type: 'null'
          title: Max Watts
          description: Max watts burned during exercise::watts
        weighted_average_watts:
          anyOf:
            - type: number
            - type: 'null'
          title: Weighted Average Watts
          description: Weighted average watts burned during exercise::watts
        steps:
          anyOf:
            - type: integer
            - type: 'null'
          title: Steps
          description: Number of steps accumulated during this workout::count
        map:
          anyOf:
            - $ref: '#/components/schemas/ClientFacingWorkoutMap'
            - type: 'null'
          description: Map of the workout
        provider_id:
          type: string
          title: Provider Id
          description: Provider ID given for that specific workout
        source:
          $ref: '#/components/schemas/ClientFacingSource'
          description: Source the data has come from.
        created_at:
          type: string
          format: date-time
          title: Created At
        updated_at:
          type: string
          format: date-time
          title: Updated At
      type: object
      required:
        - id
        - user_id
        - calendar_date
        - time_start
        - time_end
        - provider_id
        - source
        - created_at
        - updated_at
      title: Workout Data
      example:
        average_hr: 100
        average_speed: 4.2
        average_watts: 100
        calendar_date: '2023-02-27'
        calories: 300
        created_at: '2023-02-27T20:31:24+00:00'
        device_watts: 80
        distance: 1700
        elev_high: 20.2
        elev_low: -10.2
        hr_zones:
          - 100
          - 90
          - 10
          - 10
          - 200
        id: 185d0f34-dfc0-429f-84f9-b24030914bdd
        map:
          summary_polyline: agn~Ftb{uOvr@daBunBjdBkHwiD????~Ngn@ha@_N~Ql`@
        max_hr: 190
        max_speed: 7.8
        max_watts: 200
        moving_time: 100
        source:
          device_id: 550e8400-e29b-41d4-a716-446655440000
          provider: strava
          type: unknown
        sport:
          id: 1
          name: football
        time_end: '2023-02-27T12:31:24+00:00'
        time_start: '2023-02-27T11:31:24+00:00'
        total_elevation_gain: 10
        updated_at: '2023-02-28T01:22:38+00:00'
        user_id: 1449752e-0d8a-40e0-9206-91ab099b2537
        weighted_average_watts: 250
    ClientFacingSport:
      properties:
        id:
          type: integer
          title: Id
          description: This ID is unstable across environments. Use the slug instead.
          deprecated: true
        name:
          type: string
          title: Name
          description: Sport's name
        slug:
          type: string
          title: Slug
          description: Slug for designated sport
      type: object
      required:
        - id
        - name
        - slug
      title: ClientFacingSport
    ClientFacingWorkoutMap:
      properties:
        polyline:
          anyOf:
            - type: string
            - type: 'null'
          title: Polyline
          description: Polyline of the map
        summary_polyline:
          anyOf:
            - type: string
            - type: 'null'
          title: Summary Polyline
          description: A lower resolution summary of the polyline
      type: object
      title: ClientFacingWorkoutMap
    ClientFacingSource:
      properties:
        provider:
          type: string
          title: Provider
          description: Provider slug. e.g., `oura`, `fitbit`, `garmin`.
        type:
          type: string
          title: Type
          description: >-
            The type of the data source (app or device) by which the summary or
            the timeseries data were recorded. This defaults to `unknown` when
            Vital cannot extract or infer that information
          default: unknown
        app_id:
          anyOf:
            - type: string
            - type: 'null'
          title: App Id
          description: >-
            The identifier of the app which recorded this summary. This is only
            applicable to multi-source providers like Apple Health and Android
            Health Connect.
        device_id:
          anyOf:
            - type: string
              format: uuid
            - type: 'null'
          title: Device Id
          description: The identifier of the device which recorded this summary.
        sport:
          anyOf:
            - type: string
            - type: 'null'
          title: Sport
          description: >

            For workout stream timeseries, this is the standard sport slug of
            the workout with which the timeseries data are associated.


            For the `distance` timeseries, this is `wheelchair_pushing` if the
            user is a wheelchair user, or `null` otherwise.


            For all summary types and non-workout timeseries, this is always
            `null`.
        workout_id:
          anyOf:
            - type: string
              format: uuid
            - type: 'null'
          title: Workout Id
          description: >

            For workout stream timeseries, this is the workout ID with which the
            timeseries data are associated.


            For all other types, this is always `null`.
        name:
          type: string
          title: Name
          description: Deprecated. Subject to removal after 1 Jan 2024.
          default: ''
          deprecated: true
        slug:
          type: string
          title: Slug
          description: >-
            Deprecated. Use `provider` instead. Subject to removal after 1 Jan
            2024.
          default: ''
          deprecated: true
        logo:
          type: string
          title: Logo
          description: Deprecated. Subject to removal after 1 Jan 2024.
          default: ''
          deprecated: true
      type: object
      required:
        - provider
      title: Source
      description: |-
        Source summarizes where a sample or a summary is sourced from.
        At minimum, the source provider is always included.
      example:
        provider: oura
        type: ring
  securitySchemes:
    apiKeyAuth:
      type: apiKey
      in: header
      name: x-vital-api-key
      description: Vital Team API Key

````