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

# Query metric time series

> Get time-bucketed metric values for charts, optionally grouped by a label



## OpenAPI

````yaml https://controller.simplecloud.app/swagger/doc.json get /v0/metrics/query_range
openapi: 3.1.0
info:
  contact:
    email: support@swagger.io
    name: API Support
    url: http://www.swagger.io/support
  description: API for SimpleCloud Controller
  license:
    name: Apache 2.0
    url: http://www.apache.org/licenses/LICENSE-2.0.html
  termsOfService: http://swagger.io/terms/
  title: SimpleCloud Controller API
  version: '1.0'
servers:
  - url: https://controller.platform.simplecloud.app/
security: []
externalDocs:
  description: ''
  url: ''
paths:
  /v0/metrics/query_range:
    get:
      tags:
        - metrics
      summary: Query metric time series
      description: >-
        Get time-bucketed metric values for charts, optionally grouped by a
        label
      parameters:
        - description: Network ID
          in: header
          name: X-Network-ID
          required: true
          schema:
            type: string
        - description: Network Secret
          in: header
          name: X-Network-Secret
          required: true
          schema:
            type: string
        - description: >-
            Comma-separated metric names (e.g.,
            server.cpu_usage_percent,server.memory_usage_mb)
          in: query
          name: metrics
          required: true
          schema:
            type: string
        - description: Start timestamp in RFC3339 format (e.g., 2025-12-24T00:00:00Z)
          in: query
          name: from
          required: true
          schema:
            type: string
        - description: End timestamp in RFC3339 format (e.g., 2025-12-24T12:00:00Z)
          in: query
          name: to
          required: true
          schema:
            type: string
        - description: Aggregation interval (e.g., 5m, 1h). Auto-calculated if omitted
          in: query
          name: step
          schema:
            type: string
        - description: Label to group by (e.g., server_group_name, persistent_server_name)
          in: query
          name: group_by
          schema:
            type: string
        - description: 'Aggregation function: avg (default), sum, max, min'
          in: query
          name: aggregation
          schema:
            type: string
        - description: Comma-separated server IDs to filter
          in: query
          name: server_ids
          schema:
            type: string
        - description: Comma-separated server group IDs to filter
          in: query
          name: server_group_ids
          schema:
            type: string
        - description: Comma-separated persistent server IDs to filter
          in: query
          name: persistent_server_ids
          schema:
            type: string
        - description: Comma-separated server group types to filter (e.g., SERVER, PROXY)
          in: query
          name: server_type
          schema:
            type: string
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/metrics.TimeSeriesResult'
          description: OK
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/models.ErrorResponse'
          description: Bad Request
        '401':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/models.ErrorResponse'
          description: Unauthorized
        '500':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/models.ErrorResponse'
          description: Internal Server Error
        '503':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/models.ErrorResponse'
          description: Service Unavailable
components:
  schemas:
    metrics.TimeSeriesResult:
      properties:
        series:
          items:
            $ref: '#/components/schemas/metrics.Series'
          type: array
          uniqueItems: false
      type: object
    models.ErrorResponse:
      description: Generic error response
      properties:
        error:
          type: string
      type: object
    metrics.Series:
      properties:
        labels:
          additionalProperties:
            type: string
          type: object
        metric:
          type: string
        points:
          items:
            $ref: '#/components/schemas/metrics.DataPoint'
          type: array
          uniqueItems: false
      type: object
    metrics.DataPoint:
      properties:
        timestamp:
          type: string
        value:
          type: number
      type: object

````