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

# Get Sleep

> This endpoint returns sleep data including different sleep stages that represent the various phases of sleep a person goes through during a sleep cycle. Each stage is characterized by distinct physiological and neurological patterns.

The different sleep stages are:

- **awake**: The state of being fully conscious and alert.
- **sleeping**: A general term for being in a state of sleep.
- **out_of_bed**: The state when a person is not in bed, possibly indicating a brief interruption in sleep.
- **light**: A stage of sleep where the body begins to relax, and the heart rate slows down. It is easier to wake up from this stage.
- **deep**: A restorative stage of sleep where the body repairs and regrows tissues, builds bone and muscle, and strengthens the immune system.
- **rem**: Rapid Eye Movement sleep, a stage where dreaming occurs, and the brain is very active. It plays a role in memory consolidation and mood regulation.
- **awake_in_bed**: The state of being awake while still in bed, often occurring before falling asleep or after waking up.
- **nap**: A short sleep, typically taken during the day, that can help improve alertness and performance.
- **unknown**: A stage that cannot be classified into any of the known categories, possibly due to insufficient data or anomalies in the sleep pattern.


### Sleep Attribution Date

The sleep date attribution follows two simple rules to determine which date a sleep record should be associated with:

1. **Provider Payload Date**: The primary source of truth is the date provided in the payload from the sleep tracking provider. This date is used if available.

2. **End Date Rule**: If the provider payload date is not available, the sleep date is attributed to the day on which the sleep session ended.

This straightforward approach ensures consistent date attribution for sleep records, regardless of when the sleep session started or ended.


### Main Sleep and Nap

There are two types of sleep: main sleep and nap. There can be only one main sleep per day, which is the longest sleep period. A nap is a shorter sleep taken during the day and will have a `sleep_duration_nap` value.


### Sleep Durations

Total sleep duration is the sum of the durations of light, deep, and REM sleep stages, while total time in bed also includes time spent awake.
```
total sleep = light + deep + rem
time in bed = total sleep + awake
```
Note that nap time is not included in the total sleep time for a day.
Sleep latency refers to the estimated time from when rest begins until the first occurrence of light or deep sleep. The accuracy of sleep stages and latency depends entirely on the provider’s sensors and calculations.
Sleep duration values are reported in milliseconds.



## OpenAPI

````yaml get /queries/sleeps/{sleep_id}
openapi: 3.1.0
info:
  title: Application user API
  version: 3.0.2
servers:
  - url: https://app-api.spikeapi.com/v3
security: []
paths:
  /queries/sleeps/{sleep_id}:
    get:
      tags:
        - Queries / Sleep
      summary: Get Sleep
      description: >-
        This endpoint returns sleep data including different sleep stages that
        represent the various phases of sleep a person goes through during a
        sleep cycle. Each stage is characterized by distinct physiological and
        neurological patterns.


        The different sleep stages are:


        - **awake**: The state of being fully conscious and alert.

        - **sleeping**: A general term for being in a state of sleep.

        - **out_of_bed**: The state when a person is not in bed, possibly
        indicating a brief interruption in sleep.

        - **light**: A stage of sleep where the body begins to relax, and the
        heart rate slows down. It is easier to wake up from this stage.

        - **deep**: A restorative stage of sleep where the body repairs and
        regrows tissues, builds bone and muscle, and strengthens the immune
        system.

        - **rem**: Rapid Eye Movement sleep, a stage where dreaming occurs, and
        the brain is very active. It plays a role in memory consolidation and
        mood regulation.

        - **awake_in_bed**: The state of being awake while still in bed, often
        occurring before falling asleep or after waking up.

        - **nap**: A short sleep, typically taken during the day, that can help
        improve alertness and performance.

        - **unknown**: A stage that cannot be classified into any of the known
        categories, possibly due to insufficient data or anomalies in the sleep
        pattern.



        ### Sleep Attribution Date


        The sleep date attribution follows two simple rules to determine which
        date a sleep record should be associated with:


        1. **Provider Payload Date**: The primary source of truth is the date
        provided in the payload from the sleep tracking provider. This date is
        used if available.


        2. **End Date Rule**: If the provider payload date is not available, the
        sleep date is attributed to the day on which the sleep session ended.


        This straightforward approach ensures consistent date attribution for
        sleep records, regardless of when the sleep session started or ended.



        ### Main Sleep and Nap


        There are two types of sleep: main sleep and nap. There can be only one
        main sleep per day, which is the longest sleep period. A nap is a
        shorter sleep taken during the day and will have a `sleep_duration_nap`
        value.



        ### Sleep Durations


        Total sleep duration is the sum of the durations of light, deep, and REM
        sleep stages, while total time in bed also includes time spent awake.

        ```

        total sleep = light + deep + rem

        time in bed = total sleep + awake

        ```

        Note that nap time is not included in the total sleep time for a day.

        Sleep latency refers to the estimated time from when rest begins until
        the first occurrence of light or deep sleep. The accuracy of sleep
        stages and latency depends entirely on the provider’s sensors and
        calculations.

        Sleep duration values are reported in milliseconds.
      operationId: getQueriesSleepsBySleepId
      parameters:
        - description: Sleep ID
          in: path
          name: sleep_id
          required: true
          schema:
            description: Sleep ID
            type: string
        - description: Include stages
          explode: false
          in: query
          name: include_stages
          schema:
            description: Include stages
            type: boolean
        - description: Include samples
          explode: false
          in: query
          name: include_samples
          schema:
            description: Include samples
            type: boolean
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/QueryOutputSleep'
          description: OK
        '400':
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ErrorModel'
          description: Bad Request
        '401':
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ErrorModel'
          description: Unauthorized
        '404':
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ErrorModel'
          description: Not Found
        '422':
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ErrorModel'
          description: Unprocessable Entity
        '500':
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ErrorModel'
          description: Internal Server Error
      security:
        - bearer: []
