---
title: "Update Mapped Metric"
description: "How to call Update Mapped Metric (PATCH /api/mapped-metrics/{id}) in the Klaviyo REST API: authentication, parameters, request and response bodies, and an example request."
url: "https://developers.klaviyo.com/en/reference/update_mapped_metric"
revision: "2026-10-15"
operationId: "update_mapped_metric"
method: "PATCH"
endpoint: "https://a.klaviyo.com/api/mapped-metrics/{id}"
authentication: "privateKey"
scopes: ["metrics:write"]
rateLimits: {"burst":"1/s","steady":"15/m","daily":"30/d"}
revisionHeader: {"name":"revision","required":true}
deprecated: false
openApi: "https://raw.githubusercontent.com/klaviyo/openapi/2026-10-15/openapi/stable/apis/update_mapped_metric.json"
jsonApi: {"fields":{"mapped-metric":["id","updated"]}}
related: ["https://developers.klaviyo.com/en/reference/metrics/llms.txt","https://developers.klaviyo.com/en/reference/get_mapped_metrics.md","https://developers.klaviyo.com/en/reference/get_mapped_metric.md","https://developers.klaviyo.com/en/reference/get_metric_for_mapped_metric.md","https://developers.klaviyo.com/en/reference/get_metric_id_for_mapped_metric.md","https://developers.klaviyo.com/en/reference/get_custom_metric_for_mapped_metric.md","https://developers.klaviyo.com/en/reference/get_custom_metric_id_for_mapped_metric.md"]
---

# Update Mapped Metric

> This is the Markdown version of https://developers.klaviyo.com/en/reference/update_mapped_metric

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

Update the mapped metric with the given ID.

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

## Example request

### curl

```bash
curl --request PATCH \
     --url 'https://a.klaviyo.com/api/mapped-metrics/revenue' \
     --header 'Authorization: Klaviyo-API-Key your-private-api-key' \
     --header 'accept: application/vnd.api+json' \
     --header 'revision: 2026-10-15' \
     --header 'content-type: application/vnd.api+json' \
     --data '{
  "data": {
    "type": "mapped-metric",
    "id": "revenue"
  }
}'
```

### CLI

```bash
klaviyo metrics update-mapped-metric revenue \
  -d '{
  "data": {
    "type": "mapped-metric",
    "id": "revenue"
  }
}'
```

