For AI agents: A markdown version of this page is available at https://dnd37xeb23o8n.cloudfront.net/stefon.simmons/docs-astro-web-10435/api/latest/monitors/validate-an-existing-monitor-user-template.md. A documentation index is available at /llms.txt.
Language
Datadog site

Validate an existing monitor user template

WARNINGNote: This endpoint is in Preview. If you have any feedback, contact Datadog support.
POSThttps://api.datadoghq.com/api/v2/monitor/template/{template_id}/validatehttps://api.us3.datadoghq.com/api/v2/monitor/template/{template_id}/validatehttps://api.us5.datadoghq.com/api/v2/monitor/template/{template_id}/validatehttps://api.datadoghq.eu/api/v2/monitor/template/{template_id}/validatehttps://api.ap1.datadoghq.com/api/v2/monitor/template/{template_id}/validatehttps://api.ap2.datadoghq.com/api/v2/monitor/template/{template_id}/validatehttps://api.uk1.datadoghq.com/api/v2/monitor/template/{template_id}/validatehttps://api.ddog-gov.com/api/v2/monitor/template/{template_id}/validatehttps://api.us2.ddog-gov.com/api/v2/monitor/template/{template_id}/validate

Overview

Validate the structure and content of an existing monitor user template being updated to a new version.

This endpoint requires the monitor_config_policy_write permission.

Arguments

Path Parameters

Name
Type
Description
template_id [required]
string

ID of the monitor user template.

Request

Body Data (required)

Field
Type
Description
data [required]
object

Monitor user template data.

Response

OK

Code Example

Validate an existing monitor user template returns "OK" response
# Path parameters
export template_id="00000000-0000-1234-0000-000000000000"

# 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 POST "https://api.${DD_SITE}/api/v2/monitor/template/${template_id}/validate" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": {
    "attributes": {
      "description": "A description.",
      "monitor_definition": {
        "message": "A msg.",
        "name": "A name example-monitor",
        "query": "avg(last_5m):sum:system.net.bytes_rcvd{host:host0} > 100",
        "type": "query alert"
      },
      "tags": [
        "integration:Azure"
      ],
      "template_variables": [
        {
          "available_values": [
            "value1",
            "value2"
          ],
          "defaults": [
            "defaultValue"
          ],
          "name": "regionName",
          "tag_key": "datacenter"
        }
      ],
      "title": "Postgres DB example-monitor"
    },
    "id": "00000000-0000-1234-0000-000000000000",
    "type": "monitor-user-template"
  }
}
EOF
# Path parameters
export template_id="00000000-0000-1234-0000-000000000000"

# 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 POST "https://api.${DD_SITE}/api/v2/monitor/template/${template_id}/validate" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": {
    "attributes": {
      "description": "A description.",
      "monitor_definition": {
        "message": "A msg.",
        "name": "A name example-monitor",
        "query": "avg(last_5m):sum:system.net.bytes_rcvd{host:host0} > 100",
        "type": "query alert"
      },
      "tags": [
        "integration:Azure"
      ],
      "template_variables": [
        {
          "available_values": [
            "value1",
            "value2"
          ],
          "defaults": [
            "defaultValue"
          ],
          "name": "regionName",
          "tag_key": "datacenter"
        }
      ],
      "title": "Postgres DB example-monitor"
    },
    "id": "00000000-0000-1234-0000-000000000000",
    "type": "monitor-user-template"
  }
}
EOF
# Path parameters
export template_id="00000000-0000-1234-0000-000000000000"

# 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 POST "https://api.${DD_SITE}/api/v2/monitor/template/${template_id}/validate" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": {
    "attributes": {
      "description": "A description.",
      "monitor_definition": {
        "message": "A msg.",
        "name": "A name example-monitor",
        "query": "avg(last_5m):sum:system.net.bytes_rcvd{host:host0} > 100",
        "type": "query alert"
      },
      "tags": [
        "integration:Azure"
      ],
      "template_variables": [
        {
          "available_values": [
            "value1",
            "value2"
          ],
          "defaults": [
            "defaultValue"
          ],
          "name": "regionName",
          "tag_key": "datacenter"
        }
      ],
      "title": "Postgres DB example-monitor"
    },
    "id": "00000000-0000-1234-0000-000000000000",
    "type": "monitor-user-template"
  }
}
EOF
# Path parameters
export template_id="00000000-0000-1234-0000-000000000000"

# 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 POST "https://api.${DD_SITE}/api/v2/monitor/template/${template_id}/validate" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": {
    "attributes": {
      "description": "A description.",
      "monitor_definition": {
        "message": "A msg.",
        "name": "A name example-monitor",
        "query": "avg(last_5m):sum:system.net.bytes_rcvd{host:host0} > 100",
        "type": "query alert"
      },
      "tags": [
        "integration:Azure"
      ],
      "template_variables": [
        {
          "available_values": [
            "value1",
            "value2"
          ],
          "defaults": [
            "defaultValue"
          ],
          "name": "regionName",
          "tag_key": "datacenter"
        }
      ],
      "title": "Postgres DB example-monitor"
    },
    "id": "00000000-0000-1234-0000-000000000000",
    "type": "monitor-user-template"
  }
}
EOF
# Path parameters
export template_id="00000000-0000-1234-0000-000000000000"

