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

# Get training metric history

> Use a value from `metrics[].key` returned by `GET /api/v2-beta/training-runs/{trainingRunId}/metrics` as `metricKey`. Set `resolution` to choose the number of sampled history points; the default is 200. Returns 404 if the run or metric is unavailable.



## OpenAPI

````yaml /api-reference/openapi.json get /training-runs/{trainingRunId}/metrics/{metricKey}
openapi: 3.1.0
info:
  description: >-
    Manage projects, datasets, labeling pipelines, and model training. **Beta:**
    endpoints, request and response shapes, and error contracts can change
    without notice or a backward-compatibility promise.
  title: Toloka Platform API
  version: 2.0.0
servers:
  - url: https://platform.toloka.ai/api/v2-beta
security:
  - apiKeyAuth: []
  - scopedTokenAuth: []
tags:
  - description: The authenticated API key owner.
    name: Account
  - description: A project is the container for pipelines, datasets, and files.
    name: Projects
  - description: Rows and typed fields. Field schemas are immutable once created.
    name: Datasets
  - description: Append rows to a dataset from a file.
    name: Dataset uploads
  - description: Read a dataset out as a file.
    name: Dataset exports
  - description: A pipeline is a graph of nodes that processes each dataset item.
    name: Pipelines
  - description: The nodes, connections, fields, and version of a pipeline graph.
    name: Pipeline graph
  - description: Execute a pipeline over a dataset and inspect each item.
    name: Runs
  - description: Per-node checks that a pipeline must pass before deployment.
    name: Checks
  - description: Named credentials available to pipeline code.
    name: Secrets
  - description: Project files available to pipeline code and labeling interfaces.
    name: Files
  - description: >-
      Global, read-only catalog of the models a synthetic generation node can
      use, with their budget bounds.
    name: Generation models
  - description: >-
      Global, read-only catalog of the expert audience: the values a node
      `audience` filter can use.
    name: Audience
  - description: >-
      Project lists of experts a node can take its workforce from with
      `audienceMode: service`. Available only to teams with the audience service
      enabled.
    name: Expert lists
  - description: >-
      Experts banned in a project: they cannot be invited and are removed from
      the work they are in. Available only to teams with expert bans enabled.
    name: Expert ban list
  - description: Global, read-only base model catalog.
    name: Base models
  - description: Project-owned mutable model-training drafts.
    name: Trainings
  - description: Project-owned Models and immutable Model Versions.
    name: Models
  - name: Batch inference
paths:
  /training-runs/{trainingRunId}/metrics/{metricKey}:
    get:
      tags:
        - Trainings
      summary: Get training metric history
      description: >-
        Use a value from `metrics[].key` returned by `GET
        /api/v2-beta/training-runs/{trainingRunId}/metrics` as `metricKey`. Set
        `resolution` to choose the number of sampled history points; the default
        is 200. Returns 404 if the run or metric is unavailable.
      operationId: getTrainingRunMetricHistory
      parameters:
        - in: path
          name: trainingRunId
          required: true
          schema:
            $ref: '#/components/schemas/TrainingRunId'
        - description: >-
            Metric key from `metrics[].key` returned by the latest-metrics
            endpoint.
          in: path
          name: metricKey
          required: true
          schema:
            maxLength: 250
            minLength: 1
            type: string
        - description: >-
            Requested number of sampled history points, from 2 to 500; defaults
            to 200.
          in: query
          name: resolution
          schema:
            default: 200
            maximum: 500
            minimum: 2
            type: integer
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TrainingRunMetricHistory'
          description: Metric history sampled to the requested resolution
          headers:
            RateLimit-Limit:
              $ref: '#/components/headers/RateLimit-Limit'
            RateLimit-Policy:
              $ref: '#/components/headers/RateLimit-Policy'
            RateLimit-Remaining:
              $ref: '#/components/headers/RateLimit-Remaining'
            RateLimit-Reset:
              $ref: '#/components/headers/RateLimit-Reset'
            X-Request-Id:
              $ref: '#/components/headers/X-Request-Id'
        '404':
          description: Training Run or metric not found
          headers:
            RateLimit-Limit:
              $ref: '#/components/headers/RateLimit-Limit'
            RateLimit-Policy:
              $ref: '#/components/headers/RateLimit-Policy'
            RateLimit-Remaining:
              $ref: '#/components/headers/RateLimit-Remaining'
            RateLimit-Reset:
              $ref: '#/components/headers/RateLimit-Reset'
            X-Request-Id:
              $ref: '#/components/headers/X-Request-Id'
        '429':
          description: Rate limit exceeded
          headers:
            RateLimit-Limit:
              $ref: '#/components/headers/RateLimit-Limit'
            RateLimit-Policy:
              $ref: '#/components/headers/RateLimit-Policy'
            RateLimit-Remaining:
              $ref: '#/components/headers/RateLimit-Remaining'
            RateLimit-Reset:
              $ref: '#/components/headers/RateLimit-Reset'
            X-Request-Id:
              $ref: '#/components/headers/X-Request-Id'
      x-codeSamples:
        - label: TypeScript SDK
          lang: typescript
          source: >
            import assert from "node:assert/strict";

            import { createClient } from "@toloka-platform/sdk";


            const client = createClient({
              baseUrl: "https://platform.toloka.ai",
              apiKey: process.env.TOLOKA_API_KEY!,
            });


            const trainingRunId = "trn.019a0000-0000-7000-8000-000000000001";

            const { metrics } = await client.trainings.getRunMetrics({
            trainingRunId });

            const metric = metrics[0];

            assert(metric, "This run has no metrics yet.");


            const metricHistory = await client.trainings.getRunMetricHistory({
              trainingRunId: trainingRunId,
              metricKey: metric.key
            });

            console.log(metricHistory);
