For AI agents: A markdown version of this page is available at https://dnd37xeb23o8n.cloudfront.net/stefon.simmons/docs-astro-web-10435/api/latest/tag-rules/update-a-tag-rule.md. A documentation index is available at /llms.txt.
Language
Datadog site

Update a tag rule

WARNINGNote: This endpoint is in preview and is subject to change. If you have any feedback, contact Datadog support.
PATCHhttps://api.datadoghq.com/api/v2/governance/tag_rules/{rule_id}https://api.us3.datadoghq.com/api/v2/governance/tag_rules/{rule_id}https://api.us5.datadoghq.com/api/v2/governance/tag_rules/{rule_id}https://api.datadoghq.eu/api/v2/governance/tag_rules/{rule_id}https://api.ap1.datadoghq.com/api/v2/governance/tag_rules/{rule_id}https://api.ap2.datadoghq.com/api/v2/governance/tag_rules/{rule_id}https://api.uk1.datadoghq.com/api/v2/governance/tag_rules/{rule_id}https://api.ddog-gov.com/api/v2/governance/tag_rules/{rule_id}https://api.us2.ddog-gov.com/api/v2/governance/tag_rules/{rule_id}

Overview

Update one or more attributes of an existing tag rule. Only the fields supplied in the request body are modified; omitted fields retain their current values. The rule's source cannot be changed after creation.

This endpoint requires the telemetry_rules_create permission.

Arguments

Path Parameters

Name
Type
Description
rule_id [required]
string

The unique identifier of the tag rule to update.

Request

Body Data (required)

Field
Type
Description
data [required]
object

Data object for updating a tag rule.

Response

OK

A single tag rule.

Field
Type
Description
data [required]
object

A tag rule resource.

included
[object]

Related resources fetched alongside the primary tag rules. Populated when an include query parameter is supplied.

Code Example

Update a tag rule
# Path parameters
export rule_id="123"

# 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/governance/tag_rules/${rule_id}" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": {
    "attributes": {
      "enabled": true,
      "name": "Service tag must be one of api, web, or worker"
    },
    "id": "123",
    "type": "tag_rule"
  }
}
EOF
# Path parameters
export rule_id="123"

# 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/governance/tag_rules/${rule_id}" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": {
    "attributes": {
      "enabled": true,
      "name": "Service tag must be one of api, web, or worker"
    },
    "id": "123",
    "type": "tag_rule"
  }
}
EOF
# Path parameters
export rule_id="123"

# 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/governance/tag_rules/${rule_id}" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": {
    "attributes": {
      "enabled": true,
      "name": "Service tag must be one of api, web, or worker"
    },
    "id": "123",
    "type": "tag_rule"
  }
}
EOF
# Path parameters
export rule_id="123"

# 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/governance/tag_rules/${rule_id}" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": {
    "attributes": {
      "enabled": true,
      "name": "Service tag must be one of api, web, or worker"
    },
    "id": "123",
    "type": "tag_rule"
  }
}
EOF
# Path parameters
export rule_id="123"

# 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/governance/tag_rules/${rule_id}" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": {
    "attributes": {
      "enabled": true,
      "name": "Service tag must be one of api, web, or worker"
    },
    "id": "123",
    "type": "tag_rule"
  }
}
EOF
# Path parameters
export rule_id="123"

# 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/governance/tag_rules/${rule_id}" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": {
    "attributes": {
      "enabled": true,
      "name": "Service tag must be one of api, web, or worker"
    },
    "id": "123",
    "type": "tag_rule"
  }
}
EOF
# Path parameters
export rule_id="123"

# 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/governance/tag_rules/${rule_id}" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": {
    "attributes": {
      "enabled": true,
      "name": "Service tag must be one of api, web, or worker"
    },
    "id": "123",
    "type": "tag_rule"
  }
}
EOF
# Path parameters
export rule_id="123"

# 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/governance/tag_rules/${rule_id}" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": {
    "attributes": {
      "enabled": true,
      "name": "Service tag must be one of api, web, or worker"
    },
    "id": "123",
    "type": "tag_rule"
  }
}
EOF
# Path parameters
export rule_id="123"

# 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/governance/tag_rules/${rule_id}" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": {
    "attributes": {
      "enabled": true,
      "name": "Service tag must be one of api, web, or worker"
    },
    "id": "123",
    "type": "tag_rule"
  }
}
EOF