For AI agents: A markdown version of this page is available at https://dnd37xeb23o8n.cloudfront.net/stefon.simmons/docs-astro-web-10435/api/latest/experiments/update-metric.md. A documentation index is available at /llms.txt.
Language
Datadog site
CAUTIONThis product is not supported for your selected Datadog site. (US1-FED).
CAUTIONThis product is not supported for your selected Datadog site. (US2-FED).

Update metric

PATCHhttps://api.datadoghq.com/api/v2/experiments/metrics/{metric_id}https://api.us3.datadoghq.com/api/v2/experiments/metrics/{metric_id}https://api.us5.datadoghq.com/api/v2/experiments/metrics/{metric_id}https://api.datadoghq.eu/api/v2/experiments/metrics/{metric_id}https://api.ap1.datadoghq.com/api/v2/experiments/metrics/{metric_id}https://api.ap2.datadoghq.com/api/v2/experiments/metrics/{metric_id}https://api.uk1.datadoghq.com/api/v2/experiments/metrics/{metric_id}https://api.ddog-gov.com/api/v2/experiments/metrics/{metric_id}https://api.us2.ddog-gov.com/api/v2/experiments/metrics/{metric_id}

Overview

Update a metric. Certified metrics are read-only through this endpoint. This is a partial update: every attribute is optional and an omitted attribute keeps its stored value, so a body carrying only the fields being changed is enough. guardrail_cutoff_threshold is nullable -- send null to clear it, omit it to leave it alone. Omitting the aggregation leaves the metric's definition untouched; supplying one replaces it wholesale, and the metric's type is re-derived from the shape supplied. Property filters use property_id or measure_id UUIDs from the aggregation's data source. Attributes that are computed rather than stored (short_id, metric_type, certified_at, experiment_count, created_at, updated_at) are rejected rather than ignored, so a body copied from GET must have them removed. The is_certified attribute is rejected. Certification cannot be changed through this endpoint.

This endpoint requires the product_analytics_metrics_write permission.

OAuth apps require the product_analytics_metrics_write authorization scope to access this endpoint.

Arguments

Path Parameters

Name
Type
Description
metric_id [required]
string

The UUID of the metric.

Request

Body Data (required)

Field
Type
Description
data [required]
object

JSON:API resource containing the metric identity and fields.

Response

OK

Response containing the metric.

Field
Type
Description
data [required]
object

JSON:API resource containing the metric identity and fields.

Code Example

Update metric returns "OK" response
# Path parameters
export metric_id="550e8400-e29b-41d4-a716-446655440000"

# Set your Datadog site and credentials
export DD_SITE="datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X PATCH "https://api.${DD_SITE}/api/v2/experiments/metrics/${metric_id}" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": {
    "type": "metrics",
    "id": "550e8400-e29b-41d4-a716-446655440002",
    "attributes": {
      "name": "ex-14bb9543f523edde updated"
    }
  }
}
EOF
# Path parameters
export metric_id="550e8400-e29b-41d4-a716-446655440000"

# Set your Datadog site and credentials
export DD_SITE="us3.datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X PATCH "https://api.${DD_SITE}/api/v2/experiments/metrics/${metric_id}" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": {
    "type": "metrics",
    "id": "550e8400-e29b-41d4-a716-446655440002",
    "attributes": {
      "name": "ex-14bb9543f523edde updated"
    }
  }
}
EOF
# Path parameters
export metric_id="550e8400-e29b-41d4-a716-446655440000"

# Set your Datadog site and credentials
export DD_SITE="us5.datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X PATCH "https://api.${DD_SITE}/api/v2/experiments/metrics/${metric_id}" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": {
    "type": "metrics",
    "id": "550e8400-e29b-41d4-a716-446655440002",
    "attributes": {
      "name": "ex-14bb9543f523edde updated"
    }
  }
}
EOF
# Path parameters
export metric_id="550e8400-e29b-41d4-a716-446655440000"

# Set your Datadog site and credentials
export DD_SITE="datadoghq.eu"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X PATCH "https://api.${DD_SITE}/api/v2/experiments/metrics/${metric_id}" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": {
    "type": "metrics",
    "id": "550e8400-e29b-41d4-a716-446655440002",
    "attributes": {
      "name": "ex-14bb9543f523edde updated"
    }
  }
}
EOF
# Path parameters
export metric_id="550e8400-e29b-41d4-a716-446655440000"

# Set your Datadog site and credentials
export DD_SITE="ap1.datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X PATCH "https://api.${DD_SITE}/api/v2/experiments/metrics/${metric_id}" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": {
    "type": "metrics",
    "id": "550e8400-e29b-41d4-a716-446655440002",
    "attributes": {
      "name": "ex-14bb9543f523edde updated"
    }
  }
}
EOF
# Path parameters
export metric_id="550e8400-e29b-41d4-a716-446655440000"

# Set your Datadog site and credentials
export DD_SITE="ap2.datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X PATCH "https://api.${DD_SITE}/api/v2/experiments/metrics/${metric_id}" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": {
    "type": "metrics",
    "id": "550e8400-e29b-41d4-a716-446655440002",
    "attributes": {
      "name": "ex-14bb9543f523edde updated"
    }
  }
}
EOF
# Path parameters
export metric_id="550e8400-e29b-41d4-a716-446655440000"

# Set your Datadog site and credentials
export DD_SITE="uk1.datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X PATCH "https://api.${DD_SITE}/api/v2/experiments/metrics/${metric_id}" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": {
    "type": "metrics",
    "id": "550e8400-e29b-41d4-a716-446655440002",
    "attributes": {
      "name": "ex-14bb9543f523edde updated"
    }
  }
}
EOF
# Path parameters
export metric_id="550e8400-e29b-41d4-a716-446655440000"

# Set your Datadog site and credentials
export DD_SITE="ddog-gov.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X PATCH "https://api.${DD_SITE}/api/v2/experiments/metrics/${metric_id}" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": {
    "type": "metrics",
    "id": "550e8400-e29b-41d4-a716-446655440002",
    "attributes": {
      "name": "ex-14bb9543f523edde updated"
    }
  }
}
EOF
# Path parameters
export metric_id="550e8400-e29b-41d4-a716-446655440000"

# Set your Datadog site and credentials
export DD_SITE="us2.ddog-gov.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X PATCH "https://api.${DD_SITE}/api/v2/experiments/metrics/${metric_id}" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": {
    "type": "metrics",
    "id": "550e8400-e29b-41d4-a716-446655440002",
    "attributes": {
      "name": "ex-14bb9543f523edde updated"
    }
  }
}
EOF