# 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 POST "https://api.${DD_SITE}/api/v2/monitor/template/${template_id}/validate" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": {
    "attributes": {
      "description": "A description.",
      "monitor_definition": {
        "message": "A msg.",
        "name": "A name example-monitor",
        "query": "avg(last_5m):sum:system.net.bytes_rcvd{host:host0} > 100",
        "type": "query alert"
      },
      "tags": [
        "integration:Azure"
      ],
      "template_variables": [
        {
          "available_values": [
            "value1",
            "value2"
          ],
          "defaults": [
            "defaultValue"
          ],
          "name": "regionName",
          "tag_key": "datacenter"
        }
      ],
      "title": "Postgres DB example-monitor"
    },
    "id": "00000000-0000-1234-0000-000000000000",
    "type": "monitor-user-template"
  }
}
EOF
# Path parameters
export template_id="00000000-0000-1234-0000-000000000000"

# 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 POST "https://api.${DD_SITE}/api/v2/monitor/template/${template_id}/validate" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": {
    "attributes": {
      "description": "A description.",
      "monitor_definition": {
        "message": "A msg.",
        "name": "A name example-monitor",
        "query": "avg(last_5m):sum:system.net.bytes_rcvd{host:host0} > 100",
        "type": "query alert"
      },
      "tags": [
        "integration:Azure"
      ],
      "template_variables": [
        {
          "available_values": [
            "value1",
            "value2"
          ],
          "defaults": [
            "defaultValue"
          ],
          "name": "regionName",
          "tag_key": "datacenter"
        }
      ],
      "title": "Postgres DB example-monitor"
    },
    "id": "00000000-0000-1234-0000-000000000000",
    "type": "monitor-user-template"
  }
}
EOF
# Path parameters
export template_id="00000000-0000-1234-0000-000000000000"

# 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 POST "https://api.${DD_SITE}/api/v2/monitor/template/${template_id}/validate" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": {
    "attributes": {
      "description": "A description.",
      "monitor_definition": {
        "message": "A msg.",
        "name": "A name example-monitor",
        "query": "avg(last_5m):sum:system.net.bytes_rcvd{host:host0} > 100",
        "type": "query alert"
      },
      "tags": [
        "integration:Azure"
      ],
      "template_variables": [
        {
          "available_values": [
            "value1",
            "value2"
          ],
          "defaults": [
            "defaultValue"
          ],
          "name": "regionName",
          "tag_key": "datacenter"
        }
      ],
      "title": "Postgres DB example-monitor"
    },
    "id": "00000000-0000-1234-0000-000000000000",
    "type": "monitor-user-template"
  }
}
EOF
# Path parameters
export template_id="00000000-0000-1234-0000-000000000000"

# 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 POST "https://api.${DD_SITE}/api/v2/monitor/template/${template_id}/validate" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": {
    "attributes": {
      "description": "A description.",
      "monitor_definition": {
        "message": "A msg.",
        "name": "A name example-monitor",
        "query": "avg(last_5m):sum:system.net.bytes_rcvd{host:host0} > 100",
        "type": "query alert"
      },
      "tags": [
        "integration:Azure"
      ],
      "template_variables": [
        {
          "available_values": [
            "value1",
            "value2"
          ],
          "defaults": [
            "defaultValue"
          ],
          "name": "regionName",
          "tag_key": "datacenter"
        }
      ],
      "title": "Postgres DB example-monitor"
    },
    "id": "00000000-0000-1234-0000-000000000000",
    "type": "monitor-user-template"
  }
}
EOF
# Path parameters
export template_id="00000000-0000-1234-0000-000000000000"

# 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 POST "https://api.${DD_SITE}/api/v2/monitor/template/${template_id}/validate" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": {
    "attributes": {
      "description": "A description.",
      "monitor_definition": {
        "message": "A msg.",
        "name": "A name example-monitor",
        "query": "avg(last_5m):sum:system.net.bytes_rcvd{host:host0} > 100",
        "type": "query alert"
      },
      "tags": [
        "integration:Azure"
      ],
      "template_variables": [
        {
          "available_values": [
            "value1",
            "value2"
          ],
          "defaults": [
            "defaultValue"
          ],
          "name": "regionName",
          "tag_key": "datacenter"
        }
      ],
      "title": "Postgres DB example-monitor"
    },
    "id": "00000000-0000-1234-0000-000000000000",
    "type": "monitor-user-template"
  }
}
EOF