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

# Get Timeseries Metric



## OpenAPI

````yaml https://app.stainlessapi.com/api/spec/documented/sgp/openapi.yml get /v4/applications/{application_spec_id}/metrics/timeseries/{metric_id}
openapi: 3.1.0
info:
  title: EGP API V4
  description: >-
    This is the parent API for all EGP APIs. If you are looking for the EGP API,
    please go to https://api.egp.scale.com/docs.
  contact:
    name: Scale Generative AI Platform
    url: https://scale.com/genai-platform
  version: 0.1.0
servers:
  - url: https://api.egp.scale.com
security: []
tags:
  - name: Models
    description: Model API.
paths:
  /v4/applications/{application_spec_id}/metrics/timeseries/{metric_id}:
    get:
      tags:
        - MonitoringDashboard
      summary: Get Timeseries Metric
      operationId: GET-V4-/metrics/timeseries/{metric_id}
      parameters:
        - name: application_spec_id
          in: path
          required: true
          schema:
            type: string
            title: Application Spec Id
        - name: metric_id
          in: path
          required: true
          schema:
            $ref: '#/components/schemas/MetricID'
        - name: variants
          in: query
          required: false
          schema:
            anyOf:
              - items:
                  type: string
                type: array
              - type: 'null'
            description: Which variants to filter on
            default: []
            title: Variants
          description: Which variants to filter on
        - name: from_ts
          in: query
          required: false
          schema:
            anyOf:
              - type: integer
              - type: 'null'
            description: The starting (oldest) timestamp window in seconds.
            title: From Ts
          description: The starting (oldest) timestamp window in seconds.
        - name: to_ts
          in: query
          required: false
          schema:
            anyOf:
              - type: integer
              - type: 'null'
            description: The ending (most recent) timestamp in seconds.
            title: To Ts
          description: The ending (most recent) timestamp in seconds.
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TimeseriesData'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      x-codeSamples:
        - lang: Python
          source: |-
            import os
            from scale_gp import SGPClient

            client = SGPClient(
                api_key=os.environ.get("SGP_API_KEY"),  # This is the default and can be omitted
            )
            timeseries_data = client.applications.metrics.timeseries.retrieve(
                metric_id="total_requests",
                application_spec_id="application_spec_id",
            )
            print(timeseries_data.bins)
        - lang: Go
          source: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/stainless-sdks/sgp-go\"\n\t\"github.com/stainless-sdks/sgp-go/option\"\n)\n\nfunc main() {\n\tclient := sgp.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\ttimeseriesData, err := client.Applications.Metrics.Timeseries.Get(\n\t\tcontext.TODO(),\n\t\t\"application_spec_id\",\n\t\tsgp.ApplicationMetricTimeseryGetParamsMetricIDTotalRequests,\n\t\tsgp.ApplicationMetricTimeseryGetParams{},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", timeseriesData.Bins)\n}\n"
components:
  schemas:
    MetricID:
      type: string
      enum:
        - total_requests
        - total_errors
        - total_tokens
        - average_latency
        - p95_latency
        - error_rate
        - average_users
        - aggregated_tokens
        - feedback
        - execution_input_response_tokens
        - execution_average_latency_per_variant
        - execution_error_rate
        - execution_latency_percentile
        - execution_average_latency_per_node
      title: MetricID
    TimeseriesData:
      properties:
        bins:
          items:
            type: string
            format: date-time
          type: array
          title: Bins
        values:
          items:
            $ref: '#/components/schemas/TimeseriesDataEntry'
          type: array
          title: Values
        unit:
          title: Unit
          type: string
      type: object
      required:
        - bins
        - values
      title: TimeseriesData
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    TimeseriesDataEntry:
      properties:
        label:
          title: Label
          type: string
        value:
          items:
            anyOf:
              - type: number
              - type: integer
          type: array
          title: Value
      type: object
      required:
        - label
        - value
      title: TimeseriesDataEntry
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
        input:
          title: Input
        ctx:
          type: object
          title: Context
          additionalProperties: true
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError

````