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

# Get Device Data

> Returns device data and connected devices for a patient



## OpenAPI

````yaml get /patient/{patientId}/devices
openapi: 3.0.1
info:
  title: Lifeforce Care Team API
  description: An API used by the Lifeforce care team portal to query patient data
  license:
    name: MIT
  version: 1.0.0
servers:
  - url: https://om-staging.mylifeforce.com/api/m2m
security:
  - bearerAuth: []
paths:
  /patient/{patientId}/devices:
    get:
      description: Returns device data and connected devices for a patient
      parameters:
        - $ref: '#/components/parameters/PatientIdParam'
        - name: time_range
          in: query
          description: Time range for the device data
          required: false
          schema:
            type: string
            enum:
              - last7
              - last90
              - last180
            default: last90
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    type: array
                    description: The data associated with each connected device
                    items:
                      type: object
                      properties:
                        id:
                          type: number
                          example: 1
                          description: The id of the device
                        name:
                          type: string
                          example: Fitbit
                          description: The name of the device
                        slug:
                          type: string
                          example: fitbit
                          description: The slug of the device
                        logoUrl:
                          type: string
                          description: The URL of the device's logo
                          example: https://picsum.photos/200/300
                        status:
                          type: string
                          description: >-
                            The status of the device (connected, disconnected,
                            etc.)
                          example: connected
                        type:
                          type: string
                          description: The type of device (watch, cuff, etc.)
                          example: watch
                        sleep:
                          type: array
                          description: Contains all available metrics associated to sleep
                          items:
                            type: object
                            properties:
                              name:
                                type: string
                                description: The name of the metric
                                example: REM Sleep
                              unit:
                                type: string
                                description: The unit of the metric
                                example: hours
                              data:
                                type: array
                                items:
                                  type: object
                                  properties:
                                    date:
                                      type: string
                                      format: date-time
                                      description: The date of the data point
                                      example: '2022-04-18T00:00:00Z'
                                    value:
                                      type: number
                                      nullable: true
                                      description: >-
                                        The value of the metric at this data
                                        point
                                      example: 2.5
                              average:
                                type: number
                                description: >-
                                  The average value of the metric over the
                                  selected time range
                                example: 2.5
                              percentChange:
                                type: number
                                nullable: true
                                description: >-
                                  The percent change in the metric over the
                                  selected time range when compared to the same
                                  amount of time before
                                example: 15.2
                        activity:
                          type: array
                          description: >-
                            Contains all available metrics associated to
                            activity
                          items:
                            type: object
                            properties:
                              name:
                                type: string
                                description: The name of the metric
                                example: Daily Active Calorie Burn
                              unit:
                                type: string
                                description: The unit of the metric
                                example: Calories
                              data:
                                type: array
                                items:
                                  type: object
                                  properties:
                                    date:
                                      type: string
                                      format: date-time
                                      description: The date of the data point
                                      example: '2022-04-18T00:00:00Z'
                                    value:
                                      type: number
                                      nullable: true
                                      description: >-
                                        The value of the metric at this data
                                        point
                                      example: 789
                              average:
                                type: number
                                description: >-
                                  The average value of the metric over the
                                  selected time range
                                example: 456
                              percentChange:
                                type: number
                                nullable: true
                                description: >-
                                  The percent change in the metric over the
                                  selected time range when compared to the same
                                  amount of time before
                                example: 15.2
                        body:
                          type: array
                          description: >-
                            Contains all available metrics associated to body
                            composition
                          items:
                            type: object
                            properties:
                              name:
                                type: string
                                description: The name of the metric
                                example: Weight
                              unit:
                                type: string
                                description: The unit of the metric
                                example: lbs
                              data:
                                type: array
                                items:
                                  type: object
                                  properties:
                                    date:
                                      type: string
                                      format: date-time
                                      description: The date of the data point
                                      example: '2022-04-18T00:00:00Z'
                                    value:
                                      type: number
                                      nullable: true
                                      description: >-
                                        The value of the metric at this data
                                        point
                                      example: 150
                              average:
                                type: number
                                description: >-
                                  The average value of the metric over the
                                  selected time range
                                example: 150
                              percentChange:
                                type: number
                                nullable: true
                                description: >-
                                  The percent change in the metric over the
                                  selected time range when compared to the same
                                  amount of time before
                                example: 15.2
                        bloodPressure:
                          type: object
                          description: >-
                            Contains blood pressure metrics (systolic and
                            diastolic)
                          properties:
                            name:
                              type: string
                              description: The name of the metric
                              example: Blood Pressure
                            unit:
                              type: string
                              description: The unit of the metric
                              example: mmHg
                            data:
                              type: array
                              items:
                                type: object
                                properties:
                                  date:
                                    type: string
                                    format: date-time
                                    description: The date of the data point
                                    example: '2022-04-18T00:00:00Z'
                                  systolic:
                                    type: number
                                    nullable: true
                                    description: >-
                                      The systolic value of the metric at this
                                      data point
                                    example: 120
                                  diastolic:
                                    type: number
                                    nullable: true
                                    description: >-
                                      The diastolic value of the metric at this
                                      data point
                                    example: 80
                            average:
                              type: object
                              properties:
                                systolic:
                                  type: number
                                  description: >-
                                    The average systolic value of the metric
                                    over the selected time range
                                  example: 120
                                diastolic:
                                  type: number
                                  description: >-
                                    The average diastolic value of the metric
                                    over the selected time range
                                  example: 80
                            abnormalInstancePercentage:
                              type: number
                              description: >-
                                The percentage of abnormal instances of the
                                metric over the selected time range, an abnormal
                                instance for Blood Pressure is defined as blood
                                pressure being over 140/90 or under 100/60
                              example: 0
                            percentChange:
                              type: number
                              nullable: true
                              description: >-
                                The percent change in the metric over the
                                selected time range when compared to the same
                                amount of time before
                              example: 0
                        activityHeartRate:
                          type: object
                          description: Contains heart rate metrics
                          properties:
                            name:
                              type: string
                              description: The name of the metric
                              example: Heart Rate
                            unit:
                              type: string
                              description: The unit of the metric
                              example: bpm
                            data:
                              type: array
                              items:
                                type: object
                                properties:
                                  date:
                                    type: string
                                    format: date-time
                                    description: The date of the data point
                                    example: '2022-04-18T00:00:00Z'
                                  averageHeartRate:
                                    type: number
                                    nullable: true
                                    description: >-
                                      The average heart rate of the metric at
                                      this data point
                                    example: 80
                                  maximumHeartRate:
                                    type: number
                                    nullable: true
                                    description: >-
                                      The maximum heart rate of the metric at
                                      this data point
                                    example: 200
                                  minimumHeartRate:
                                    type: number
                                    nullable: true
                                    description: >-
                                      The minimum heart rate of the metric at
                                      this data point
                                    example: 55
                                  restingHeartRate:
                                    type: number
                                    nullable: true
                                    description: >-
                                      The resting heart rate of the metric at
                                      this data point
                                    example: 60
                            average:
                              type: number
                              description: >-
                                The average value of the metric over the
                                selected time range, this will use
                                "averageHeartRate" from the data array
                              example: 80
                            abnormalInstances:
                              type: number
                              description: >-
                                The number of abnormal instances of the metric
                                over the selected time range, an abnormal
                                instance for Heart Rate is defined as
                                "averageHeartrate" heart rate being over 100 or
                                under 60
                              example: 0
                            percentChange:
                              type: number
                              nullable: true
                              description: >-
                                The percent change in the metric over the
                                selected time range when compared to the same
                                amount of time before, uses the
                                "averageHeartRate" from the data array
                              example: 0
                  vitalConnectedDevices:
                    type: array
                    description: The connected devices for the member
                    items:
                      type: object
                      properties:
                        id:
                          type: number
                          example: 1
                          description: The id of the device
                        name:
                          type: string
                          example: Fitbit
                          description: The name of the device
                        slug:
                          type: string
                          example: fitbit
                          description: The slug of the device
                        logoUrl:
                          type: string
                          description: The URL of the device's logo
                          example: https://picsum.photos/200/300
                        status:
                          type: string
                          description: >-
                            The status of the device (connected, disconnected,
                            etc.)
                          example: connected
                        type:
                          type: string
                          description: The type of device (watch, cuff, etc.)
                          example: watch
        '422':
          description: Patient not found
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: Patient not found
        '500':
          description: User does not have any connected devices
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: User does not have any connected devices
components:
  parameters:
    PatientIdParam:
      name: patientId
      in: path
      description: The id of the patient in question
      required: true
      schema:
        $ref: '#/components/schemas/UUID'
  schemas:
    UUID:
      type: string
      format: uuid
      example: 29ea9012-c622-4851-a57a-9327abd21198
      description: A universally unique identifier.
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer

````