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

# Get the Health Check metrics of one or many devices

> Return the Health Check of devices, the figures the Health Check of the device drawer shows for the same window: RAM usage and CPU load over the last `days` (7, 14 or 30, default 14) read from the hourly usage. Each card of the drawer shows the P90 (`p90Percent`) and the share of hours above 80 % (`timeAboveHighPercent`), coloured by `usageStatus` (LOW, MEDIUM, HIGH, read from the P90: RAM turns MEDIUM at 75 and HIGH above 90, CPU at 60 and above 85); the mean of the window (`windowAveragePercent`) is not on the drawer. Also the disk used and its free space level, as last reported, and the battery health and cycle count. Use it to answer how loaded a device is, or to rank or flag the fleet by RAM or CPU usage. Pass `deviceIds` (one, or up to 100), or a `filter` (the `getDevices` filter, same keys, paginated by `page` and `perPage`, up to 100 a page) to read a whole fleet without listing it first. `ram` and `cpu` are null when the device reported no usage in the window, `firstReadingAt` says when a shorter history starts, and an id of no device of your company comes back in `notFoundDeviceIds`. `getDevice` and `getDevices` return the installed RAM, CPU and disk size, not their usage.

Key: ReadScope: Company


## OpenAPI

````yaml https://api.getprimo.com/openapi.json post /devices/health-metrics
openapi: 3.1.1
info:
  title: Public API - BETA
  description: Read docs on https://docs.getprimo.com/
  version: '1.0'
  contact: {}
servers:
  - url: https://api.getprimo.com
security:
  - apikey: []
