Update an automation rule

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

PUT https://api.ap1.datadoghq.com/api/v2/cases/projects/{project_id}/rules/{rule_id}https://api.ap2.datadoghq.com/api/v2/cases/projects/{project_id}/rules/{rule_id}https://api.datadoghq.eu/api/v2/cases/projects/{project_id}/rules/{rule_id}https://api.ddog-gov.com/api/v2/cases/projects/{project_id}/rules/{rule_id}https://api.us2.ddog-gov.com/api/v2/cases/projects/{project_id}/rules/{rule_id}https://api.datadoghq.com/api/v2/cases/projects/{project_id}/rules/{rule_id}https://api.us3.datadoghq.com/api/v2/cases/projects/{project_id}/rules/{rule_id}https://api.us5.datadoghq.com/api/v2/cases/projects/{project_id}/rules/{rule_id}

Overview

Updates the trigger, action, name, or state of an existing automation rule.

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

Arguments

Path Parameters

Name

Type

Description

project_id [required]

string

The UUID of the project that owns the automation rules.

rule_id [required]

string

The UUID of the automation rule.

Request

Body Data (required)

Automation rule payload.

Expand All

Field

Type

Description

data [required]

object

Data object for updating an automation rule.

attributes

object

Attributes required to create an automation rule.

action [required]

object

Defines what happens when the rule triggers. Combines an action type with action-specific configuration data.

data [required]

object

Configuration for the action to execute, dependent on the action type.

agent_type

string

The type of AI agent to assign. Required when the action type is assign_agent.

assigned_agent_id

string

The identifier of the AI agent to assign to the case. Required when the action type is assign_agent.

handle

string

The handle of the Datadog workflow to execute. Required when the action type is execute_workflow.

type [required]

enum

The type of automated action to perform when the rule triggers. execute_workflow runs a Datadog workflow; assign_agent assigns an AI agent to the case. Allowed enum values: execute_workflow,assign_agent

name [required]

string

Name of the automation rule.

state

enum

Whether the automation rule is active. Enabled rules trigger on matching case events; disabled rules are inactive but preserve their configuration. Allowed enum values: ENABLED,DISABLED

trigger [required]

object

Defines when the rule activates. Combines a trigger type (the case event to listen for) with optional trigger data (conditions that narrow when the trigger fires).

data

object

Additional configuration for the trigger, dependent on the trigger type. For status_transitioned triggers, specify from_status_name and to_status_name. For attribute_value_changed triggers, specify field and change_type.

approval_type

string

The approval outcome to match. Used with case_review_approved triggers.

change_type

string

The kind of attribute change to match. Allowed values: VALUE_ADDED, VALUE_DELETED, ANY_CHANGES. Used with attribute_value_changed triggers.

field

string

The case attribute field name to monitor for changes. Used with attribute_value_changed triggers.

from_status_name

string

The originating status name. Used with status_transitioned triggers to match transitions from this status.

to_status_name

string

The destination status name. Used with status_transitioned triggers to match transitions to this status.

type [required]

enum

The case event that activates the automation rule. Allowed enum values: case_created,status_transitioned,attribute_value_changed,event_correlation_signal_correlated,case_review_approved,comment_added

type [required]

enum

JSON:API resource type for case automation rules. Allowed enum values: rule

default: rule

{
  "data": {
    "attributes": {
      "action": {
        "data": {
          "agent_type": "string",
          "assigned_agent_id": "string",
          "handle": "workflow-handle-123"
        },
        "type": "execute_workflow"
      },
      "name": "Auto-assign workflow",
      "state": "ENABLED",
      "trigger": {
        "data": {
          "approval_type": "string",
          "change_type": "string",
          "field": "string",
          "from_status_name": "string",
          "to_status_name": "string"
        },
        "type": "case_created"
      }
    },
    "type": "rule"
  }
}

Response

OK

Response containing a single automation rule.

Expand All

Field

Type

Description

data [required]

object

An automation rule that executes an action (such as running a Datadog workflow or assigning an AI agent) when a specified case event occurs within a project.

attributes [required]

object

Core attributes of an automation rule, including its name, trigger condition, action to execute, and current state.

action [required]

object

Defines what happens when the rule triggers. Combines an action type with action-specific configuration data.

data [required]

object