Sign in first with `klaviyo auth login`. [Install the Klaviyo CLI](https://developers.klaviyo.com/en/docs/klaviyo_cli.md)

### Python

```python
from klaviyo_api import KlaviyoAPI

klaviyo = KlaviyoAPI("your-private-api-key")

response = klaviyo.Metrics.update_mapped_metric(
    "revenue",
    {
        "data": {
            "type": "mapped-metric",
            "id": "revenue",
        },
    },
)
```

Install it with `pip install klaviyo-api`. [The Python SDK on GitHub](https://github.com/klaviyo/klaviyo-api-python)

### Node.js

```javascript
import { ApiKeySession, MetricsApi } from 'klaviyo-api'

const session = new ApiKeySession('your-private-api-key')
const metricsApi = new MetricsApi(session)

const response = await metricsApi.updateMappedMetric(
  'revenue',
  {
    data: {
      type: 'mapped-metric',
      id: 'revenue',
    },
  },
)
```

Install it with `npm install klaviyo-api`. [The Node.js SDK on GitHub](https://github.com/klaviyo/klaviyo-api-node)

### Ruby

```ruby
require 'klaviyo-api-sdk'

KlaviyoAPI.configure do |config|
  config.api_key['Klaviyo-API-Key'] = 'Klaviyo-API-Key your-private-api-key'
end

response = KlaviyoAPI::Metrics.update_mapped_metric(
  'revenue',
  {
    data: {
      type: 'mapped-metric',
      id: 'revenue',
    },
  },
)
```

Install it with `gem install klaviyo-api-sdk`. [The Ruby SDK on GitHub](https://github.com/klaviyo/klaviyo-api-ruby)

### PHP

```php
<?php
require_once(__DIR__ . '/vendor/autoload.php');

use KlaviyoAPI\KlaviyoAPI;

$klaviyo = new KlaviyoAPI('your-private-api-key');

$response = $klaviyo->Metrics->updateMappedMetric(
    'revenue',
    [
        'data' => [
            'type' => 'mapped-metric',
            'id' => 'revenue',
        ],
    ],
);
```

Install it with `composer require klaviyo/api`. [The PHP SDK on GitHub](https://github.com/klaviyo/klaviyo-api-php)

## Path parameters

- `id` (string, required): The type of mapping. Allowed values: `added_to_cart`, `cancelled_sales`, `ordered_product`, `refunded_sales`, `revenue`, `started_checkout`, `viewed_product` Example: `revenue`

## Query parameters

- `fields[mapped-metric]` (string[]): For more information please visit [API overview](https://developers.klaviyo.com/en/reference.md) Allowed values: `id`, `updated`

## Headers

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

## Request body

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

- `data` (object, required)
  - `type` (string, required): Allowed values: `mapped-metric`
  - `id` (string, required): The type of mapping. Allowed values: `added_to_cart`, `cancelled_sales`, `ordered_product`, `refunded_sales`, `revenue`, `started_checkout`, `viewed_product` Example: `revenue`
  - `relationships` (object)
    - `metric` (object)
      - `data` (object): Fields nested this deep are in [the endpoint's OpenAPI document](https://raw.githubusercontent.com/klaviyo/openapi/2026-10-15/openapi/stable/apis/update_mapped_metric.json).
    - `custom-metric` (object)
      - `data` (object): Fields nested this deep are in [the endpoint's OpenAPI document](https://raw.githubusercontent.com/klaviyo/openapi/2026-10-15/openapi/stable/apis/update_mapped_metric.json).

### Example request body

```json
{
  "data": {
    "type": "mapped-metric",
    "id": "revenue"
  }
}
```

## Responses

### 200: Success

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

- `data` (object, required)
  - `type` (string, required): Allowed values: `mapped-metric`
  - `id` (string, required): The type of mapping. Allowed values: `added_to_cart`, `cancelled_sales`, `ordered_product`, `refunded_sales`, `revenue`, `started_checkout`, `viewed_product` Example: `revenue`
  - `attributes` (object, required)
    - `updated` (string<date-time>, required): The datetime when this mapping was last updated. Example: `2025-04-15T00:00:00Z`
  - `relationships` (object)
    - `metric` (object)
      - `data` (object): Fields nested this deep are in [the endpoint's OpenAPI document](https://raw.githubusercontent.com/klaviyo/openapi/2026-10-15/openapi/stable/apis/update_mapped_metric.json).
      - `links` (object): Fields nested this deep are in [the endpoint's OpenAPI document](https://raw.githubusercontent.com/klaviyo/openapi/2026-10-15/openapi/stable/apis/update_mapped_metric.json).
    - `custom-metric` (object)
      - `data` (object): Fields nested this deep are in [the endpoint's OpenAPI document](https://raw.githubusercontent.com/klaviyo/openapi/2026-10-15/openapi/stable/apis/update_mapped_metric.json).
      - `links` (RelationshipLinks): Fields nested this deep are in [the endpoint's OpenAPI document](https://raw.githubusercontent.com/klaviyo/openapi/2026-10-15/openapi/stable/apis/update_mapped_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": "mapped-metric",
    "id": "revenue",
    "attributes": {
      "updated": "2025-04-15T00:00:00Z"
    },
    "relationships": {
      "metric": {
        "data": {
          "type": "metric",
          "id": "string"
        },
        "links": {
          "self": "https://www.example.com",
          "related": "https://www.example.com"
        }
      },
      "custom-metric": {
        "data": {
          "type": "custom-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"
      }
    }
  ]
}
```
