---
title: "Create an automation rule"
method: POST
path: "/api/v2/cases/projects/{project_id}/rules"
tags: ["Case Management"]
---

# Create an automation rule

`POST /api/v2/cases/projects/{project_id}/rules`

Creates an automation rule for a project. The rule defines a trigger event (for example, case created, status transitioned) and an action to execute.

## Path parameters

- `project_id` string, required

## Request body

- AutomationRuleCreateRequest — Request payload for creating an automation rule.
  - `data` AutomationRuleCreate, required — Data object for creating an automation rule.
    - `attributes` AutomationRuleCreateAttributes, required — Attributes required to create an automation rule.
      - `action` AutomationRuleAction, required — Defines what happens when the rule triggers. Combines an action type with action-specific configuration data.
        - `data` AutomationRuleActionData, required — 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` 'execute_workflow' | 'assign_agent', required — 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.
      - `name` string, required — Name of the automation rule.
      - `state` 'ENABLED' | 'DISABLED' — Whether the automation rule is active. Enabled rules trigger on matching case events; disabled rules are inactive but preserve their configuration.
      - `trigger` AutomationRuleTrigger, required — 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` AutomationRuleTriggerData — 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` 'case_created' | 'status_transitioned' | 'attribute_value_changed' | 'event_correlation_signal_correlated' | 'case_review_approved' | 'comment_added', required — The case event that activates the automation rule.
    - `type` 'rule', required — JSON:API resource type for case automation rules.

## Response `201`

Created

- AutomationRuleResponse — Response containing a single automation rule.
  - `data` AutomationRule, required — 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` AutomationRuleAttributes, required — Core attributes of an automation rule, including its name, trigger condition, action to execute, and current state.
      - `action` AutomationRuleAction, required — Defines what happens when the rule triggers. Combines an action type with action-specific configuration data.
        - `data` AutomationRuleActionData, required — 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` 'execute_workflow' | 'assign_agent', required — 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.
      - `created_at` string, date-time, required — Timestamp when the automation rule was created.
      - `modified_at` string, date-time — Timestamp when the automation rule was last modified.
      - `name` string, required — A human-readable name for the automation rule, used to identify the rule in the UI and API responses.
      - `state` 'ENABLED' | 'DISABLED', required — Whether the automation rule is active. Enabled rules trigger on matching case events; disabled rules are inactive but preserve their configuration.
      - `trigger` AutomationRuleTrigger, required — 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` AutomationRuleTriggerData — 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` 'case_created' | 'status_transitioned' | 'attribute_value_changed' | 'event_correlation_signal_correlated' | 'case_review_approved' | 'comment_added', required — The case event that activates the automation rule.
    - `id` string, required — Automation rule identifier.
    - `relationships` AutomationRuleRelationships — Related resources for the automation rule, including the users who created and last modified it.
      - `created_by` NullableUserRelationship, nullable — Relationship to user.
        - `data` NullableUserRelationshipData, nullable, required — Relationship to user object.
          - `id` string, required — A unique identifier that represents the user.
          - `type` 'user', required — User resource type.
      - `modified_by` NullableUserRelationship, nullable — Relationship to user.
        - `data` NullableUserRelationshipData, nullable, required — Relationship to user object.
          - `id` string, required — A unique identifier that represents the user.
          - `type` 'user', required — User resource type.
    - `type` 'rule', required — JSON:API resource type for case automation rules.

## Other responses

- `400` — Bad Request
- `401` — Unauthorized
- `403` — Forbidden
- `404` — Not Found
- `429` — Too many requests

---

[API](https://skmtc.net/datadog/apis/api-v2.md) · [All operations](https://skmtc.net/datadog/apis/api-v2/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/datadog/api-v2/versions/da68bf029e4c/schema)
