For AI agents: A markdown version of this page is available at https://dnd37xeb23o8n.cloudfront.net/jen.gilbert/astro-base/api/latest/deployment-gates/create-deployment-rule.md. A documentation index is available at /llms.txt.
Language
Datadog site

Create deployment rule

WARNINGNote: This endpoint is in preview and may be subject to change. If you have any feedback, contact Datadog support.
POSThttps://api.datadoghq.com/api/v2/deployment_gates/{gate_id}/ruleshttps://api.us3.datadoghq.com/api/v2/deployment_gates/{gate_id}/ruleshttps://api.us5.datadoghq.com/api/v2/deployment_gates/{gate_id}/ruleshttps://api.datadoghq.eu/api/v2/deployment_gates/{gate_id}/ruleshttps://api.ap1.datadoghq.com/api/v2/deployment_gates/{gate_id}/ruleshttps://api.ap2.datadoghq.com/api/v2/deployment_gates/{gate_id}/ruleshttps://api.uk1.datadoghq.com/api/v2/deployment_gates/{gate_id}/ruleshttps://api.ddog-gov.com/api/v2/deployment_gates/{gate_id}/ruleshttps://api.us2.ddog-gov.com/api/v2/deployment_gates/{gate_id}/rules

Overview

Endpoint to create a deployment rule. A gate for the rule must already exist.

This endpoint requires the deployment_gates_write permission.

Arguments

Path Parameters

Name
Type
Description
gate_id [required]
string

The ID of the deployment gate.

Request

Body Data (required)

Field
Type
Description
data
object

Parameters for creating a deployment rule.

Response

OK

Response for a deployment rule.

Field
Type
Description
data
object

Data for a deployment rule.

Code Example

# Path parameters
export gate_id="CHANGE_ME"

# 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/deployment_gates/${gate_id}/rules" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": {
    "attributes": {
      "dry_run": false,
      "name": "My deployment rule",
      "options": [
        "resource1",
        "resource2"
      ],
      "type": "faulty_deployment_detection"
    },
    "type": "deployment_rule"
  }
}
EOF
# Path parameters
export gate_id="CHANGE_ME"

# 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/deployment_gates/${gate_id}/rules" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": {
    "attributes": {
      "dry_run": false,
      "name": "My deployment rule",
      "options": [
        "resource1",
        "resource2"
      ],
      "type": "faulty_deployment_detection"
    },
    "type": "deployment_rule"
  }
}
EOF
# Path parameters
export gate_id="CHANGE_ME"

# 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/deployment_gates/${gate_id}/rules" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": {
    "attributes": {
      "dry_run": false,
      "name": "My deployment rule",
      "options": [
        "resource1",
        "resource2"
      ],
      "type": "faulty_deployment_detection"
    },
    "type": "deployment_rule"
  }
}
EOF
# Path parameters
export gate_id="CHANGE_ME"

# 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/deployment_gates/${gate_id}/rules" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": {
    "attributes": {
      "dry_run": false,
      "name": "My deployment rule",
      "options": [
        "resource1",
        "resource2"
      ],
      "type": "faulty_deployment_detection"
    },
    "type": "deployment_rule"
  }
}
EOF
# Path parameters
export gate_id="CHANGE_ME"

# 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/deployment_gates/${gate_id}/rules" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": {
    "attributes": {
      "dry_run": false,
      "name": "My deployment rule",
      "options": [
        "resource1",
        "resource2"
      ],
      "type": "faulty_deployment_detection"
    },
    "type": "deployment_rule"
  }
}
EOF
# Path parameters
export gate_id="CHANGE_ME"

# 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/deployment_gates/${gate_id}/rules" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": {
    "attributes": {
      "dry_run": false,
      "name": "My deployment rule",
      "options": [
        "resource1",
        "resource2"
      ],
      "type": "faulty_deployment_detection"
    },
    "type": "deployment_rule"
  }
}
EOF
# Path parameters
export gate_id="CHANGE_ME"

# 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/deployment_gates/${gate_id}/rules" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": {
    "attributes": {
      "dry_run": false,
      "name": "My deployment rule",
      "options": [
        "resource1",
        "resource2"
      ],
      "type": "faulty_deployment_detection"
    },
    "type": "deployment_rule"
  }
}
EOF
# Path parameters
export gate_id="CHANGE_ME"

# 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/deployment_gates/${gate_id}/rules" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": {
    "attributes": {
      "dry_run": false,
      "name": "My deployment rule",
      "options": [
        "resource1",
        "resource2"
      ],
      "type": "faulty_deployment_detection"
    },
    "type": "deployment_rule"
  }
}
EOF
# Path parameters
export gate_id="CHANGE_ME"

# 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/deployment_gates/${gate_id}/rules" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": {
    "attributes": {
      "dry_run": false,
      "name": "My deployment rule",
      "options": [
        "resource1",
        "resource2"
      ],
      "type": "faulty_deployment_detection"
    },
    "type": "deployment_rule"
  }
}
EOF