---
title: "Update Custom Metric"
description: "How to call Update Custom Metric (PATCH /api/custom-metrics/{id}) in the Klaviyo REST API: authentication, parameters, request and response bodies, and an example request."
url: "https://developers.klaviyo.com/en/v2026-07-15/reference/update_custom_metric"
revision: "2026-07-15"
latestUrl: "https://developers.klaviyo.com/en/reference/update_custom_metric"
operationId: "update_custom_metric"
method: "PATCH"
endpoint: "https://a.klaviyo.com/api/custom-metrics/{id}"
authentication: "privateKey"
scopes: ["metrics:write"]
rateLimits: {"burst":"1/s","steady":"15/m","daily":"15/d"}
revisionHeader: {"name":"revision","required":true}
deprecated: false
openApi: "https://raw.githubusercontent.com/klaviyo/openapi/2026-07-15/openapi/stable/apis/update_custom_metric.json"
jsonApi: {"fields":{"custom-metric":["created","definition","definition.aggregation_method","definition.metric_groups","id","name","updated"]}}
related: ["https://developers.klaviyo.com/en/v2026-07-15/reference/metrics/llms.txt","https://developers.klaviyo.com/en/v2026-07-15/reference/get_custom_metrics.md","https://developers.klaviyo.com/en/v2026-07-15/reference/get_custom_metric.md","https://developers.klaviyo.com/en/v2026-07-15/reference/create_custom_metric.md","https://developers.klaviyo.com/en/v2026-07-15/reference/delete_custom_metric.md","https://developers.klaviyo.com/en/v2026-07-15/reference/get_metrics_for_custom_metric.md","https://developers.klaviyo.com/en/v2026-07-15/reference/get_metric_ids_for_custom_metric.md"]
---

# Update Custom Metric

> This is the Markdown version of https://developers.klaviyo.com/en/v2026-07-15/reference/update_custom_metric

```http
PATCH https://a.klaviyo.com/api/custom-metrics/{id}
```

Update a custom metric with the given custom metric ID.

