Create an incident rule

Note: This endpoint is in preview and is subject to change. If you have any feedback, contact Datadog support.

POST https://api.ap1.datadoghq.com/api/v2/incidents/config/ruleshttps://api.ap2.datadoghq.com/api/v2/incidents/config/ruleshttps://api.datadoghq.eu/api/v2/incidents/config/ruleshttps://api.ddog-gov.com/api/v2/incidents/config/ruleshttps://api.us2.ddog-gov.com/api/v2/incidents/config/ruleshttps://api.uk1.datadoghq.com/api/v2/incidents/config/ruleshttps://api.datadoghq.com/api/v2/incidents/config/ruleshttps://api.us3.datadoghq.com/api/v2/incidents/config/ruleshttps://api.us5.datadoghq.com/api/v2/incidents/config/rules

Overview

Create an incident rule. This endpoint requires any of the following permissions:

  • incident_settings_write
  • incident_notification_settings_write

  • OAuth apps require the incident_settings_write authorization scope to access this endpoint.

    Request

    Body Data (required)

    Incident rule payload.

    Expand All

    Field

    Type

    Description

    data [required]

    object

    Incident rule data in a create request.

    attributes [required]

    object

    Attributes for creating an incident rule.

    condition [required]

    object

    A query-based condition for an incident rule.

    normalized_query

    string

    The normalized query string.

    raw_query

    string

    The raw query string.

    condition_table_type [required]

    int64

    The condition table type. 1 = raw query.

    conditions

    [object]

    List of field-based conditions.

    field [required]

    string

    The field to match on.

    values [required]

    [string]

    The values to match.

    enabled [required]

    boolean

    Whether the rule is enabled.

    execution_type [required]

    enum

    The execution type of an incident rule. Allowed enum values: 1,2

    incident_type_uuid

    uuid

    The UUID of the incident type this rule applies to.

    match_any_condition

    boolean

    Whether any condition (OR logic) should match instead of all (AND logic).

    task_id [required]

    enum

    The task ID for an incident rule. Allowed enum values: jira-create-issue-job,notify-incident-handles-job,servicenow-create-incident-job,slack-create-channel-job,zoom-create-meeting-job,google-meet-create-meeting-job,workflow-automation-job,ms-teams-create-meeting-job,google-chat-create-space-job,zoom-suppress-summarization-job

    Show 2 more,ms-teams-suppress-summarization-job,google-meet-suppress-summarization-job

    task_payload [required]

    string

    The JSON-encoded payload for the task.

    trigger

    enum

    The trigger event for an incident rule. Allowed enum values: incident_saved_trigger,incident_created_trigger,incident_modified_trigger

    type [required]

    enum

    Incident rule resource type. Allowed enum values: incident_rules

    {
      "data": {
        "attributes": {
          "condition": {
            "normalized_query": "severity:SEV-1",
            "raw_query": "severity:SEV-1"
          },
          "condition_table_type": 1,
          "conditions": [
            {
              "field": "severity",
              "values": [
                "SEV-1",
                "SEV-2"
              ]
            }
          ],
          "enabled": true,
          "execution_type": 1,
          "incident_type_uuid": "00000000-0000-0000-0000-000000000000",
          "match_any_condition": false,
          "task_id": "notify-incident-handles-job",
          "task_payload": "{}",
          "trigger": "incident_created_trigger"
        },
        "type": "incident_rules"
      }
    }

    Response

    Created

    Response with a single incident rule.

    Expand All

    Field

    Type

    Description

    data [required]

    object

    Incident rule data in a response.

    attributes [required]

    object

    Attributes of an incident rule in a response.

    condition

    object

    A query-based condition for an incident rule.

    normalized_query

    string

    The normalized query string.

    raw_query

    string

    The raw query string.

    condition_table_type

    int64

    The condition table type.

    conditions

    [object]

    List of field-based conditions.

    field [required]

    string

    The field to match on.

    values [required]

    [string]

    The values to match.

    created

    date-time

    Timestamp when the rule was created.

    created_by_uuid

    uuid

    UUID of the user who created the rule.

    deleted

    date-time

    Timestamp when the rule was deleted.

    enabled

    boolean

    Whether the rule is enabled.

    execution_type

    int64

    The execution type of the rule.

    incident_settings_association_uuid

    uuid

    The incident settings association UUID.

    match_any_condition

    boolean

    Whether any condition should match.

    modified

    date-time

    Timestamp when the rule was last modified.

    modified_by_uuid

    uuid

    UUID of the user who last modified the rule.

    org_id

    int64

    The organization ID.

    task_id

    string

    The task ID.

    task_payload

    string

    The JSON-encoded task payload.

    trigger

    string

    The trigger event for the rule.

    id [required]

    uuid

    The rule identifier.

    type [required]

    enum

    Incident rule response resource type. Allowed enum values: incidents_rules

    {
      "data": {
        "attributes": {
          "condition": {
            "normalized_query": "severity:SEV-1",
            "raw_query": "severity:SEV-1"
          },
          "condition_table_type": 1,
          "conditions": [
            {
              "field": "severity",
              "values": [
                "SEV-1",
                "SEV-2"
              ]
            }
          ],
          "created": "2024-01-01T00:00:00.000Z",
          "created_by_uuid": "00000000-0000-0000-0000-000000000001",
          "deleted": null,
          "enabled": true,
          "execution_type": 1,
          "incident_settings_association_uuid": null,
          "match_any_condition": false,
          "modified": "2024-01-01T00:00:00.000Z",
          "modified_by_uuid": "00000000-0000-0000-0000-000000000001",
          "org_id": 123456,
          "task_id": "notify-incident-handles-job",
          "task_payload": "{}",
          "trigger": "incident_created_trigger"
        },
        "id": "00000000-0000-0000-0000-000000000000",
        "type": "incidents_rules"
      }
    }

    Bad Request

    API error response.

    Expand All

    Field

    Type

    Description

    errors [required]

    [string]

    A list of errors.

    {
      "errors": [
        "Bad Request"
      ]
    }

    Unauthorized

    API error response.

    Expand All

    Field

    Type

    Description

    errors [required]

    [string]

    A list of errors.

    {
      "errors": [
        "Bad Request"
      ]
    }

    Forbidden

    API error response.

    Expand All

    Field

    Type

    Description

    errors [required]

    [string]

    A list of errors.

    {
      "errors": [
        "Bad Request"
      ]
    }

    Too many requests

    API error response.

    Expand All

    Field

    Type

    Description

    errors [required]

    [string]

    A list of errors.

    {
      "errors": [
        "Bad Request"
      ]
    }

    Code Example

                      ## default
    # 
    
    # Curl command
    curl -X POST "https://api.ap1.datadoghq.com"https://api.ap2.datadoghq.com"https://api.datadoghq.eu"https://api.ddog-gov.com"https://api.us2.ddog-gov.com"https://api.uk1.datadoghq.com"https://api.datadoghq.com"https://api.us3.datadoghq.com"https://api.us5.datadoghq.com/api/v2/incidents/config/rules" \ -H "Accept: application/json" \ -H "Content-Type: application/json" \ -H "DD-API-KEY: ${DD_API_KEY}" \ -H "DD-APPLICATION-KEY: ${DD_APP_KEY}" \ -d @- << EOF { "data": { "attributes": { "condition": { "raw_query": "severity:SEV-1" }, "condition_table_type": 1, "enabled": true, "execution_type": 1, "task_id": "notify-incident-handles-job", "task_payload": "{}", "trigger": "incident_created_trigger" }, "type": "incident_rules" } } EOF