{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/amazon-connect/json-schema/amazon-connect-create-rule-request-schema.json",
  "title": "CreateRuleRequest",
  "x-generated": "2026-11-11",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/amazon-connect-rules-api-openapi.yml#/components/schemas/CreateRuleRequest",
  "type": "object",
  "properties": {
    "InstanceId": {
      "type": "string",
      "description": "The identifier of the Connect Customer instance. You can find the instance ID in the Amazon Resource Name (ARN) of the instance."
    },
    "Name": {
      "type": "string",
      "description": "A unique name for the rule."
    },
    "TriggerEventSource": {
      "$ref": "#/$defs/RuleTriggerEventSource"
    },
    "Function": {
      "type": "string",
      "description": "The conditions of the rule."
    },
    "Actions": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/RuleAction"
      },
      "description": "A list of actions to be run when the rule is triggered."
    },
    "PublishStatus": {
      "type": "string",
      "enum": [
        "DRAFT",
        "PUBLISHED"
      ],
      "description": "The publish status of the rule."
    },
    "PreEvaluationFilters": {
      "$ref": "#/$defs/PreEvaluationFilters"
    },
    "ClientToken": {
      "type": "string",
      "description": "A unique, case-sensitive identifier that you provide to ensure the idempotency of the request. If not provided, the Amazon Web Services SDK populates this field. For more information about idempotency, see Making retries safe with idempotent APIs."
    },
    "Tags": {
      "type": "object",
      "additionalProperties": {
        "type": "string"
      },
      "description": "The tags used to organize, track, or control access for this resource. For example, { \"Tags\": {\"key1\":\"value1\", \"key2\":\"value2\"} }."
    }
  },
  "required": [
    "InstanceId",
    "Name",
    "TriggerEventSource",
    "Function",
    "Actions",
    "PublishStatus"
  ],
  "$defs": {
    "AssignContactCategoryActionDefinition": {
      "type": "object",
      "properties": {}
    },
    "AssignSlaActionDefinition": {
      "type": "object",
      "properties": {
        "SlaAssignmentType": {
          "type": "string",
          "enum": [
            "CASES"
          ],
          "description": "Type of SLA assignment."
        },
        "CaseSlaConfiguration": {
          "$ref": "#/$defs/CaseSlaConfiguration"
        }
      },
      "required": [
        "SlaAssignmentType"
      ]
    },
    "CaseSlaConfiguration": {
      "type": "object",
      "properties": {
        "Name": {
          "type": "string",
          "description": "Name of an SLA."
        },
        "Type": {
          "type": "string",
          "enum": [
            "CaseField"
          ],
          "description": "Type of SLA for Case SlaAssignmentType."
        },
        "FieldId": {
          "type": "string",
          "description": "Unique identifier of a Case field."
        },
        "TargetFieldValues": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/FieldValueUnion"
          },
          "description": "Represents a list of target field values for the fieldId specified in CaseSlaConfiguration. The SLA is considered met if any one of these target field values matches the actual field value."
        },
        "TargetSlaMinutes": {
          "type": "integer",
          "description": "Target duration in minutes within which an SLA should be completed."
        }
      },
      "required": [
        "Name",
        "Type",
        "TargetSlaMinutes"
      ]
    },
    "CreateCaseActionDefinition": {
      "type": "object",
      "properties": {
        "Fields": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/FieldValue"
          },
          "description": "An array of objects with Field ID and Value data."
        },
        "TemplateId": {
          "type": "string",
          "description": "A unique identifier of a template."
        }
      },
      "required": [
        "Fields",
        "TemplateId"
      ]
    },
    "EmptyFieldValue": {
      "type": "object",
      "properties": {}
    },
    "EndAssociatedEmailsActionDefinition": {
      "type": "object",
      "properties": {}
    },
    "EndAssociatedTasksActionDefinition": {
      "type": "object",
      "properties": {}
    },
    "EventBridgeActionDefinition": {
      "type": "object",
      "properties": {
        "Name": {
          "type": "string",
          "description": "The name."
        }
      },
      "required": [
        "Name"
      ]
    },
    "ExtractInformationActionDefinition": {
      "type": "object",
      "properties": {
        "RulesExtractionDefinitions": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/RulesExtractionDefinitionIdentifier"
          },
          "description": "The list of extraction definition identifiers that specify what data to extract."
        }
      },
      "required": [
        "RulesExtractionDefinitions"
      ]
    },
    "FieldValue": {
      "type": "object",
      "properties": {
        "Id": {
          "type": "string",
          "description": "Unique identifier of a field."
        },
        "Value": {
          "$ref": "#/$defs/FieldValueUnion"
        }
      },
      "required": [
        "Id",
        "Value"
      ]
    },
    "FieldValueUnion": {
      "type": "object",
      "properties": {
        "BooleanValue": {
          "type": "boolean",
          "description": "A Boolean number value type."
        },
        "DoubleValue": {
          "type": "number",
          "description": "A Double number value type."
        },
        "EmptyValue": {
          "$ref": "#/$defs/EmptyFieldValue"
        },
        "StringValue": {
          "type": "string",
          "description": "String value type."
        }
      }
    },
    "NotificationRecipientType": {
      "type": "object",
      "properties": {
        "UserTags": {
          "type": "object",
          "additionalProperties": {
            "type": "string"
          },
          "description": "The tags used to organize, track, or control access for this resource. For example, { \"Tags\": {\"key1\":\"value1\", \"key2\":\"value2\"} }. Connect Customer users with the specified tags will be notified."
        },
        "UserIds": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "A list of user IDs. Supports variable injection of $.ContactLens.ContactEvaluation.Agent.AgentId for OnContactEvaluationSubmit event source."
        }
      }
    },
    "PreEvaluationFilter": {
      "type": "object",
      "properties": {
        "ResourceType": {
          "type": "string",
          "enum": [
            "CONTACT",
            "CONTACT_EVALUATION"
          ],
          "description": "The type of resource to filter on. Valid values: CONTACT - Filter on attributes of the contact, such as tags assigned to the contact. CONTACT_EVALUATION - Filter on attributes of the contact evaluation, such as tags assigned to the contact evaluation, for rules triggered on the OnContactEvaluationSubmit event source."
        },
        "FilterType": {
          "type": "string",
          "enum": [
            "TAG"
          ],
          "description": "The type of filter to apply. Valid values: TAG."
        },
        "FilterKey": {
          "type": "string",
          "description": "The key of the attribute to filter on. For tag filters, this is the tag key."
        },
        "FilterValue": {
          "type": "string",
          "description": "The value to match against. For tag filters, this is the tag value."
        },
        "Operator": {
          "type": "string",
          "enum": [
            "EQUALS"
          ],
          "description": "The comparison operator for the filter condition. Valid values: EQUALS."
        }
      },
      "required": [
        "ResourceType",
        "FilterType",
        "FilterKey",
        "FilterValue",
        "Operator"
      ]
    },
    "PreEvaluationFilters": {
      "type": "object",
      "properties": {
        "AndConditions": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/PreEvaluationFilter"
          },
          "description": "A list of conditions that the rule evaluates together using AND logic. All conditions must be met for the event to be evaluated by the rule."
        }
      }
    },
    "Reference": {
      "type": "object",
      "properties": {
        "Value": {
          "type": "string",
          "description": "A valid value for the reference. For example, for a URL reference, a formatted URL that is displayed to an agent in the Contact Control Panel (CCP)."
        },
        "Type": {
          "type": "string",
          "enum": [
            "URL",
            "ATTACHMENT",
            "CONTACT_ANALYSIS",
            "NUMBER",
            "STRING",
            "DATE",
            "EMAIL",
            "EMAIL_MESSAGE",
            "EMAIL_MESSAGE_PLAIN_TEXT",
            "EMAIL_MESSAGE_PLAIN_TEXT_REDACTED",
            "EMAIL_MESSAGE_REDACTED"
          ],
          "description": "The type of the reference. DATE must be of type Epoch timestamp."
        },
        "Status": {
          "type": "string",
          "enum": [
            "AVAILABLE",
            "DELETED",
            "APPROVED",
            "REJECTED",
            "PROCESSING",
            "FAILED",
            "DRAFTING"
          ],
          "description": "Status of the attachment reference type."
        },
        "Arn": {
          "type": "string",
          "description": "The Amazon Resource Name (ARN) of the reference"
        },
        "StatusReason": {
          "type": "string",
          "description": "Relevant details why the reference was not successfully created."
        }
      },
      "required": [
        "Type"
      ]
    },
    "RuleAction": {
      "type": "object",
      "properties": {
        "ActionType": {
          "type": "string",
          "enum": [
            "CREATE_TASK",
            "ASSIGN_CONTACT_CATEGORY",
            "GENERATE_EVENTBRIDGE_EVENT",
            "SEND_NOTIFICATION",
            "CREATE_CASE",
            "UPDATE_CASE",
            "ASSIGN_SLA",
            "END_ASSOCIATED_TASKS",
            "END_ASSOCIATED_EMAILS",
            "SUBMIT_AUTO_EVALUATION",
            "EXTRACT_INFORMATION",
            "SEND_IN_APP_NOTIFICATION"
          ],
          "description": "The type of action that creates a rule."
        },
        "TaskAction": {
          "$ref": "#/$defs/TaskActionDefinition"
        },
        "EventBridgeAction": {
          "$ref": "#/$defs/EventBridgeActionDefinition"
        },
        "AssignContactCategoryAction": {
          "$ref": "#/$defs/AssignContactCategoryActionDefinition"
        },
        "SendNotificationAction": {
          "$ref": "#/$defs/SendNotificationActionDefinition"
        },
        "CreateCaseAction": {
          "$ref": "#/$defs/CreateCaseActionDefinition"
        },
        "UpdateCaseAction": {
          "$ref": "#/$defs/UpdateCaseActionDefinition"
        },
        "AssignSlaAction": {
          "$ref": "#/$defs/AssignSlaActionDefinition"
        },
        "EndAssociatedTasksAction": {
          "$ref": "#/$defs/EndAssociatedTasksActionDefinition"
        },
        "EndAssociatedEmailsAction": {
          "$ref": "#/$defs/EndAssociatedEmailsActionDefinition"
        },
        "SubmitAutoEvaluationAction": {
          "$ref": "#/$defs/SubmitAutoEvaluationActionDefinition"
        },
        "ExtractInformationAction": {
          "$ref": "#/$defs/ExtractInformationActionDefinition"
        },
        "SendInAppNotificationAction": {
          "$ref": "#/$defs/SendInAppNotificationActionDefinition"
        }
      },
      "required": [
        "ActionType"
      ]
    },
    "RuleTriggerEventSource": {
      "type": "object",
      "properties": {
        "EventSourceName": {
          "type": "string",
          "enum": [
            "OnPostCallAnalysisAvailable",
            "OnRealTimeCallAnalysisAvailable",
            "OnRealTimeChatAnalysisAvailable",
            "OnPostChatAnalysisAvailable",
            "OnAfterCallWorkAvailable",
            "OnAfterChatWorkAvailable",
            "OnEmailAnalysisAvailable",
            "OnZendeskTicketCreate",
            "OnZendeskTicketStatusUpdate",
            "OnSalesforceCaseCreate",
            "OnContactEvaluationSubmit",
            "OnMetricDataUpdate",
            "OnCaseCreate",
            "OnCaseUpdate",
            "OnSlaBreach",
            "OnAlertUpdate",
            "OnSchedulePublish",
            "OnScheduleUpdate",
            "OnScheduleTimeOffRequestActivity"
          ],
          "description": "The name of the event source."
        },
        "IntegrationAssociationId": {
          "type": "string",
          "description": "The identifier for the integration association."
        }
      },
      "required": [
        "EventSourceName"
      ]
    },
    "RulesExtractionDefinitionIdentifier": {
      "type": "object",
      "properties": {
        "Identifier": {
          "type": "string",
          "description": "The identifier of the extraction definition."
        }
      },
      "required": [
        "Identifier"
      ]
    },
    "SendInAppNotificationActionDefinition": {
      "type": "object",
      "properties": {
        "Content": {
          "type": "object",
          "additionalProperties": {
            "type": "string"
          },
          "description": "Notification content. Supports variable injection. For more information, see JSONPath reference in the Connect Customer Administrators Guide."
        },
        "Recipient": {
          "$ref": "#/$defs/NotificationRecipientType"
        },
        "Exclusion": {
          "$ref": "#/$defs/NotificationRecipientType"
        },
        "Priority": {
          "type": "string",
          "enum": [
            "HIGH",
            "LOW"
          ],
          "description": "Notification priority."
        }
      },
      "required": [
        "Content",
        "Recipient"
      ]
    },
    "SendNotificationActionDefinition": {
      "type": "object",
      "properties": {
        "DeliveryMethod": {
          "type": "string",
          "enum": [
            "EMAIL"
          ],
          "description": "Notification delivery method."
        },
        "Subject": {
          "type": "string",
          "description": "The subject of the email if the delivery method is EMAIL. Supports variable injection. For more information, see JSONPath reference in the Connect Customer Administrators Guide."
        },
        "Content": {
          "type": "string",
          "description": "Notification content. Supports variable injection. For more information, see JSONPath reference in the Connect Customer Administrators Guide."
        },
        "ContentType": {
          "type": "string",
          "enum": [
            "PLAIN_TEXT"
          ],
          "description": "Content type format."
        },
        "Recipient": {
          "$ref": "#/$defs/NotificationRecipientType"
        },
        "Exclusion": {
          "$ref": "#/$defs/NotificationRecipientType"
        }
      },
      "required": [
        "DeliveryMethod",
        "Content",
        "ContentType",
        "Recipient"
      ]
    },
    "SubmitAutoEvaluationActionDefinition": {
      "type": "object",
      "properties": {
        "EvaluationFormId": {
          "type": "string",
          "description": "The identifier of the auto-evaluation enabled form."
        }
      },
      "required": [
        "EvaluationFormId"
      ]
    },
    "TaskActionDefinition": {
      "type": "object",
      "properties": {
        "Name": {
          "type": "string",
          "description": "The name. Supports variable injection. For more information, see JSONPath reference in the Connect Customer Administrators Guide."
        },
        "Description": {
          "type": "string",
          "description": "The description. Supports variable injection. For more information, see JSONPath reference in the Connect Customer Administrators Guide."
        },
        "ContactFlowId": {
          "type": "string",
          "description": "The identifier of the flow."
        },
        "References": {
          "type": "object",
          "additionalProperties": {
            "$ref": "#/$defs/Reference"
          },
          "description": "Information about the reference when the referenceType is URL. Otherwise, null. (Supports variable injection in the Value field.)"
        }
      },
      "required": [
        "Name",
        "ContactFlowId"
      ]
    },
    "UpdateCaseActionDefinition": {
      "type": "object",
      "properties": {
        "Fields": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/FieldValue"
          },
          "description": "An array of objects with Field ID and Value data."
        }
      },
      "required": [
        "Fields"
      ]
    }
  }
}