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

# Query Farm Miner Metrics

> Return real-time aggregate miner classification counts and mining-mode and model distributions for a farm. Classification counts are independent — a sleeping miner with a fault appears in both abnormal and sleep. Online miners equal total minus stale.



## OpenAPI

````yaml /api-reference/openapi-v2.json post /public-api/v2/workspaces/{workspace_id}/farms/{farm_id}/miner-metrics/query
openapi: 3.1.0
info:
  title: Nonce Public API
  description: Nonce Public API
  version: 2.0.0
  contact: {}
servers:
  - url: https://api.nonce.app
    description: Production server
security: []
tags: []
paths:
  /public-api/v2/workspaces/{workspace_id}/farms/{farm_id}/miner-metrics/query:
    post:
      tags:
        - Farms
      summary: Query Farm Miner Metrics
      description: >-
        Return real-time aggregate miner classification counts and mining-mode
        and model distributions for a farm. Classification counts are
        independent — a sleeping miner with a fault appears in both abnormal and
        sleep. Online miners equal total minus stale.
      operationId: QueryFarmMinerMetrics
      parameters:
        - name: workspace_id
          required: true
          in: path
          schema:
            type: string
        - name: farm_id
          required: true
          in: path
          schema:
            type: string
            format: uuid
            pattern: >-
              ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
      responses:
        '200':
          description: Real-time farm miner classification snapshot
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    enum:
                      - true
                  data:
                    type: object
                    properties:
                      period:
                        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))$
                        description: Data observation time
                      theo:
                        description: >-
                          Configured farm miner capacity, or null when it is not
                          configured
                        type:
                          - number
                          - 'null'
                      total:
                        type: number
                        description: >-
                          Total number of non-deleted miners, including stale
                          miners
                      classification:
                        type: object
                        properties:
                          healthy:
                            type: number
                          abnormal:
                            type: number
                          sleep:
                            type: number
                          stale:
                            type: number
                        required:
                          - healthy
                          - abnormal
                          - sleep
                          - stale
                        description: >-
                          Independent healthy, abnormal, sleeping, and stale
                          miner counts
                      anomaly_breakdown:
                        type: object
                        properties:
                          hashboard:
                            type: object
                            properties:
                              count:
                                type: number
                              also_has:
                                type: object
                                additionalProperties:
                                  type: number
                            required:
                              - count
                              - also_has
                          temperature:
                            type: object
                            properties:
                              count:
                                type: number
                              also_has:
                                type: object
                                additionalProperties:
                                  type: number
                            required:
                              - count
                              - also_has
                          fan:
                            type: object
                            properties:
                              count:
                                type: number
                              also_has:
                                type: object
                                additionalProperties:
                                  type: number
                            required:
                              - count
                              - also_has
                          network:
                            type: object
                            properties:
                              count:
                                type: number
                              also_has:
                                type: object
                                additionalProperties:
                                  type: number
                            required:
                              - count
                              - also_has
                          pool:
                            type: object
                            properties:
                              count:
                                type: number
                              also_has:
                                type: object
                                additionalProperties:
                                  type: number
                            required:
                              - count
                              - also_has
                          power:
                            type: object
                            properties:
                              count:
                                type: number
                              also_has:
                                type: object
                                additionalProperties:
                                  type: number
                            required:
                              - count
                              - also_has
                          control_board:
                            type: object
                            properties:
                              count:
                                type: number
                              also_has:
                                type: object
                                additionalProperties:
                                  type: number
                            required:
                              - count
                              - also_has
                          firmware:
                            type: object
                            properties:
                              count:
                                type: number
                              also_has:
                                type: object
                                additionalProperties:
                                  type: number
                            required:
                              - count
                              - also_has
                          low_hashrate:
                            type: object
                            properties:
                              count:
                                type: number
                              also_has:
                                type: object
                                additionalProperties:
                                  type: number
                            required:
                              - count
                              - also_has
                          unknown:
                            type: object
                            properties:
                              count:
                                type: number
                              also_has:
                                type: object
                                additionalProperties:
                                  type: number
                            required:
                              - count
                              - also_has
                        required:
                          - hashboard
                          - temperature
                          - fan
                          - network
                          - pool
                          - power
                          - control_board
                          - firmware
                          - low_hashrate
                          - unknown
                        description: >-
                          Abnormal miner counts and co-occurring anomaly counts
                          by anomaly type
                      mining_modes:
                        type: array
                        items:
                          type: object
                          properties:
                            mining_mode:
                              type: string
                              description: Mining mode name
                            mining_mode_preset:
                              description: >-
                                Third-party firmware preset name when the mining
                                mode is preset
                              type:
                                - string
                                - 'null'
                            count:
                              type: number
                              description: Number of online miners in this mode
                            firmwares:
                              type: array
                              items:
                                type: object
                                properties:
                                  firmware:
                                    description: >-
                                      Firmware name, or null when the miners
                                      report none
                                    type:
                                      - string
                                      - 'null'
                                  count:
                                    type: number
                                    description: >-
                                      Number of online miners in this mode
                                      running this firmware
                                required:
                                  - firmware
                                  - count
                                title: Farm Mining Mode Firmware Count
                              description: >-
                                Firmware breakdown of this mode, most common
                                first. Counts sum to `count`.
                          required:
                            - mining_mode
                            - mining_mode_preset
                            - count
                            - firmwares
                          title: Farm Mining Mode Count
                        description: >-
                          Online miner distribution by mining mode and preset,
                          each with its firmware breakdown
                      miner_models:
                        type: array
                        items:
                          type: object
                          properties:
                            model:
                              description: Miner model name
                              type:
                                - string
                                - 'null'
                            theoretical_hashrate:
                              type:
                                - number
                                - 'null'
                            submodel:
                              type:
                                - string
                                - 'null'
                            count:
                              type: number
                              description: Number of online miners of this model
                            average_expected_hashrate:
                              description: Average expected hashrate in H/s
                              type:
                                - number
                                - 'null'
                          required:
                            - model
                            - theoretical_hashrate
                            - submodel
                            - count
                            - average_expected_hashrate
                          title: Farm Miner Model Count
                        description: >-
                          Online miner distribution by model and resolved
                          specification
                    required:
                      - period
                      - theo
                      - total
                      - classification
                      - anomaly_breakdown
                      - mining_modes
                      - miner_models
                    title: FarmMinerMetrics
                    description: >-
                      Real-time aggregate miner classification and distribution
                      snapshot for a farm.
                  error:
                    type: 'null'
                    example: null
                required:
                  - success
                  - data
                  - error
        '400':
          description: Bad Request - Invalid parameters
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    enum:
                      - false
                  data:
                    type: 'null'
                    example: null
                  error:
                    type: object
                    properties:
                      code:
                        type: string
                      message:
                        type: string
                      details:
                        type: object
                        properties:
                          field_errors:
                            type: array
                            items:
                              type: object
                              properties:
                                path:
                                  type: string
                                message:
                                  type: string
                              required:
                                - path
                                - message
                              additionalProperties: false
                        additionalProperties: {}
                      traceId:
                        type: string
                    required:
                      - code
                      - message
                    additionalProperties: false
                required:
                  - success
                  - data
                  - error
                additionalProperties: false
              example:
                success: false
                data: null
                error:
                  code: VALIDATION_ERROR
                  message: Validation failed
        '401':
          description: Unauthorized - Invalid or missing OAuth JWT or Workspace API key
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    enum:
                      - false
                  data:
                    type: 'null'
                    example: null
                  error:
                    type: object
                    properties:
                      code:
                        type: string
                      message:
                        type: string
                      details:
                        type: object
                        properties:
                          field_errors:
                            type: array
                            items:
                              type: object
                              properties:
                                path:
                                  type: string
                                message:
                                  type: string
                              required:
                                - path
                                - message
                              additionalProperties: false
                        additionalProperties: {}
                      traceId:
                        type: string
                    required:
                      - code
                      - message
                    additionalProperties: false
                required:
                  - success
                  - data
                  - error
                additionalProperties: false
              example:
                success: false
                data: null
                error:
                  code: UNAUTHORIZED
                  message: Invalid or missing credential
        '403':
          description: >-
            Forbidden - Credential does not grant access to the requested
            resource
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    enum:
                      - false
                  data:
                    type: 'null'
                    example: null
                  error:
                    type: object
                    properties:
                      code:
                        type: string
                      message:
                        type: string
                      details:
                        type: object
                        properties:
                          field_errors:
                            type: array
                            items:
                              type: object
                              properties:
                                path:
                                  type: string
                                message:
                                  type: string
                              required:
                                - path
                                - message
                              additionalProperties: false
                        additionalProperties: {}
                      traceId:
                        type: string
                    required:
                      - code
                      - message
                    additionalProperties: false
                required:
                  - success
                  - data
                  - error
                additionalProperties: false
              example:
                success: false
                data: null
                error:
                  code: FORBIDDEN
                  message: Access denied
        '404':
          description: Farm not found
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    enum:
                      - false
                  data:
                    type: 'null'
                    example: null
                  error:
                    type: object
                    properties:
                      code:
                        type: string
                      message:
                        type: string
                      details:
                        type: object
                        properties:
                          field_errors:
                            type: array
                            items:
                              type: object
                              properties:
                                path:
                                  type: string
                                message:
                                  type: string
                              required:
                                - path
                                - message
                              additionalProperties: false
                        additionalProperties: {}
                      traceId:
                        type: string
                    required:
                      - code
                      - message
                    additionalProperties: false
                required:
                  - success
                  - data
                  - error
                additionalProperties: false
              example:
                success: false
                data: null
                error:
                  code: FARM_NOT_FOUND
                  message: Farm not found
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    enum:
                      - false
                  data:
                    type: 'null'
                    example: null
                  error:
                    type: object
                    properties:
                      code:
                        type: string
                      message:
                        type: string
                      details:
                        type: object
                        properties:
                          field_errors:
                            type: array
                            items:
                              type: object
                              properties:
                                path:
                                  type: string
                                message:
                                  type: string
                              required:
                                - path
                                - message
                              additionalProperties: false
                        additionalProperties: {}
                      traceId:
                        type: string
                    required:
                      - code
                      - message
                    additionalProperties: false
                required:
                  - success
                  - data
                  - error
                additionalProperties: false
              example:
                success: false
                data: null
                error:
                  code: INTERNAL_SERVER_ERROR
                  message: Internal server error
      security:
        - oauth-jwt: []
        - clerk-api-key: []
components:
  securitySchemes:
    oauth-jwt:
      scheme: bearer
      bearerFormat: JWT
      type: http
      description: Clerk OAuth JWT access token
    clerk-api-key:
      scheme: bearer
      bearerFormat: API Key
      type: http
      description: Workspace API key

````