Configuration for the action to execute, dependent on the action type.

agent_type

string

The type of AI agent to assign. Required when the action type is assign_agent.

assigned_agent_id

string

The identifier of the AI agent to assign to the case. Required when the action type is assign_agent.

handle

string

The handle of the Datadog workflow to execute. Required when the action type is execute_workflow.

type [required]

enum

The type of automated action to perform when the rule triggers. execute_workflow runs a Datadog workflow; assign_agent assigns an AI agent to the case. Allowed enum values: execute_workflow,assign_agent

created_at [required]

date-time

Timestamp when the automation rule was created.

modified_at

date-time

Timestamp when the automation rule was last modified.

name [required]

string

A human-readable name for the automation rule, used to identify the rule in the UI and API responses.

state [required]

enum

Whether the automation rule is active. Enabled rules trigger on matching case events; disabled rules are inactive but preserve their configuration. Allowed enum values: ENABLED,DISABLED

trigger [required]

object

Defines when the rule activates. Combines a trigger type (the case event to listen for) with optional trigger data (conditions that narrow when the trigger fires).

data

object

Additional configuration for the trigger, dependent on the trigger type. For status_transitioned triggers, specify from_status_name and to_status_name. For attribute_value_changed triggers, specify field and change_type.

approval_type

string

The approval outcome to match. Used with case_review_approved triggers.

change_type

string

The kind of attribute change to match. Allowed values: VALUE_ADDED, VALUE_DELETED, ANY_CHANGES. Used with attribute_value_changed triggers.

field

string

The case attribute field name to monitor for changes. Used with attribute_value_changed triggers.

from_status_name

string

The originating status name. Used with status_transitioned triggers to match transitions from this status.

to_status_name

string

The destination status name. Used with status_transitioned triggers to match transitions to this status.

type [required]

enum

The case event that activates the automation rule. Allowed enum values: case_created,status_transitioned,attribute_value_changed,event_correlation_signal_correlated,case_review_approved,comment_added

id [required]

string

Automation rule identifier.

relationships

object

Related resources for the automation rule, including the users who created and last modified it.

created_by

object

Relationship to user.

data [required]

object

Relationship to user object.

id [required]

string

A unique identifier that represents the user.

type [required]

enum

User resource type. Allowed enum values: user

default: user

modified_by

object

Relationship to user.

data [required]

object

Relationship to user object.

id [required]

string

A unique identifier that represents the user.

type [required]

enum

User resource type. Allowed enum values: user

default: user

type [required]

enum

JSON:API resource type for case automation rules. Allowed enum values: rule

default: rule

{
  "data": {
    "attributes": {
      "action": {
        "data": {
          "agent_type": "string",
          "assigned_agent_id": "string",
          "handle": "workflow-handle-123"
        },
        "type": "execute_workflow"
      },
      "created_at": "2024-01-01T00:00:00.000Z",
      "modified_at": "2019-09-19T10:00:00.000Z",
      "name": "Auto-assign workflow",
      "state": "ENABLED",
      "trigger": {
        "data": {
          "approval_type": "string",
          "change_type": "string",
          "field": "string",
          "from_status_name": "string",
          "to_status_name": "string"
        },
        "type": "case_created"
      }
    },
    "id": "e6773723-fe58-49ff-9975-dff00f14e28d",
    "relationships": {
      "created_by": {
        "data": {
          "id": "00000000-0000-0000-0000-000000000000",
          "type": "user"
        }
      },
      "modified_by": {
        "data": {
          "id": "00000000-0000-0000-0000-000000000000",
          "type": "user"
        }
      }
    },
    "type": "rule"
  }
}

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"
  ]
}

Not Found

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
# 

# Path parameters
export project_id="e555e290-ed65-49bd-ae18-8acbfcf18db7"
export rule_id="e6773723-fe58-49ff-9975-dff00f14e28d"
# Curl command
curl -X PUT "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.datadoghq.com"https://api.us3.datadoghq.com"https://api.us5.datadoghq.com/api/v2/cases/projects/${project_id}/rules/${rule_id}" \ -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": { "action": { "data": { "handle": "workflow-handle-123" }, "type": "execute_workflow" }, "name": "Auto-assign workflow", "state": "ENABLED", "trigger": { "type": "case_created" } }, "type": "rule" } } EOF