components:
  schemas:
    QueryOutputSleep:
      additionalProperties: false
      properties:
        duration:
          description: Record duration
          format: int64
          type: integer
        end_at_timestamp:
          description: Record end time
          format: date-time
          type: string
        input_method:
          description: Data input method
          enum:
            - unknown
            - manual
            - device
          type: string
        metrics:
          description: Metrics output
          properties:
            air_temperature:
              description: air_temperature in celsius
              examples:
                - 22.73
              type: number
            air_temperature_max:
              description: air_temperature_max in celsius
              examples:
                - 28.55
              type: number
            air_temperature_min:
              description: air_temperature_min in celsius
              examples:
                - 15.27
              type: number
            ascent:
              description: ascent in meters
              examples:
                - 320.29
              type: number
            basal_body_temperature:
              description: basal_body_temperature in celsius
              examples:
                - 36.53
              type: number
            basal_body_temperature_max:
              description: basal_body_temperature_max in celsius
              examples:
                - 37.03
              type: number
            basal_body_temperature_min:
              description: basal_body_temperature_min in celsius
              examples:
                - 36.01
              type: number
            bedtime_duration:
              description: bedtime_duration in ms
              examples:
                - 28800000
              type: number
            blood_pressure_diastolic:
              description: blood_pressure_diastolic in mmHg
              examples:
                - 80.03
              type: number
            blood_pressure_diastolic_max:
              description: blood_pressure_diastolic_max in mmHg
              examples:
                - 90.07
              type: number
            blood_pressure_diastolic_min:
              description: blood_pressure_diastolic_min in mmHg
              examples:
                - 60.01
              type: number
            blood_pressure_systolic:
              description: blood_pressure_systolic in mmHg
              examples:
                - 120.03
              type: number
            blood_pressure_systolic_max:
              description: blood_pressure_systolic_max in mmHg
              examples:
                - 140.07
              type: number
            blood_pressure_systolic_min:
              description: blood_pressure_systolic_min in mmHg
              examples:
                - 100.01
              type: number
            body_bone_mass:
              description: body_bone_mass in g
              examples:
                - 3200
              type: number
            body_fat:
              description: body_fat in percentage
              examples:
                - 18.53
              type: number
            body_fat_max:
              description: body_fat_max in percentage
              examples:
                - 25.03
              type: number
            body_fat_min:
              description: body_fat_min in percentage
              examples:
                - 12.01
              type: number
            body_mass_index:
              description: body_mass_index in count
              examples:
                - 22.5016
              type: number
            body_temperature:
              description: body_temperature in celsius
              examples:
                - 36.73
              type: number
            body_temperature_max:
              description: body_temperature_max in celsius
              examples:
                - 37.55
              type: number
            body_temperature_min:
              description: body_temperature_min in celsius
              examples:
                - 36.13
              type: number
            breathing_rate:
              description: breathing_rate in breaths/min
              examples:
                - 16.5016
              type: number
            breathing_rate_max:
              description: breathing_rate_max in breaths/min
              examples:
                - 24.7549
              type: number
            breathing_rate_min:
              description: breathing_rate_min in breaths/min
              examples:
                - 12.2534
              type: number
            cadence:
              description: cadence in rpm
              examples:
                - 85.5016
              type: number
            cadence_max:
              description: cadence_max in rpm
              examples:
                - 110.0049
              type: number
            cadence_min:
              description: cadence_min in rpm
              examples:
                - 60.0034
              type: number
            calories_burned:
              description: calories_burned in kcal
              examples:
                - 1650.7549
              type: number
            calories_burned_active:
              description: calories_burned_active in kcal
              examples:
                - 450.2516
              type: number
            calories_burned_basal:
              description: calories_burned_basal in kcal
              examples:
                - 1200.5034
              type: number
            calories_intake:
              description: calories_intake in kcal
              examples:
                - 2100.5016
              type: number
            descent:
              description: descent in meters
              examples:
                - 280.91
              type: number
            distance:
              description: distance in meters
              examples:
                - 6500.2516
              type: number
            distance_cycling:
              description: distance_cycling in meters
              examples:
                - 15000.7549
              type: number
            distance_running:
              description: distance_running in meters
              examples:
                - 5000.5016
              type: number
            distance_swimming:
              description: distance_swimming in meters
              examples:
                - 1000.7549
              type: number
            distance_walking:
              description: distance_walking in meters
              examples:
                - 3200.5034
              type: number
            distance_wheelchair:
              description: distance_wheelchair in meters
              examples:
                - 2800.5034
              type: number
            duration_active:
              description: duration_active in ms
              examples:
                - 5400000
              type: number
            duration_high_intensity:
              description: duration_high_intensity in ms
              examples:
                - 1200000
              type: number
            duration_low_intensity:
              description: duration_low_intensity in ms
              examples:
                - 9000000
              type: number
            duration_moderate_intensity:
              description: duration_moderate_intensity in ms
              examples:
                - 2400000
              type: number
            ecg_rri:
              description: ecg_rri in ms
              examples:
                - 850
              type: number
            ecg_voltage:
              description: ecg_voltage in uV
              examples:
                - 1200.53
              type: number
            elevation:
              description: elevation in meters
              examples:
                - 1050.73
              type: number
            elevation_gain:
              description: elevation_gain in meters
              examples:
                - 450.83
              type: number
            elevation_loss:
              description: elevation_loss in meters
              examples:
                - 380.47
              type: number
            elevation_max:
              description: elevation_max in meters
              examples:
                - 1250.55
              type: number
            elevation_min:
              description: elevation_min in meters
              examples:
                - 850.37
              type: number
            floors_climbed:
              description: floors_climbed in count
              examples:
                - 12
              type: number
            glucose:
              description: glucose in mg/dL
              examples:
                - 95.654321
              type: number
            heartrate:
              description: heartrate in bpm
              examples:
                - 90
              type: number
            heartrate_max:
              description: heartrate_max in bpm
              examples:
                - 180
              type: number
            heartrate_min:
              description: heartrate_min in bpm
              examples:
                - 60
              type: number
            heartrate_resting:
              description: heartrate_resting in bpm
              examples:
                - 70
              type: number
            heartrate_resting_max:
              description: heartrate_resting_max in bpm
              examples:
                - 85
              type: number
            heartrate_resting_min:
              description: heartrate_resting_min in bpm
              examples:
                - 60
              type: number
            heartrate_zone0_duration:
              description: heartrate_zone0_duration in ms
              examples:
                - 5000
              type: number
            heartrate_zone1_duration:
              description: heartrate_zone1_duration in ms
              examples:
                - 7152
              type: number
            heartrate_zone2_duration:
              description: heartrate_zone2_duration in ms
              examples:
                - 25000
              type: number
            heartrate_zone3_duration:
              description: heartrate_zone3_duration in ms
              examples:
                - 18170
              type: number
            heartrate_zone4_duration:
              description: heartrate_zone4_duration in ms
              examples:
                - 6372
              type: number
            heartrate_zone5_duration:
              description: heartrate_zone5_duration in ms
              examples:
                - 2000
              type: number
            height:
              description: height in meters
              examples:
                - 1.7549
              type: number
            hrv_rmssd:
              description: hrv_rmssd in ms
              examples:
                - 45
              type: number
            hrv_sdnn:
              description: hrv_sdnn in ms
              examples:
                - 52
              type: number
            latitude:
              description: latitude in degrees
              examples:
                - 37.77492948
              type: number
            longitude:
              description: longitude in degrees
              examples:
                - -122.41941637
              type: number
            pace:
              description: pace in sec/m
              examples:
                - 3.53
              type: number
            power:
              description: power in w
              examples:
                - 125
              type: number
            power_max:
              description: power_max in w
              examples:
                - 125
              type: number
            skin_temperature:
              description: skin_temperature in celsius
              examples:
                - 33.53
              type: number
            skin_temperature_max:
              description: skin_temperature_max in celsius
              examples:
                - 34.27
              type: number
            skin_temperature_min:
              description: skin_temperature_min in celsius
              examples:
                - 32.89
              type: number
            sleep_breathing_rate:
              description: sleep_breathing_rate in breaths/min
              examples:
                - 14.27
              type: number
            sleep_breathing_rate_max:
              description: sleep_breathing_rate_max in breaths/min
              examples:
                - 18.59
              type: number
            sleep_breathing_rate_min:
              description: sleep_breathing_rate_min in breaths/min
              examples:
                - 10.03
              type: number
            sleep_duration:
              description: sleep_duration in ms
              examples:
                - 25200000
              type: number
            sleep_duration_awake:
              description: sleep_duration_awake in ms
              examples:
                - 1800000
              type: number
            sleep_duration_deep:
              description: sleep_duration_deep in ms
              examples:
                - 5400000
              type: number
            sleep_duration_light:
              description: sleep_duration_light in ms
              examples:
                - 12600000
              type: number
            sleep_duration_nap:
              description: sleep_duration_nap in ms
              examples:
                - 3600000
              type: number
            sleep_duration_rem:
              description: sleep_duration_rem in ms
              examples:
                - 3600000
              type: number
            sleep_efficiency:
              description: sleep_efficiency in percentage
              examples:
                - 92
              type: number
            sleep_interruptions:
              description: sleep_interruptions in count
              examples:
                - 2
              type: number
            sleep_latency:
              description: sleep_latency in ms
              examples:
                - 900000
              type: number
            sleep_score:
              description: sleep_score in percentage
              examples:
                - 85
              type: number
            sleep_skin_temperature_deviation:
              description: sleep_skin_temperature_deviation in celsius
              examples:
                - -0.13
              type: number
            speed:
              description: speed in m/sec
              examples:
                - 3.2516
              type: number
            speed_max:
              description: speed_max in m/sec
              examples:
                - 8.5034
              type: number
            speed_min:
              description: speed_min in m/sec
              examples:
                - 0.5016
              type: number
            spo2:
              description: spo2 in percentage
              examples:
                - 98.5016
              type: number
            spo2_max:
              description: spo2_max in percentage
              examples:
                - 99.5034
              type: number
            spo2_min:
              description: spo2_min in percentage
              examples:
                - 95.2516
              type: number
            steps:
              description: steps in count
              examples:
                - 8500
              type: number
            swimming_distance_per_stroke:
              description: swimming_distance_per_stroke in meters
              examples:
                - 2.27
              type: number
            swimming_lengths:
              description: swimming_lengths in count
              examples:
                - 40
              type: number
            vo2max:
              description: vo2max in mL/kg/min
              examples:
                - 45.23
              type: number
            wakeup_latency:
              description: wakeup_latency in ms
              examples:
                - 600000
              type: number
            weight:
              description: weight in g
              examples:
                - 70000.5034
              type: number
          type: object
        modified_at:
          description: Modified at
          format: date-time
          type: string
        provider_slug:
          description: Provider slugs
          examples:
            - strava
            - omron_eu
            - omron_us
            - health_connect
            - fitbit
            - garmin
            - huawei
            - dexcom
            - whoop
            - withings
            - suunto
            - apple
            - freestyle_libre
            - oura
            - polar
            - coros
            - ultrahuman
            - samsung_health_data
            - luna
          type: string
        record_ids:
          items:
            description: Unique identifier for a record.
            examples:
              - 12345678-1234-abcd-4321-abcdef123456
            format: uuid
            type: string
          type:
            - array
            - 'null'
        samples:
          $ref: '#/components/schemas/QueryOutputActivitySleepSamples'
        score:
          format: int64
          type: integer
        sleep_date:
          description: Calendar date for which the sleep is attributed
          examples:
            - '2006-01-02'
          format: date
        sleep_id:
          contentEncoding: base64
          type: string
        source:
          $ref: '#/components/schemas/QueryOutputSourceInfo'
        stages:
          items:
            $ref: '#/components/schemas/QueryOutputSleepStage'
          type:
            - array
            - 'null'
        start_at_timestamp:
          description: Record start time
          format: date-time
          type: string
        user_time_offset_minutes:
          description: User time offset in minutes
          format: int32
          type: integer
      required:
        - start_at_timestamp
        - modified_at
      type: object
    ErrorModel:
      additionalProperties: false
      properties:
        detail:
          description: >-
            A human-readable explanation specific to this occurrence of the
            problem.
          examples:
            - Property foo is required but is missing.
          type: string
        errors:
          description: Optional list of individual error details
          items:
            $ref: '#/components/schemas/ErrorDetail'
          type:
            - array
            - 'null'
        instance:
          description: >-
            A URI reference that identifies the specific occurrence of the
            problem.
          examples:
            - https://example.com/error-log/abc123
          format: uri
          type: string
        status:
          description: HTTP status code
          examples:
            - 400
          format: int64
          type: integer
        title:
          description: >-
            A short, human-readable summary of the problem type. This value
            should not change between occurrences of the error.
          examples:
            - Bad Request
          type: string
        type:
          default: about:blank
          description: A URI reference to human-readable documentation for the error.
          examples:
            - https://example.com/errors/example
          format: uri
          type: string
      type: object
    QueryOutputActivitySleepSamples:
      additionalProperties: false
      properties:
        durations:
          items:
            format: int64
            type: integer
          type:
            - array
            - 'null'
        offsets:
          items:
            format: int64
            type: integer
          type:
            - array
            - 'null'
        values:
          properties:
            air_temperature:
              items:
                oneOf:
                  - type: number
                  - type: 'null'
              type: array
            air_temperature_max:
              items:
                oneOf:
                  - type: number
                  - type: 'null'
              type: array
            air_temperature_min:
              items:
                oneOf:
                  - type: number
                  - type: 'null'
              type: array
            ascent:
              items:
                oneOf:
                  - type: number
                  - type: 'null'
              type: array
            basal_body_temperature:
              items:
                oneOf:
                  - type: number
                  - type: 'null'
              type: array
            basal_body_temperature_max:
              items:
                oneOf:
                  - type: number
                  - type: 'null'
              type: array
            basal_body_temperature_min:
              items:
                oneOf:
                  - type: number
                  - type: 'null'
              type: array
            bedtime_duration:
              items:
                oneOf:
                  - type: number
                  - type: 'null'
              type: array
            blood_pressure_diastolic:
              items:
                oneOf:
                  - type: number
                  - type: 'null'
              type: array
            blood_pressure_diastolic_max:
              items:
                oneOf:
                  - type: number
                  - type: 'null'
              type: array
            blood_pressure_diastolic_min:
              items:
                oneOf:
                  - type: number
                  - type: 'null'
              type: array
            blood_pressure_systolic:
              items:
                oneOf:
                  - type: number
                  - type: 'null'
              type: array
            blood_pressure_systolic_max:
              items:
                oneOf:
                  - type: number
                  - type: 'null'
              type: array
            blood_pressure_systolic_min:
              items:
                oneOf:
                  - type: number
                  - type: 'null'
              type: array
            body_bone_mass:
              items:
                oneOf:
                  - type: number
                  - type: 'null'
              type: array
            body_fat:
              items:
                oneOf:
                  - type: number
                  - type: 'null'
              type: array
            body_fat_max:
              items:
                oneOf:
                  - type: number
                  - type: 'null'
              type: array
            body_fat_min:
              items:
                oneOf:
                  - type: number
                  - type: 'null'
              type: array
            body_mass_index:
              items:
                oneOf:
                  - type: number
                  - type: 'null'
              type: array
            body_temperature:
              items:
                oneOf:
                  - type: number
                  - type: 'null'
              type: array
            body_temperature_max:
              items:
                oneOf:
                  - type: number
                  - type: 'null'
              type: array
            body_temperature_min:
              items:
                oneOf:
                  - type: number
                  - type: 'null'
              type: array
            breathing_rate:
              items:
                oneOf:
                  - type: number
                  - type: 'null'
              type: array
            breathing_rate_max:
              items:
                oneOf:
                  - type: number
                  - type: 'null'
              type: array
            breathing_rate_min:
              items:
                oneOf:
                  - type: number
                  - type: 'null'
              type: array
            cadence:
              items:
                oneOf:
                  - type: number
                  - type: 'null'
              type: array
            cadence_max:
              items:
                oneOf:
                  - type: number
                  - type: 'null'
              type: array
            cadence_min:
              items:
                oneOf:
                  - type: number
                  - type: 'null'
              type: array
            calories_burned:
              items:
                oneOf:
                  - type: number
                  - type: 'null'
              type: array
            calories_burned_active:
              items:
                oneOf:
                  - type: number
                  - type: 'null'
              type: array
            calories_burned_basal:
              items:
                oneOf:
                  - type: number
                  - type: 'null'
              type: array
            calories_intake:
              items:
                oneOf:
                  - type: number
                  - type: 'null'
              type: array
            descent:
              items:
                oneOf:
                  - type: number
                  - type: 'null'
              type: array
            distance:
              items:
                oneOf:
                  - type: number
                  - type: 'null'
              type: array
            distance_cycling:
              items:
                oneOf:
                  - type: number
                  - type: 'null'
              type: array
            distance_running:
              items:
                oneOf:
                  - type: number
                  - type: 'null'
              type: array
            distance_swimming:
              items:
                oneOf:
                  - type: number
                  - type: 'null'
              type: array
            distance_walking:
              items:
                oneOf:
                  - type: number
                  - type: 'null'
              type: array
            distance_wheelchair:
              items:
                oneOf:
                  - type: number
                  - type: 'null'
              type: array
            duration_active:
              items:
                oneOf:
                  - type: number
                  - type: 'null'
              type: array
            duration_high_intensity:
              items:
                oneOf:
                  - type: number
                  - type: 'null'
              type: array
            duration_low_intensity:
              items:
                oneOf:
                  - type: number
                  - type: 'null'
              type: array
            duration_moderate_intensity:
              items:
                oneOf:
                  - type: number
                  - type: 'null'
              type: array
            ecg_rri:
              items:
                oneOf:
                  - type: number
                  - type: 'null'
              type: array
            ecg_voltage:
              items:
                oneOf:
                  - type: number
                  - type: 'null'
              type: array
            elevation:
              items:
                oneOf:
                  - type: number
                  - type: 'null'
              type: array
            elevation_gain:
              items:
                oneOf:
                  - type: number
                  - type: 'null'
              type: array
            elevation_loss:
              items:
                oneOf:
                  - type: number
                  - type: 'null'
              type: array
            elevation_max:
              items:
                oneOf:
                  - type: number
                  - type: 'null'
              type: array
            elevation_min:
              items:
                oneOf:
                  - type: number
                  - type: 'null'
              type: array
            floors_climbed:
              items:
                oneOf:
                  - type: number
                  - type: 'null'
              type: array
            glucose:
              items:
                oneOf:
                  - type: number
                  - type: 'null'
              type: array
            heartrate:
              items:
                oneOf:
                  - type: number
                  - type: 'null'
              type: array
            heartrate_max:
              items:
                oneOf:
                  - type: number
                  - type: 'null'
              type: array
            heartrate_min:
              items:
                oneOf:
                  - type: number
                  - type: 'null'
              type: array
            heartrate_resting:
              items:
                oneOf:
                  - type: number
                  - type: 'null'
              type: array
            heartrate_resting_max:
              items:
                oneOf:
                  - type: number
                  - type: 'null'
              type: array
            heartrate_resting_min:
              items:
                oneOf:
                  - type: number
                  - type: 'null'
              type: array
            heartrate_zone0_duration:
              items:
                oneOf:
                  - type: number
                  - type: 'null'
              type: array
            heartrate_zone1_duration:
              items:
                oneOf:
                  - type: number
                  - type: 'null'
              type: array
            heartrate_zone2_duration:
              items:
                oneOf:
                  - type: number
                  - type: 'null'
              type: array
            heartrate_zone3_duration:
              items:
                oneOf:
                  - type: number
                  - type: 'null'
              type: array
            heartrate_zone4_duration:
              items:
                oneOf:
                  - type: number
                  - type: 'null'
              type: array
            heartrate_zone5_duration:
              items:
                oneOf:
                  - type: number
                  - type: 'null'
              type: array
            height:
              items:
                oneOf:
                  - type: number
                  - type: 'null'
              type: array
            hrv_rmssd:
              items:
                oneOf:
                  - type: number
                  - type: 'null'
              type: array
            hrv_sdnn:
              items:
                oneOf:
                  - type: number
                  - type: 'null'
              type: array
            latitude:
              items:
                oneOf:
                  - type: number
                  - type: 'null'
              type: array
            longitude:
              items:
                oneOf:
                  - type: number
                  - type: 'null'
              type: array
            pace:
              items:
                oneOf:
                  - type: number
                  - type: 'null'
              type: array
            power:
              items:
                oneOf:
                  - type: number
                  - type: 'null'
              type: array
            power_max:
              items:
                oneOf:
                  - type: number
                  - type: 'null'
              type: array
            skin_temperature:
              items:
                oneOf:
                  - type: number
                  - type: 'null'
              type: array
            skin_temperature_max:
              items:
                oneOf:
                  - type: number
                  - type: 'null'
              type: array
            skin_temperature_min:
              items:
                oneOf:
                  - type: number
                  - type: 'null'
              type: array
            sleep_breathing_rate:
              items:
                oneOf:
                  - type: number
                  - type: 'null'
              type: array
            sleep_breathing_rate_max:
              items:
                oneOf:
                  - type: number
                  - type: 'null'
              type: array
            sleep_breathing_rate_min:
              items:
                oneOf:
                  - type: number
                  - type: 'null'
              type: array
            sleep_duration:
              items:
                oneOf:
                  - type: number
                  - type: 'null'
              type: array
            sleep_duration_awake:
              items:
                oneOf:
                  - type: number
                  - type: 'null'
              type: array
            sleep_duration_deep:
              items:
                oneOf:
                  - type: number
                  - type: 'null'
              type: array
            sleep_duration_light:
              items:
                oneOf:
                  - type: number
                  - type: 'null'
              type: array
            sleep_duration_nap:
              items:
                oneOf:
                  - type: number
                  - type: 'null'
              type: array
            sleep_duration_rem:
              items:
                oneOf:
                  - type: number
                  - type: 'null'
              type: array
            sleep_efficiency:
              items:
                oneOf:
                  - type: number
                  - type: 'null'
              type: array
            sleep_interruptions:
              items:
                oneOf:
                  - type: number
                  - type: 'null'
              type: array
            sleep_latency:
              items:
                oneOf:
                  - type: number
                  - type: 'null'
              type: array
            sleep_score:
              items:
                oneOf:
                  - type: number
                  - type: 'null'
              type: array
            sleep_skin_temperature_deviation:
              items:
                oneOf:
                  - type: number
                  - type: 'null'
              type: array
            speed:
              items:
                oneOf:
                  - type: number
                  - type: 'null'
              type: array
            speed_max:
              items:
                oneOf:
                  - type: number
                  - type: 'null'
              type: array
            speed_min:
              items:
                oneOf:
                  - type: number
                  - type: 'null'
              type: array
            spo2:
              items:
                oneOf:
                  - type: number
                  - type: 'null'
              type: array
            spo2_max:
              items:
                oneOf:
                  - type: number
                  - type: 'null'
              type: array
            spo2_min:
              items:
                oneOf:
                  - type: number
                  - type: 'null'
              type: array
            steps:
              items:
                oneOf:
                  - type: number
                  - type: 'null'
              type: array
            swimming_distance_per_stroke:
              items:
                oneOf:
                  - type: number
                  - type: 'null'
              type: array
            swimming_lengths:
              items:
                oneOf:
                  - type: number
                  - type: 'null'
              type: array
            vo2max:
              items:
                oneOf:
                  - type: number
                  - type: 'null'
              type: array
            wakeup_latency:
              items:
                oneOf:
                  - type: number
                  - type: 'null'
              type: array
            weight:
              items:
                oneOf:
                  - type: number
                  - type: 'null'
              type: array
          type: object
      type: object
    QueryOutputSourceInfo:
      additionalProperties: false
      properties:
        device_manufacturer:
          type: string
        device_model:
          type: string
        device_product:
          type: string
        device_version:
          type: string
        source_bundle_identifier:
          type: string
        source_os_version:
          type: string
        source_product:
          type: string
        source_version:
          type: string
      type: object
    QueryOutputSleepStage:
      additionalProperties: false
      properties:
        duration:
          format: int64
          type: integer
        end_at:
          format: date-time
          type: string
        metrics:
          description: Metrics output
          properties:
            air_temperature:
              description: air_temperature in celsius
              examples:
                - 22.73
              type: number
            air_temperature_max:
              description: air_temperature_max in celsius
              examples:
                - 28.55
              type: number
            air_temperature_min:
              description: air_temperature_min in celsius
              examples:
                - 15.27
              type: number
            ascent:
              description: ascent in meters
              examples:
                - 320.29
              type: number
            basal_body_temperature:
              description: basal_body_temperature in celsius
              examples:
                - 36.53
              type: number
            basal_body_temperature_max:
              description: basal_body_temperature_max in celsius
              examples:
                - 37.03
              type: number
            basal_body_temperature_min:
              description: basal_body_temperature_min in celsius
              examples:
                - 36.01
              type: number
            bedtime_duration:
              description: bedtime_duration in ms
              examples:
                - 28800000
              type: number
            blood_pressure_diastolic:
              description: blood_pressure_diastolic in mmHg
              examples:
                - 80.03
              type: number
            blood_pressure_diastolic_max:
              description: blood_pressure_diastolic_max in mmHg
              examples:
                - 90.07
              type: number
            blood_pressure_diastolic_min:
              description: blood_pressure_diastolic_min in mmHg
              examples:
                - 60.01
              type: number
            blood_pressure_systolic:
              description: blood_pressure_systolic in mmHg
              examples:
                - 120.03
              type: number
            blood_pressure_systolic_max:
              description: blood_pressure_systolic_max in mmHg
              examples:
                - 140.07
              type: number
            blood_pressure_systolic_min:
              description: blood_pressure_systolic_min in mmHg
              examples:
                - 100.01
              type: number
            body_bone_mass:
              description: body_bone_mass in g
              examples:
                - 3200
              type: number
            body_fat:
              description: body_fat in percentage
              examples:
                - 18.53
              type: number
            body_fat_max:
              description: body_fat_max in percentage
              examples:
                - 25.03
              type: number
            body_fat_min:
              description: body_fat_min in percentage
              examples:
                - 12.01
              type: number
            body_mass_index:
              description: body_mass_index in count
              examples:
                - 22.5016
              type: number
            body_temperature:
              description: body_temperature in celsius
              examples:
                - 36.73
              type: number
            body_temperature_max:
              description: body_temperature_max in celsius
              examples:
                - 37.55
              type: number
            body_temperature_min:
              description: body_temperature_min in celsius
              examples:
                - 36.13
              type: number
            breathing_rate:
              description: breathing_rate in breaths/min
              examples:
                - 16.5016
              type: number
            breathing_rate_max:
              description: breathing_rate_max in breaths/min
              examples:
                - 24.7549
              type: number
            breathing_rate_min:
              description: breathing_rate_min in breaths/min
              examples:
                - 12.2534
              type: number
            cadence:
              description: cadence in rpm
              examples:
                - 85.5016
              type: number
            cadence_max:
              description: cadence_max in rpm
              examples:
                - 110.0049
              type: number
            cadence_min:
              description: cadence_min in rpm
              examples:
                - 60.0034
              type: number
            calories_burned:
              description: calories_burned in kcal
              examples:
                - 1650.7549
              type: number
            calories_burned_active:
              description: calories_burned_active in kcal
              examples:
                - 450.2516
              type: number
            calories_burned_basal:
              description: calories_burned_basal in kcal
              examples:
                - 1200.5034
              type: number
            calories_intake:
              description: calories_intake in kcal
              examples:
                - 2100.5016
              type: number
            descent:
              description: descent in meters
              examples:
                - 280.91
              type: number
            distance:
              description: distance in meters
              examples:
                - 6500.2516
              type: number
            distance_cycling:
              description: distance_cycling in meters
              examples:
                - 15000.7549
              type: number
            distance_running:
              description: distance_running in meters
              examples:
                - 5000.5016
              type: number
            distance_swimming:
              description: distance_swimming in meters
              examples:
                - 1000.7549
              type: number
            distance_walking:
              description: distance_walking in meters
              examples:
                - 3200.5034
              type: number
            distance_wheelchair:
              description: distance_wheelchair in meters
              examples:
                - 2800.5034
              type: number
            duration_active:
              description: duration_active in ms
              examples:
                - 5400000
              type: number
            duration_high_intensity:
              description: duration_high_intensity in ms
              examples:
                - 1200000
              type: number
            duration_low_intensity:
              description: duration_low_intensity in ms
              examples:
                - 9000000
              type: number
            duration_moderate_intensity:
              description: duration_moderate_intensity in ms
              examples:
                - 2400000
              type: number
            ecg_rri:
              description: ecg_rri in ms
              examples:
                - 850
              type: number
            ecg_voltage:
              description: ecg_voltage in uV
              examples:
                - 1200.53
              type: number
            elevation:
              description: elevation in meters
              examples:
                - 1050.73
              type: number
            elevation_gain:
              description: elevation_gain in meters
              examples:
                - 450.83
              type: number
            elevation_loss:
              description: elevation_loss in meters
              examples:
                - 380.47
              type: number
            elevation_max:
              description: elevation_max in meters
              examples:
                - 1250.55
              type: number
            elevation_min:
              description: elevation_min in meters
              examples:
                - 850.37
              type: number
            floors_climbed:
              description: floors_climbed in count
              examples:
                - 12
              type: number
            glucose:
              description: glucose in mg/dL
              examples:
                - 95.654321
              type: number
            heartrate:
              description: heartrate in bpm
              examples:
                - 90
              type: number
            heartrate_max:
              description: heartrate_max in bpm
              examples:
                - 180
              type: number
            heartrate_min:
              description: heartrate_min in bpm
              examples:
                - 60
              type: number
            heartrate_resting:
              description: heartrate_resting in bpm
              examples:
                - 70
              type: number
            heartrate_resting_max:
              description: heartrate_resting_max in bpm
              examples:
                - 85
              type: number
            heartrate_resting_min:
              description: heartrate_resting_min in bpm
              examples:
                - 60
              type: number
            heartrate_zone0_duration:
              description: heartrate_zone0_duration in ms
              examples:
                - 5000
              type: number
            heartrate_zone1_duration:
              description: heartrate_zone1_duration in ms
              examples:
                - 7152
              type: number
            heartrate_zone2_duration:
              description: heartrate_zone2_duration in ms
              examples:
                - 25000
              type: number
            heartrate_zone3_duration:
              description: heartrate_zone3_duration in ms
              examples:
                - 18170
              type: number
            heartrate_zone4_duration:
              description: heartrate_zone4_duration in ms
              examples:
                - 6372
              type: number
            heartrate_zone5_duration:
              description: heartrate_zone5_duration in ms
              examples:
                - 2000
              type: number
            height:
              description: height in meters
              examples:
                - 1.7549
              type: number
            hrv_rmssd:
              description: hrv_rmssd in ms
              examples:
                - 45
              type: number
            hrv_sdnn:
              description: hrv_sdnn in ms
              examples:
                - 52
              type: number
            latitude:
              description: latitude in degrees
              examples:
                - 37.77492948
              type: number
            longitude:
              description: longitude in degrees
              examples:
                - -122.41941637
              type: number
            pace:
              description: pace in sec/m
              examples:
                - 3.53
              type: number
            power:
              description: power in w
              examples:
                - 125
              type: number
            power_max:
              description: power_max in w
              examples:
                - 125
              type: number
            skin_temperature:
              description: skin_temperature in celsius
              examples:
                - 33.53
              type: number
            skin_temperature_max:
              description: skin_temperature_max in celsius
              examples:
                - 34.27
              type: number
            skin_temperature_min:
              description: skin_temperature_min in celsius
              examples:
                - 32.89
              type: number
            sleep_breathing_rate:
              description: sleep_breathing_rate in breaths/min
              examples:
                - 14.27
              type: number
            sleep_breathing_rate_max:
              description: sleep_breathing_rate_max in breaths/min
              examples:
                - 18.59
              type: number
            sleep_breathing_rate_min:
              description: sleep_breathing_rate_min in breaths/min
              examples:
                - 10.03
              type: number
            sleep_duration:
              description: sleep_duration in ms
              examples:
                - 25200000
              type: number
            sleep_duration_awake:
              description: sleep_duration_awake in ms
              examples:
                - 1800000
              type: number
            sleep_duration_deep:
              description: sleep_duration_deep in ms
              examples:
                - 5400000
              type: number
            sleep_duration_light:
              description: sleep_duration_light in ms
              examples:
                - 12600000
              type: number
            sleep_duration_nap:
              description: sleep_duration_nap in ms
              examples:
                - 3600000
              type: number
            sleep_duration_rem:
              description: sleep_duration_rem in ms
              examples:
                - 3600000
              type: number
            sleep_efficiency:
              description: sleep_efficiency in percentage
              examples:
                - 92
              type: number
            sleep_interruptions:
              description: sleep_interruptions in count
              examples:
                - 2
              type: number
            sleep_latency:
              description: sleep_latency in ms
              examples:
                - 900000
              type: number
            sleep_score:
              description: sleep_score in percentage
              examples:
                - 85
              type: number
            sleep_skin_temperature_deviation:
              description: sleep_skin_temperature_deviation in celsius
              examples:
                - -0.13
              type: number
            speed:
              description: speed in m/sec
              examples:
                - 3.2516
              type: number
            speed_max:
              description: speed_max in m/sec
              examples:
                - 8.5034
              type: number
            speed_min:
              description: speed_min in m/sec
              examples:
                - 0.5016
              type: number
            spo2:
              description: spo2 in percentage
              examples:
                - 98.5016
              type: number
            spo2_max:
              description: spo2_max in percentage
              examples:
                - 99.5034
              type: number
            spo2_min:
              description: spo2_min in percentage
              examples:
                - 95.2516
              type: number
            steps:
              description: steps in count
              examples:
                - 8500
              type: number
            swimming_distance_per_stroke:
              description: swimming_distance_per_stroke in meters
              examples:
                - 2.27
              type: number
            swimming_lengths:
              description: swimming_lengths in count
              examples:
                - 40
              type: number
            vo2max:
              description: vo2max in mL/kg/min
              examples:
                - 45.23
              type: number
            wakeup_latency:
              description: wakeup_latency in ms
              examples:
                - 600000
              type: number
            weight:
              description: weight in g
              examples:
                - 70000.5034
              type: number
          type: object
        stage:
          description: Sleep stages
          enum:
            - awake
            - sleeping
            - out_of_bed
            - light
            - deep
            - rem
            - awake_in_bed
            - nap
            - in_bed
            - unknown
          type: string
        start_at:
          format: date-time
          type: string
      type: object
    ErrorDetail:
      additionalProperties: false
      properties:
        location:
          description: >-
            Where the error occurred, e.g. 'body.items[3].tags' or
            'path.thing-id'
          type: string
        message:
          description: Error message text
          type: string
        value:
          description: The value at the given location
      type: object
  securitySchemes:
    bearer:
      bearerFormat: JWT
      scheme: bearer
      type: http

````