> ## 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

> Edit a metric



## OpenAPI

````yaml put /metrics
openapi: 3.0.3
info:
  title: HoneyHive API
  version: 1.0.1
servers:
  - url: https://api.honeyhive.ai
security:
  - BearerAuth: []
paths:
  /metrics:
    put:
      tags:
        - Metrics
      summary: Update an existing metric
      description: Edit a metric
      operationId: updateMetric
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/MetricEdit'
      responses:
        '200':
          description: Metric updated successfully
      x-codeSamples:
        - lang: python
          label: updateMetric
          source: |-
            import honeyhive
            from honeyhive.models import components

            s = honeyhive.HoneyHive(
                bearer_auth="<YOUR_BEARER_TOKEN_HERE>",
            )


            res = s.metrics.update_metric(request=components.MetricEdit(
                metric_id='<value>',
            ))

            if res is not None:
                # handle response
                pass
        - lang: typescript
          label: updateMetric
          source: >-
            import { HoneyHive } from "honeyhive";

            import { MetricEditEventType, MetricEditReturnType, MetricEditType }
            from "honeyhive/dist/models/components";


            async function run() {
              const sdk = new HoneyHive({
                bearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
              });

              const res = await sdk.metrics.updateMetric({
                metricId: "<value>",
                threshold: {},
              });

              if (res.statusCode == 200) {
                // handle response
              }
            }


            run();
components:
  schemas:
    MetricEdit:
      type: object
      properties:
        metric_id:
          type: string
          description: Unique identifier of the metric
        criteria:
          type: string
          description: Criteria for human metrics
        name:
          type: string
          description: Updated name of the metric
        description:
          type: string
          description: Short description of what the metric does
        code_snippet:
          type: string
          description: Updated code block for the metric
        prompt:
          type: string
          description: Updated Evaluator prompt for the metric
        type:
          type: string
          enum:
            - custom
            - model
            - human
          description: Type of the metric - "custom", "model" or "human"
        enabled_in_prod:
          type: boolean
          description: Whether to compute on all production events automatically
        needs_ground_truth:
          type: boolean
          description: Whether a ground truth (on metadata) is required to compute it
        return_type:
          type: string
          enum:
            - boolean
            - float
            - string
          description: The data type of the metric value - "boolean", "float", "string"
        threshold:
          type: object
          properties:
            min:
              type: number
            max:
              type: number
          description: Threshold for numeric metrics to decide passing or failing in tests
        pass_when:
          type: boolean
          description: Threshold for boolean metrics to decide passing or failing in tests
        event_name:
          type: string
          description: Name of event that the metric is set to be computed on
        event_type:
          type: string
          enum:
            - model
            - tool
            - chain
            - session
          description: Type of event that the metric is set to be computed on
      required:
        - metric_id
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer

````