> ## 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.

# List Granted Farm Metrics

> Returns historical farm metrics for a granted (cross-org) farm. The `granularity` query parameter selects the time resolution. `day` (default) returns the full daily metric set; `hour` and `10min` return a hashrate-only subset (period, pool hashrate, online / offline miner counts) aggregated from raw 10-minute samples. Sub-day query windows are bounded: `10min` up to 7 days, `hour` up to 60 days.



## OpenAPI

````yaml /api-reference/openapi.json get /private-api/v1/granted/{workspace_id}/farms/{farm_id}/metrics/history
openapi: 3.1.0
info:
  title: Nonce Private API
  description: |-
    Nonce Private API documentation - Internal endpoints for system integration

    Generated by NestJS Swagger Module with nestjs-zod
    Scope: Private API endpoints only (/private-api/*)
    Do not edit this file manually - regenerate with: pnpm run docs:openapi
  version: 1.0.0
  contact: {}
servers:
  - url: https://api.nonce.app
    description: Production server
security: []
tags: []
paths:
  /private-api/v1/granted/{workspace_id}/farms/{farm_id}/metrics/history:
    get:
      tags:
        - Private API - Cross-Org
      summary: List Granted Farm Metrics
      description: >-
        Returns historical farm metrics for a granted (cross-org) farm. The
        `granularity` query parameter selects the time resolution. `day`
        (default) returns the full daily metric set; `hour` and `10min` return a
        hashrate-only subset (period, pool hashrate, online / offline miner
        counts) aggregated from raw 10-minute samples. Sub-day query windows are
        bounded: `10min` up to 7 days, `hour` up to 60 days.
      operationId: GrantedListFarmMetrics
      parameters:
        - name: workspace_id
          required: true
          in: path
          schema:
            type: string
        - name: farm_id
          required: true
          in: path
          schema:
            type: string
        - name: page
          required: false
          in: query
          description: 'Page number (default: 1)'
          schema:
            minimum: 1
            example: 1
            type: number
        - name: pageSize
          required: false
          in: query
          description: 'Number of items per page (default: 10, max: 10000)'
          schema:
            minimum: 1
            maximum: 10000
            example: 10
            type: number
        - name: from_date
          required: true
          in: query
          description: Date in YYYY-MM-DD format
          schema:
            format: date
            pattern: ^\d{4}-\d{2}-\d{2}$
            example: '2025-09-07'
            type: string
        - name: to_date
          required: true
          in: query
          description: Date in YYYY-MM-DD format
          schema:
            format: date
            pattern: ^\d{4}-\d{2}-\d{2}$
            example: '2025-09-07'
            type: string
        - name: granularity
          required: false
          in: query
          description: >-
            Time resolution of the returned metrics.

            - `day` (default): full daily metric set (pool / agent hashrate,
            online miners, BTC earnings, electricity).

            - `hour` / `10min`: hashrate-only subset (period, pool hashrate,
            online / offline miner counts) aggregated from raw 10-minute
            samples.

            Sub-day query windows are bounded: `10min` up to 7 days, `hour` up
            to 60 days. `day` is unbounded.
          schema:
            enum:
              - day
              - hour
              - 10min
            type: string
      responses:
        '200':
          description: Successfully retrieved granted farm metrics
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                    description: Indicates if the request was successful
                  data:
                    type: array
                    description: Array of items
                    items:
                      anyOf:
                        - type: object
                          properties:
                            id:
                              type: string
                              description: Id (uuid generated by nonce system)
                              example: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
                            farm_id:
                              type: string
                              description: Farm Id (uuid generated by nonce system)
                              example: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
                            workspace_id:
                              type: string
                              description: Workspace Id
                              example: org_xxxxxxxxxxxxxxxxxxxxxxxxxxx
                            period:
                              type: string
                              description: The period timestamp for this metric record
                              example: '2025-09-07T00:00:00.000Z'
                              format: date-time
                            pool:
                              type: object
                              properties:
                                hashrate:
                                  description: Hashrate value from Pool in H/s
                                  example: 100120000000000
                                  type:
                                    - number
                                    - 'null'
                                online_miners:
                                  description: Number of online miners from pool
                                  example: 2500
                                  type:
                                    - number
                                    - 'null'
                              required:
                                - hashrate
                                - online_miners
                            agent:
                              type: object
                              properties:
                                hashrate:
                                  description: Hashrate value from Agent in H/s
                                  example: 100120000000000
                                  type:
                                    - number
                                    - 'null'
                                online_miners:
                                  description: Number of online miners from agent
                                  example: 23
                                  type:
                                    - number
                                    - 'null'
                              required:
                                - hashrate
                                - online_miners
                            finance:
                              type: object
                              properties:
                                earning_btc:
                                  description: Earning in BTC
                                  example: 0.00123456
                                  type:
                                    - number
                                    - 'null'
                              required:
                                - earning_btc
                            electricity:
                              type: object
                              properties:
                                agent_energy:
                                  description: >-
                                    Agent-reported daily energy consumption in
                                    kWh
                                  example: 234.56
                                  type:
                                    - number
                                    - 'null'
                                agent_electricity_cost:
                                  description: >-
                                    Estimated daily electricity cost based on
                                    agent energy (USD)
                                  example: 15.25
                                  type:
                                    - number
                                    - 'null'
                                pool_energy:
                                  description: >-
                                    Estimated daily energy consumption based on
                                    pool hashrate and theo efficiency in kWh
                                  example: 220.8
                                  type:
                                    - number
                                    - 'null'
                                pool_electricity_cost:
                                  description: >-
                                    Estimated daily electricity cost based on
                                    pool energy (USD)
                                  example: 14.35
                                  type:
                                    - number
                                    - 'null'
                                theo_energy:
                                  description: >-
                                    Theoretical daily energy consumption based
                                    on farm worker specs in kWh
                                  example: 250
                                  type:
                                    - number
                                    - 'null'
                                theo_electricity_cost:
                                  description: >-
                                    Theoretical daily electricity cost based on
                                    theo energy (USD)
                                  example: 16.25
                                  type:
                                    - number
                                    - 'null'
                              required:
                                - agent_energy
                                - agent_electricity_cost
                                - pool_energy
                                - pool_electricity_cost
                                - theo_energy
                                - theo_electricity_cost
                          required:
                            - id
                            - farm_id
                            - workspace_id
                            - period
                            - pool
                            - agent
                            - finance
                            - electricity
                          title: Farm Metric History
                        - type: object
                          properties:
                            period:
                              type: string
                              description: The period timestamp for this metric record
                              example: '2025-09-07T00:00:00.000Z'
                              format: date-time
                            pool:
                              type: object
                              properties:
                                hashrate:
                                  description: Hashrate value from Pool in H/s
                                  example: 100120000000000
                                  type:
                                    - number
                                    - 'null'
                                online_miners:
                                  description: Number of online miners from pool
                                  example: 2500
                                  type:
                                    - number
                                    - 'null'
                                offline_miners:
                                  description: Number of offline miners from pool
                                  example: 12
                                  type:
                                    - number
                                    - 'null'
                              required:
                                - hashrate
                                - online_miners
                                - offline_miners
                          required:
                            - period
                            - pool
                          title: Farm Sub-Day Metric History
                  pagination:
                    type: object
                    description: Pagination metadata
                    properties:
                      total:
                        type: number
                        example: 50
                        description: Total number of items
                      limit:
                        type: number
                        example: 10
                        description: Maximum number of items per page
                      offset:
                        type: number
                        example: 0
                        description: Number of items to skip
                      hasNext:
                        type: boolean
                        example: true
                        description: Whether there are more items after this page
                      hasPrevious:
                        type: boolean
                        example: false
                        description: Whether there are items before this page
                    required:
                      - total
                      - limit
                      - offset
                      - hasNext
                      - hasPrevious
                  error:
                    type: 'null'
                    example: null
                    description: Error object (null on success)
                required:
                  - success
                  - data
                  - pagination
                  - error
        '400':
          description: Bad Request - Invalid parameters
          content:
            application/json:
              schema:
                type: object
                properties:
                  statusCode:
                    type: number
                    description: HTTP status code
                    example: 400
                  message:
                    type: string
                    description: Error message
                    example: Invalid request parameters
                  error:
                    type: string
                    description: Error type
                    example: Bad Request
                required:
                  - statusCode
                  - message
                  - error
        '401':
          description: Unauthorized - Invalid or missing API key
          content:
            application/json:
              schema:
                type: object
                properties:
                  statusCode:
                    type: number
                    description: HTTP status code
                    example: 401
                  message:
                    type: string
                    description: Error message
                    example: Invalid or missing API key
                  error:
                    type: string
                    description: Error type
                    example: Unauthorized
                required:
                  - statusCode
                  - message
                  - error
        '403':
          description: Forbidden - Valid API key but insufficient permissions
          content:
            application/json:
              schema:
                type: object
                properties:
                  statusCode:
                    type: number
                    description: HTTP status code
                    example: 403
                  message:
                    type: string
                    description: Error message
                    example: Access denied to workspace
                  error:
                    type: string
                    description: Error type
                    example: Forbidden
                required:
                  - statusCode
                  - message
                  - error
      security:
        - clerk-api-key: []
components:
  securitySchemes:
    clerk-api-key:
      scheme: bearer
      bearerFormat: API Key
      type: http
      description: Clerk Machine API Key for authentication

````