components:
  schemas:
    TrainingRunId:
      description: ID of the training run, with prefix `trn.`.
      pattern: >-
        ^trn\.[0-9a-f]{8}-[0-9a-f]{4}-[7][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$
      type: string
    TrainingRunMetricHistory:
      additionalProperties: false
      description: >-
        The history of one training run metric, sampled to the requested
        resolution.
      properties:
        key:
          description: Metric key accepted by the metric-history endpoint.
          maxLength: 250
          minLength: 1
          type: string
        metric:
          anyOf:
            - enum:
                - training_loss
                - validation_loss
                - learning_rate
                - training_token_accuracy
                - validation_token_accuracy
              type: string
            - type: 'null'
          description: >-
            Normalized metric name, or null when this key has no recognized
            metric name.
        points:
          description: Metric values sampled to the requested resolution.
          items:
            additionalProperties: false
            properties:
              nonFinite:
                anyOf:
                  - enum:
                      - nan
                      - positive_infinity
                      - negative_infinity
                    type: string
                  - type: 'null'
                description: >-
                  Non-finite value kind: `nan`, `positive_infinity`, or
                  `negative_infinity`; null for a finite numeric value.
              step:
                description: Training step at which this metric value was recorded.
                maximum: 9007199254740991
                minimum: 0
                type: integer
              timestamp:
                description: >-
                  Time the metric was recorded, in milliseconds since January 1,
                  1970, 00:00:00 UTC.
                maximum: 9007199254740991
                minimum: 0
                type: integer
              value:
                description: >-
                  Numeric metric value, or null when the recorded value is not
                  finite.
                type:
                  - number
                  - 'null'
            required:
              - step
              - timestamp
              - value
              - nonFinite
            type: object
          maxItems: 500
          type: array
        truncated:
          description: Whether metric points were omitted from this response.
          type: boolean
      required:
        - key
        - metric
        - points
        - truncated
      type: object
  headers:
    RateLimit-Limit:
      description: The maximum number of requests allowed in the current window.
      schema:
        type: integer
    RateLimit-Policy:
      description: The rate limit policy (e.g., "60;w=60").
      schema:
        type: string
    RateLimit-Remaining:
      description: The number of requests remaining in the current window.
      schema:
        type: integer
    RateLimit-Reset:
      description: The number of seconds until the current window resets.
      schema:
        type: integer
    X-Request-Id:
      description: >-
        The request id: the X-Request-Id you sent when it is 1-128 characters of
        letters, digits, ".", "_" or "-", otherwise a generated UUID. Present on
        every response, including errors; quote it when reporting a problem.
      schema:
        type: string
  securitySchemes:
    apiKeyAuth:
      description: >-
        Enter `ApiKey <your-api-key>` in Authorization, including the `ApiKey `
        prefix. In cURL and Python samples, `<api-key>` means this full value.
        The TypeScript SDK adds the prefix for you.
      in: header
      name: Authorization
      type: apiKey
    scopedTokenAuth:
      description: >-
        Enter the project-scoped token as `pst_...` in X-Scoped-Token, without
        an `ApiKey ` prefix. Create a token with POST
        /projects/{projectId}/tokens.
      in: header
      name: X-Scoped-Token
      type: apiKey

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.