tags: []
paths:
  /devices/health-metrics:
    post:
      tags:
        - Devices
      summary: Get the Health Check metrics of one or many devices
      description: >-
        Return the Health Check of devices, the figures the Health Check of the
        device drawer shows for the same window: RAM usage and CPU load over the
        last `days` (7, 14 or 30, default 14) read from the hourly usage. Each
        card of the drawer shows the P90 (`p90Percent`) and the share of hours
        above 80 % (`timeAboveHighPercent`), coloured by `usageStatus` (LOW,
        MEDIUM, HIGH, read from the P90: RAM turns MEDIUM at 75 and HIGH above
        90, CPU at 60 and above 85); the mean of the window
        (`windowAveragePercent`) is not on the drawer. Also the disk used and
        its free space level, as last reported, and the battery health and cycle
        count. Use it to answer how loaded a device is, or to rank or flag the
        fleet by RAM or CPU usage. Pass `deviceIds` (one, or up to 100), or a
        `filter` (the `getDevices` filter, same keys, paginated by `page` and
        `perPage`, up to 100 a page) to read a whole fleet without listing it
        first. `ram` and `cpu` are null when the device reported no usage in the
        window, `firstReadingAt` says when a shorter history starts, and an id
        of no device of your company comes back in `notFoundDeviceIds`.
        `getDevice` and `getDevices` return the installed RAM, CPU and disk
        size, not their usage.
      operationId: getDevicesHealthMetrics
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/GetDevicesHealthMetricsBody'
      responses:
        default:
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GetDevicesHealthMetrics_Output'
components:
  schemas:
    GetDevicesHealthMetricsBody:
      type: object
      properties:
        deviceIds:
          description: >-
            Device ids to read the Health Check of. Up to 100 per call. Send
            either `deviceIds` or `filter`, not both.
          minItems: 1
          maxItems: 100
          type: array
          items:
            type: string
            pattern: ^[a-f\d]{24}$
        filter:
          description: >-
            Selects the devices as `getDevices` does (same keys and clauses),
            instead of `deviceIds`. Paginated by `page` and `perPage`; retired
            devices are left out unless the filter has an `availableStatus`
            clause.
          type: object
          propertyNames:
            type: string
          additionalProperties:
            type: object
            properties:
              operationType:
                description: >-
                  INCLUDE keeps the devices matching the values, EXCLUDE keeps
                  the devices that do not.
                type: string
                enum:
                  - INCLUDE
                  - EXCLUDE
              values:
                description: >-
                  Values to match, always as an array — take them from the
                  criterion `values` in the filter catalog. Booleans are
                  accepted for flag criteria.
                minItems: 1
                type: array
                items:
                  anyOf:
                    - type: string
                    - type: boolean
            required:
              - operationType
              - values
        matchAny:
          description: 'With `filter`: true keeps a device matching ANY clause (OR).'
          type: boolean
        page:
          description: 'With `filter`: the page of devices, from 1.'
          default: 1
          type: integer
          minimum: 1
          maximum: 9007199254740991
        perPage:
          description: 'With `filter`: devices per page (default and max 100).'
          default: 100
          type: integer
          minimum: 1
          maximum: 100
        days:
          description: >-
            The window, in days, the RAM and CPU figures cover: 7, 14, 30
            (default 14), as the range selector of the Health Check.
          default: 14
          anyOf:
            - type: number
              const: 7
            - type: number
              const: 14
            - type: number
              const: 30
    GetDevicesHealthMetrics_Output:
      type: object
      properties:
        window:
          type: object
          properties:
            days:
              type: number
            from:
              description: Start of the first hour the window covers.
              type: string
              format: date-time
              pattern: >-
                ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d(?::[0-5]\d(?:\.\d+)?)?(?:Z))$
            to:
              description: End of the current hour.
              type: string
              format: date-time
              pattern: >-
                ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d(?::[0-5]\d(?:\.\d+)?)?(?:Z))$
          required:
            - days
            - from
            - to
          additionalProperties: false
        items:
          type: array
          description: The Health Check of each device found, in the order asked.
          items:
            type: object
            properties:
              deviceId:
                type: string
              ram:
                description: >-
                  RAM usage over the window; null when the device reported none
                  in it.
                anyOf:
                  - type: object
                    properties:
                      p90Percent:
                        description: >-
                          90th percentile of the hourly usage over the window,
                          in percent.
                        type: number
                      windowAveragePercent:
                        description: Mean of the hourly usage over the window, in percent.
                        type: number
                      timeAboveHighPercent:
                        description: >-
                          Share of the hours of the window above 80 % usage, in
                          percent.
                        type: number
                      usageStatus:
                        description: >-
                          LOW, MEDIUM or HIGH, read from the P90 of the window
                          as the Health Check colours it: the scale of the
                          `deviceRamUsageStatus` and `deviceCpuUsageStatus`
                          filters of `getDevices`, which grade the stored 14-day
                          P90.
                        type: string
                        enum:
                          - LOW
                          - MEDIUM
                          - HIGH
                      firstReadingAt:
                        description: >-
                          Hour of the first reading in the window: later than
                          `window.from` when the history is shorter.
                        type: string
                        format: date-time
                        pattern: >-
                          ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d(?::[0-5]\d(?:\.\d+)?)?(?:Z))$
                    required:
                      - p90Percent
                      - windowAveragePercent
                      - timeAboveHighPercent
                      - usageStatus
                      - firstReadingAt
                    additionalProperties: false
                  - type: 'null'
              cpu:
                description: >-
                  CPU load over the window; null when the device reported none
                  in it.
                anyOf:
                  - type: object
                    properties:
                      p90Percent:
                        description: >-
                          90th percentile of the hourly usage over the window,
                          in percent.
                        type: number
                      windowAveragePercent:
                        description: Mean of the hourly usage over the window, in percent.
                        type: number
                      timeAboveHighPercent:
                        description: >-
                          Share of the hours of the window above 80 % usage, in
                          percent.
                        type: number
                      usageStatus:
                        description: >-
                          LOW, MEDIUM or HIGH, read from the P90 of the window
                          as the Health Check colours it: the scale of the
                          `deviceRamUsageStatus` and `deviceCpuUsageStatus`
                          filters of `getDevices`, which grade the stored 14-day
                          P90.
                        type: string
                        enum:
                          - LOW
                          - MEDIUM
                          - HIGH
                      firstReadingAt:
                        description: >-
                          Hour of the first reading in the window: later than
                          `window.from` when the history is shorter.
                        type: string
                        format: date-time
                        pattern: >-
                          ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d(?::[0-5]\d(?:\.\d+)?)?(?:Z))$
                    required:
                      - p90Percent
                      - windowAveragePercent
                      - timeAboveHighPercent
                      - usageStatus
                      - firstReadingAt
                    additionalProperties: false
                  - type: 'null'
              disk:
                description: Null when the device reported no disk size or free space.
                anyOf:
                  - type: object
                    properties:
                      usedPercent:
                        description: >-
                          Share of the disk used at the last inventory, in
                          percent.
                        type: number
                      storageGb:
                        description: Disk size in GB.
                        type: number
                      freeSpaceStatus:
                        description: >-
                          Free space level: LOW (under 10 % or under 20 GB
                          free), MEDIUM (up to 20 %), HIGH.
                        type: string
                        enum:
                          - LOW
                          - MEDIUM
                          - HIGH
                    required:
                      - usedPercent
                      - storageGb
                      - freeSpaceStatus
                    additionalProperties: false
                  - type: 'null'
              battery:
                description: Null when the device reported no battery health.
                anyOf:
                  - type: object
                    properties:
                      health:
                        type: string
                        enum:
                          - SERVICE_RECOMMENDED
                          - NORMAL
                      cycleCount:
                        anyOf:
                          - type: number
                          - type: 'null'
                    required:
                      - health
                      - cycleCount
                    additionalProperties: false
                  - type: 'null'
            required:
              - deviceId
              - ram
              - cpu
              - disk
              - battery
            additionalProperties: false
        notFoundDeviceIds:
          type: array
          description: The ids asked that name no device of your company.
          items:
            type: string
        pagination:
          type: object
          description: The devices matched by `filter`; absent with `deviceIds`.
          properties:
            totalElements:
              type: integer
              minimum: 0
              maximum: 9007199254740991
            totalPages:
              type: integer
              minimum: 0
              maximum: 9007199254740991
            page:
              type: integer
              minimum: 1
              maximum: 9007199254740991
            perPage:
              type: integer
              minimum: 1
              maximum: 100
          required:
            - totalElements
            - totalPages
            - page
            - perPage
          additionalProperties: false
      required:
        - window
        - items
        - notFoundDeviceIds
      additionalProperties: false
  securitySchemes:
    apikey:
      scheme: bearer
      bearerFormat: API key
      type: http
      description: >-
        Use your Primo API key in the Authorization header as `Bearer
        <API_KEY>`.

````

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