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

# Get metric statistics over time

> Retrieves metric values over a specified time range with a given interval



## OpenAPI

````yaml /api-reference/endpoint/monitoring/openapi.json get /monitoring/metrics/{metric}/stats
openapi: 3.0.3
info:
  title: quiva.ai Gateway
  description: API for managing quiva.ai platform
  version: 1.0.0
  contact:
    name: quiva.ai Support
    url: https://app.quiva.ai
servers:
  - url: https://api.quiva.ai
    description: Production API server
security:
  - bearerAuth: []
  - apiKeyAuth: []
tags:
  - name: metrics
    description: Operations for retrieving metric data
paths:
  /monitoring/metrics/{metric}/stats:
    get:
      tags:
        - metrics
      summary: Get metric statistics over time
      description: >-
        Retrieves metric values over a specified time range with a given
        interval
      operationId: getMetricStats
      parameters:
        - name: metric
          in: path
          required: true
          description: Name of the metric to retrieve
          schema:
            type: string
            enum:
              - connections
              - totalConnections
              - numberOfSubscriptions
              - sentMessages
              - sentBytes
              - receivedMessages
              - receivedBytes
              - slowConsumers
              - memory
              - storage
              - accounts
              - haAssets
              - apiTotal
              - apiErrors
              - apiInflight
              - streams
              - consumers
              - totalMessages
              - totalBytes
              - numberOfSubjects
              - numberOfDeleted
              - lostMessages
              - lostBytes
              - numberOfAckPending
              - numberOfRedelivered
              - numberOfWaiting
              - numberOfPending
              - pushBound
              - paused
              - deliveredConsumerSequence
              - deliveredStreamSequence
              - deliveredLastActive
              - ackFloorConsumerSequence
              - ackFloorStreamSequence
              - ackFloorLastActive
              - ram
              - cpu
              - slowConsumersClients
              - slowConsumersRoutes
              - slowConsumersGateways
              - slowConsumersMeshs
              - sentMessagesRate
              - sentBytesRate
              - receivedMessagesRate
              - receivedBytesRate
          example: memory
        - name: from
          in: query
          required: true
          description: Start timestamp (ISO format)
          schema:
            type: string
            format: date-time
          example: '2025-05-09T10:00:00Z'
        - name: to
          in: query
          required: true
          description: End timestamp (ISO format)
          schema:
            type: string
            format: date-time
          example: '2025-05-10T10:00:00Z'
        - name: interval
          in: query
          required: false
          description: Aggregation interval in milliseconds
          schema:
            type: integer
            default: 5000
            minimum: 1
          example: 60000
        - name: node
          in: query
          required: false
          description: Node identifier
          schema:
            type: string
          example: node-a1b2c3
        - name: account
          in: query
          required: false
          description: Account identifier (required if node not provided)
          schema:
            type: string
          example: acme
        - name: stream
          in: query
          required: false
          description: Stream name
          schema:
            type: string
          example: events
        - name: consumer
          in: query
          required: false
          description: Consumer name (requires stream to be specified)
          schema:
            type: string
          example: processor
      responses:
        '200':
          description: Successful operation
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MetricStatsResponse'
              example:
                message: success
                data:
                  - ts: 1715155200000
                    value: 42.5
                  - ts: 1715155260000
                    value: 43.2
                  - ts: 1715155320000
                    value: 41.8
        '400':
          description: Bad request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                message: from and to fields are required
                data: null
        '404':
          description: Not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                message: no data
                data:
                  error: no data
        '500':
          description: Server error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                message: oops
                data: null
components:
  schemas:
    MetricStatsResponse:
      type: object
      properties:
        message:
          type: string
          description: Response message
        data:
          type: array
          items:
            $ref: '#/components/schemas/MetricPoint'
          description: Array of metric data points
        metadata:
          type: object
          additionalProperties: true
          description: Optional metadata
    ErrorResponse:
      type: object
      properties:
        message:
          type: string
          description: Error message
        data:
          type: object
          nullable: true
          additionalProperties: true
          description: Additional error details
        metadata:
          type: object
          nullable: true
          additionalProperties: true
          description: Optional metadata
    MetricPoint:
      type: object
      properties:
        ts:
          type: integer
          format: int64
          description: Timestamp in milliseconds since epoch
        value:
          type: number
          format: double
          description: Metric value

````