- Revision header: `revision: 2026-07-15` (required)
- Scopes: `metrics:write`
- Rate limits: Burst: `1/s`, Steady: `15/m`, Daily: `15/d`
- OpenAPI: [Download this endpoint's OpenAPI document](https://raw.githubusercontent.com/klaviyo/openapi/2026-07-15/openapi/stable/apis/update_custom_metric.json)

## Example request

```bash
curl --request PATCH \
     --url 'https://a.klaviyo.com/api/custom-metrics/925e385b52fb405715f3616c337cc65c' \
     --header 'Authorization: Klaviyo-API-Key your-private-api-key' \
     --header 'accept: application/vnd.api+json' \
     --header 'revision: 2026-07-15' \
     --header 'content-type: application/vnd.api+json' \
     --data '{
  "data": {
    "type": "custom-metric",
    "id": "925e385b52fb405715f3616c337cc65c",
    "attributes": {
      "name": "My custom metric",
      "definition": {
        "aggregation_method": "count",
        "metric_groups": [
          {
            "metric_id": "string"
          }
        ]
      }
    }
  }
}'
```

## Path parameters

- `id` (string, required): The ID of the custom metric Example: `925e385b52fb405715f3616c337cc65c`

## Query parameters

- `fields[custom-metric]` (string[]): For more information please visit [API overview](https://developers.klaviyo.com/en/v2026-07-15/reference.md) Allowed values: `created`, `definition`, `definition.aggregation_method`, `definition.metric_groups`, `id`, `name`, `updated`

## Headers

- `revision` (string, required): API endpoint revision (format: YYYY-MM-DD[.suffix]) Default: `2026-07-15`

## Request body

Content type: `application/vnd.api+json` (required)

- `data` (object, required)
  - `type` (string, required): Allowed values: `custom-metric`
  - `id` (string, required): The ID of the custom metric Example: `925e385b52fb405715f3616c337cc65c`
  - `attributes` (object, required)
    - `name` (string, nullable): The name for this custom metric. Names must be unique across the account.         Attempting to create a metric with a duplicate name will return a 400 status code. Example: `My custom metric`
    - `definition` (object)
      - `aggregation_method` (string, required): Method of aggregation for custom metric measurements. If a metric has a `value` aggregation method, it will be treated as a revenue metric, such as a Placed Order metric. If a metric has a `count` aggregation method, it will only be able to report on conversions like an Active on Site metric.
         Allowed values: `count`, `value`
      - `metric_groups` (object[], required): Fields nested this deep are in [the endpoint's OpenAPI document](https://raw.githubusercontent.com/klaviyo/openapi/2026-07-15/openapi/stable/apis/update_custom_metric.json).

### Example request body

```json
{
  "data": {
    "type": "custom-metric",
    "id": "925e385b52fb405715f3616c337cc65c",
    "attributes": {
      "name": "My custom metric",
      "definition": {
        "aggregation_method": "count",
        "metric_groups": [
          {
            "metric_id": "string"
          }
        ]
      }
    }
  }
}
```

## Responses

### 200: Success

Content type: `application/vnd.api+json`

- `data` (object, required)
  - `type` (string, required): Allowed values: `custom-metric`
  - `id` (string, required): The ID of the custom metric Example: `925e385b52fb405715f3616c337cc65c`
  - `attributes` (object, required)
    - `name` (string, required): The name for this custom metric. Names must be unique across the account.         Attempting to create a metric with a duplicate name will return a 400 status code. Example: `My custom metric`
    - `created` (string<date-time>, required): The datetime when this custom metric was created. Example: `2025-04-15T00:00:00Z`
    - `updated` (string<date-time>, required): The datetime when this custom metric was updated. Example: `2025-04-15T00:00:00Z`
    - `definition` (object, required): Same fields as CustomMetricDefinition in the request body above.
  - `relationships` (object)
    - `metrics` (object)
      - `data` (object[]): Fields nested this deep are in [the endpoint's OpenAPI document](https://raw.githubusercontent.com/klaviyo/openapi/2026-07-15/openapi/stable/apis/update_custom_metric.json).
      - `links` (object): Fields nested this deep are in [the endpoint's OpenAPI document](https://raw.githubusercontent.com/klaviyo/openapi/2026-07-15/openapi/stable/apis/update_custom_metric.json).
  - `links` (object, required)
    - `self` (string<uri>, required)
- `links` (ObjectLinks): Same fields as the first ObjectLinks above.
- `meta` (object): Response-level metadata
  - `agent_hints` (object): Optional hints emitted by the API for agent callers
    - `next_steps` (string[]): Suggested follow-up actions for agents to take after this response

#### Example response body

```json
{
  "data": {
    "type": "custom-metric",
    "id": "925e385b52fb405715f3616c337cc65c",
    "attributes": {
      "name": "My custom metric",
      "created": "2025-04-15T00:00:00Z",
      "updated": "2025-04-15T00:00:00Z",
      "definition": {
        "aggregation_method": "count",
        "metric_groups": [
          {
            "metric_id": "string",
            "metric_filters": [
              {
                "property": "string",
                "filter": {
                  "type": "numeric",
                  "operator": "equals",
                  "value": 0
                }
              }
            ],
            "value_property": "string"
          }
        ]
      }
    },
    "relationships": {
      "metrics": {
        "data": [
          {
            "type": "metric",
            "id": "string"
          }
        ],
        "links": {
          "self": "https://www.example.com",
          "related": "https://www.example.com"
        }
      }
    },
    "links": {
      "self": "https://www.example.com"
    }
  },
  "links": {
    "self": "https://www.example.com"
  },
  "meta": {
    "agent_hints": {
      "next_steps": [
        "string"
      ]
    }
  }
}
```

### 4XX: Client Error

Content type: `application/vnd.api+json`

- `errors` (object[], required)
  - `id` (string, required)
  - `code` (string, required)
  - `title` (string, required)
  - `detail` (string, required)
  - `source` (object)
    - `pointer` (string)
    - `parameter` (string)

#### Example response body

```json
{
  "errors": [
    {
      "id": "string",
      "code": "string",
      "title": "string",
      "detail": "string",
      "source": {
        "pointer": "string",
        "parameter": "string"
      }
    }
  ]
}
```

### 5XX: Server Error

Content type: `application/vnd.api+json`

- `errors` (object[], required)
  - `id` (string, required)
  - `code` (string, required)
  - `title` (string, required)
  - `detail` (string, required)
  - `source` (object)
    - `pointer` (string)
    - `parameter` (string)

#### Example response body

```json
{
  "errors": [
    {
      "id": "string",
      "code": "string",
      "title": "string",
      "detail": "string",
      "source": {
        "pointer": "string",
        "parameter": "string"
      }
    }
  ]
}
```
