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

# Update Custom Metric

> Update an existing custom metric configuration

## Overview

Updates the configuration of an existing custom metric. You can modify the description, type, and options (for enum types).

## Partial Updates

You only need to include the fields you want to update:

```json theme={null}
{
  "metric": {
    "description": "Updated description for the metric"
  }
}
```

## Updating Enum Options

For enum type metrics, you can add or modify options:

```json theme={null}
{
  "metric": {
    "options": ["positive", "negative", "neutral", "mixed"]
  }
}
```

<Warning>
  **Important Considerations:**

  * Changing the metric type may affect existing data interpretation
  * Historical data is not automatically converted when you change types
  * Duplicate keys are not allowed - the update will fail if the new key already exists
</Warning>

## Use Cases

* **Refine Descriptions**: Make metric descriptions clearer
* **Add Enum Options**: Expand categorical options as needs evolve
* **Correct Typos**: Fix mistakes in metric configuration
* **Update Metadata**: Keep metric information current

<Note>
  System metrics (where `isSystem: true`) cannot be updated via the API.
</Note>

## Example: Expanding Options

```json theme={null}
{
  "metric": {
    "description": "Customer sentiment with granular options",
    "options": [
      "very_positive",
      "positive", 
      "neutral",
      "negative",
      "very_negative"
    ]
  }
}
```

## Common Update Scenarios

### Update Description Only

```json theme={null}
{
  "metric": {
    "description": "Updated: Customer satisfaction rating on a scale of 1-10"
  }
}
```

### Update Key

```json theme={null}
{
  "metric": {
    "key": "customer_satisfaction_v2"
  }
}
```

### Update Type

```json theme={null}
{
  "metric": {
    "type": "enum",
    "options": ["low", "medium", "high"]
  }
}
```

<Tip>
  Before changing a metric's type, consider creating a new metric instead to preserve historical data integrity.
</Tip>


## OpenAPI

````yaml PUT /agents/{agentId}/custom-metrics/{metricId}
openapi: 3.0.3
info:
  title: Convocore OpenAPI
  description: Full API reference for Convocore
  version: 1.0.4
servers:
  - url: https://eu-gcp-api.vg-stuff.com/v3
    description: EU Node.js API server
  - url: https://na-gcp-api.vg-stuff.com/v3
    description: NA Node.js API server
security: []
paths:
  /agents/{agentId}/custom-metrics/{metricId}:
    put:
      tags:
        - Custom Metrics
      summary: Update an existing custom metric
      description: >-
        Updates an existing custom metric. You can update the description, type,
        and options. Note that changing the type may affect existing data.
      operationId: customMetrics-updateMetric
      parameters:
        - name: agentId
          in: path
          required: true
          schema:
            type: string
          description: The unique identifier of the agent
        - name: metricId
          in: path
          required: true
          schema:
            type: string
          description: The unique identifier of the metric to update
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                metric:
                  type: object
                  properties:
                    key:
                      type: string
                      minLength: 1
                      maxLength: 100
                      description: Unique key for the metric
                    description:
                      type: string
                      maxLength: 500
                      description: Description of what this metric measures
                    type:
                      type: string
                      enum:
                        - number
                        - boolean
                        - enum
                        - string
                      description: Type of metric
                    options:
                      type: array
                      items:
                        type: string
                      description: 'For ''enum'' type: list of possible values'
                  additionalProperties: false
              required:
                - metric
              additionalProperties: false
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                  message:
                    type: string
                  metric:
                    type: object
                    properties:
                      id:
                        type: string
                      key:
                        type: string
                      description:
                        type: string
                      isSystem:
                        type: boolean
                      type:
                        type: string
                        enum:
                          - number
                          - boolean
                          - enum
                          - string
                      options:
                        type: array
                        items:
                          type: string
                      createdAtUNIX:
                        type: number
                      updatedAtUNIX:
                        type: number
                    required:
                      - id
                      - key
                      - description
                      - type
                    additionalProperties: false
                required:
                  - success
                  - message
                  - metric
                additionalProperties: false
        default:
          $ref: '#/components/responses/error'
      security:
        - Authorization: []
components:
  responses:
    error:
      description: Error response
      content:
        application/json:
          schema:
            type: object
            properties:
              message:
                type: string
              code:
                type: string
              issues:
                type: array
                items:
                  type: object
                  properties:
                    message:
                      type: string
                  required:
                    - message
                  additionalProperties: false
            required:
              - message
              - code
            additionalProperties: false
  securitySchemes:
    Authorization:
      type: http
      scheme: bearer

````