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

# Update an existing metric

> Update a metric's editable fields. Only fields included in the request body are modified.



## OpenAPI

````yaml https://raw.githubusercontent.com/honeyhiveai/honeyhive-openapi/main/openapi.yaml put /v1/metrics/{metric_id}
openapi: 3.1.0
info:
  title: HoneyHive Data Plane API
  license:
    name: MIT
    url: https://opensource.org/licenses/MIT
  version: 1.2.1
servers:
  - url: https://api.honeyhive.ai
security:
  - BearerAuth: []
tags:
  - name: Charts
    description: >
      Define and manage saved charts. Charts are visualizations that aggregate
      metrics over time with bucketing, filters, and groupings.
  - name: Configurations
    description: >
      Manage prompt configurations, i.e. model parameters, message templates,
      and response settings that can be versioned and deployed without code
      changes.
  - name: Datapoints
    description: >
      Manage individual records inside datasets, including batch creation and
      mapping to source events.
  - name: Datasets
    description: >
      Curate collections of datapoints used as test sets for evaluations and
      experiments.
  - name: Events
    description: >
      Read and write trace events. Events are the spans that capture every step
      of an AI application's execution.
  - name: Experiments
    description: >
      Run, retrieve, and compare evaluation runs to measure how prompt or
      configuration changes affect agent performance.
  - name: Metric Versions
    description: >
      Snapshot, list, and deploy versions of a metric's definition so changes
      can be reviewed and rolled back without losing history.
  - name: Metrics
    description: >
      Define and run evaluators, i.e. automated quality checks that score traces
      against criteria like accuracy, safety, or correctness.
  - name: Queues
    description: >
      Manage annotation queues for human review of traces, turning expert
      feedback into labeled datasets.
  - name: Sessions
    description: >
      Group related trace events into sessions, the top-level container for a
      multi-step or multi-service AI interaction.
paths:
  /v1/metrics/{metric_id}:
    put:
      tags:
        - Metrics
      summary: Update an existing metric
      description: >-
        Update a metric's editable fields. Only fields included in the request
        body are modified.
      operationId: updateMetric
      parameters:
        - in: path
          name: metric_id
          required: true
          schema:
            type: string
          description: The unique identifier of the metric to update
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateMetricRequest'
      responses:
        '200':
          description: Metric updated successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UpdateMetricResponse'
components:
  schemas:
    UpdateMetricRequest:
      type: object
      properties:
        name:
          type: string
          maxLength: 200
        type:
          type: string
          enum:
            - PYTHON
            - LLM
            - HUMAN
            - COMPOSITE
        criteria:
          type: string
          minLength: 1
        description:
          type:
            - string
            - 'null'
        return_type:
          type: string
          enum:
            - float
            - boolean
            - string
            - categorical
        enabled_in_prod:
          type: boolean
        needs_ground_truth:
          type: boolean
        sampling_percentage:
          type: number
          minimum: 0
          maximum: 100
        model_provider:
          type:
            - string
            - 'null'
        model_name:
          type:
            - string
            - 'null'
        scale:
          type:
            - integer
            - 'null'
          exclusiveMinimum: 0
        threshold:
          $ref: '#/components/schemas/UpdateMetricRequestThreshold'
        categories:
          type: array
          items:
            $ref: '#/components/schemas/UpdateMetricRequestCategoriesItem'
          minItems: 1
        child_metrics:
          type: array
          items:
            $ref: '#/components/schemas/UpdateMetricRequestChildMetricsItem'
          minItems: 1
        filters:
          $ref: '#/components/schemas/UpdateMetricRequestFilters'
      additionalProperties: false
      description: Request body for PUT /metrics/{metric_id}
    UpdateMetricResponse:
      type: object
      properties:
        updated:
          type: boolean
      required:
        - updated
      description: Response for PUT /metrics
    UpdateMetricRequestThreshold:
      type: object
      properties:
        min:
          type: number
        max:
          type: number
        pass_when:
          anyOf:
            - type: boolean
            - type: number
        passing_categories:
          type: array
          items:
            type: string
            maxLength: 200
          minItems: 1
      additionalProperties: false
    UpdateMetricRequestCategoriesItem:
      type: object
      properties:
        category:
          type: string
          maxLength: 200
        score:
          type:
            - number
            - 'null'
      required:
        - category
        - score
      additionalProperties: false
    UpdateMetricRequestChildMetricsItem:
      type: object
      properties:
        id:
          type: string
          minLength: 1
        name:
          type: string
          maxLength: 200
        weight:
          type: number
        scale:
          type:
            - integer
            - 'null'
          exclusiveMinimum: 0
      required:
        - name
        - weight
      additionalProperties: false
    UpdateMetricRequestFilters:
      type: object
      properties:
        filterArray:
          $ref: '#/components/schemas/FiltersArray'
      required:
        - filterArray
      additionalProperties: false
    FiltersArray:
      type: array
      items:
        $ref: '#/components/schemas/SingleFilter'
    SingleFilter:
      type: object
      properties:
        field:
          type: string
        operator:
          type: string
          enum:
            - exists
            - not exists
            - is
            - is not
            - contains
            - not contains
            - greater than
            - less than
            - after
            - before
        value:
          anyOf:
            - type: string
            - type: number
            - type: boolean
            - type: 'null'
        type:
          type: string
          enum:
            - string
            - number
            - boolean
            - datetime
      required:
        - field
        - operator
        - value
        - type
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer

````