MLflow Metrics API

Log and retrieve metric history for runs.

OpenAPI Specification

mlflow-metrics-api-openapi.yml Raw ↑
openapi: 3.1.0
info:
  title: MLflow Tracking REST Artifacts Metrics API
  version: '2.0'
  summary: REST API for the MLflow tracking server, model registry, and metrics.
  description: 'MLflow is an open-source platform for the end-to-end ML and GenAI lifecycle.

    The tracking server exposes REST endpoints under `/api/2.0/mlflow` for

    experiments, runs, metrics, parameters, artifacts, and the model registry.

    See https://mlflow.org/docs/latest/rest-api.html

    '
  contact:
    name: MLflow
    url: https://mlflow.org/
  license:
    name: Apache-2.0
    url: https://www.apache.org/licenses/LICENSE-2.0
servers:
- url: http://localhost:5000
  description: Default local MLflow tracking server
- url: https://{host}
  description: Self-hosted MLflow tracking server
  variables:
    host:
      default: mlflow.example.com
      description: Hostname of the MLflow tracking server
security:
- {}
- basicAuth: []
tags:
- name: Metrics
  description: Log and retrieve metric history for runs.
paths:
  /api/2.0/mlflow/runs/log-metric:
    post:
      tags:
      - Metrics
      summary: Log a metric for a run
      operationId: logMetric
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
              - run_id
              - key
              - value
              - timestamp
              properties:
                run_id:
                  type: string
                key:
                  type: string
                value:
                  type: number
                timestamp:
                  type: integer
                step:
                  type: integer
      responses:
        '200':
          description: Metric logged
  /api/2.0/mlflow/runs/log-parameter:
    post:
      tags:
      - Metrics
      summary: Log a parameter for a run
      operationId: logParameter
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
              - run_id
              - key
              - value
              properties:
                run_id:
                  type: string
                key:
                  type: string
                value:
                  type: string
      responses:
        '200':
          description: Parameter logged
  /api/2.0/mlflow/runs/log-batch:
    post:
      tags:
      - Metrics
      summary: Log a batch of metrics, params, and tags
      operationId: logBatch
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                run_id:
                  type: string
                metrics:
                  type: array
                  items:
                    type: object
                params:
                  type: array
                  items:
                    type: object
                tags:
                  type: array
                  items:
                    type: object
      responses:
        '200':
          description: Batch logged
  /api/2.0/mlflow/metrics/get-history:
    get:
      tags:
      - Metrics
      summary: Get metric history
      operationId: getMetricHistory
      parameters:
      - in: query
        name: run_id
        required: true
        schema:
          type: string
      - in: query
        name: metric_key
        required: true
        schema:
          type: string
      responses:
        '200':
          description: Metric history
components:
  securitySchemes:
    basicAuth:
      type: http
      scheme: basic
      description: 'Optional HTTP Basic authentication when the MLflow tracking server is

        configured with the `mlflow-basic-auth` plugin. Default open-source

        servers run without authentication.

        '