{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/microsoft-365/json-schema/microsoft-365-microsoft-graph-message-rule-schema.json",
  "title": "microsoft.graph.messageRule",
  "x-generated": "2026-11-04",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/microsoft-365-mail-api-openapi.yml#/components/schemas/microsoft.graph.messageRule",
  "allOf": [
    {
      "$ref": "#/$defs/microsoft.graph.entity"
    },
    {
      "title": "messageRule",
      "type": "object",
      "properties": {
        "actions": {
          "$ref": "#/$defs/microsoft.graph.messageRuleActions"
        },
        "conditions": {
          "$ref": "#/$defs/microsoft.graph.messageRulePredicates"
        },
        "displayName": {
          "type": [
            "string",
            "null"
          ],
          "description": "The display name of the rule."
        },
        "exceptions": {
          "$ref": "#/$defs/microsoft.graph.messageRulePredicates"
        },
        "hasError": {
          "type": [
            "boolean",
            "null"
          ],
          "description": "Indicates whether the rule is in an error condition. Read-only."
        },
        "isEnabled": {
          "type": [
            "boolean",
            "null"
          ],
          "description": "Indicates whether the rule is enabled to be applied to messages."
        },
        "isReadOnly": {
          "type": [
            "boolean",
            "null"
          ],
          "description": "Indicates if the rule is read-only and cannot be modified or deleted by the rules REST API."
        },
        "sequence": {
          "maximum": 2147483647,
          "minimum": -2147483648,
          "type": [
            "number",
            "null"
          ],
          "description": "Indicates the order in which the rule is executed, among other rules.",
          "format": "int32"
        }
      },
      "additionalProperties": {
        "type": "object"
      }
    }
  ],
  "$defs": {
    "microsoft.graph.emailAddress": {
      "title": "emailAddress",
      "type": "object",
      "properties": {
        "address": {
          "type": [
            "string",
            "null"
          ],
          "description": "The email address of the person or entity."
        },
        "name": {
          "type": [
            "string",
            "null"
          ],
          "description": "The display name of the person or entity."
        }
      },
      "additionalProperties": {
        "type": "object"
      }
    },
    "microsoft.graph.entity": {
      "title": "entity",
      "type": "object",
      "properties": {
        "id": {
          "type": "string",
          "description": "The unique identifier for an entity. Read-only."
        }
      },
      "additionalProperties": {
        "type": "object"
      }
    },
    "microsoft.graph.importance": {
      "title": "importance",
      "enum": [
        "low",
        "normal",
        "high"
      ],
      "type": "string"
    },
    "microsoft.graph.messageActionFlag": {
      "title": "messageActionFlag",
      "enum": [
        "any",
        "call",
        "doNotForward",
        "followUp",
        "fyi",
        "forward",
        "noResponseNecessary",
        "read",
        "reply",
        "replyToAll",
        "review"
      ],
      "type": "string"
    },
    "microsoft.graph.messageRuleActions": {
      "title": "messageRuleActions",
      "type": "object",
      "properties": {
        "assignCategories": {
          "type": "array",
          "items": {
            "type": [
              "string",
              "null"
            ]
          },
          "description": "A list of categories to be assigned to a message."
        },
        "copyToFolder": {
          "type": [
            "string",
            "null"
          ],
          "description": "The ID of a folder that a message is to be copied to."
        },
        "delete": {
          "type": [
            "boolean",
            "null"
          ],
          "description": "Indicates whether a message should be moved to the Deleted Items folder."
        },
        "forwardAsAttachmentTo": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/microsoft.graph.recipient"
          },
          "description": "The email addresses of the recipients to which a message should be forwarded as an attachment."
        },
        "forwardTo": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/microsoft.graph.recipient"
          },
          "description": "The email addresses of the recipients to which a message should be forwarded."
        },
        "markAsRead": {
          "type": [
            "boolean",
            "null"
          ],
          "description": "Indicates whether a message should be marked as read."
        },
        "markImportance": {
          "$ref": "#/$defs/microsoft.graph.importance"
        },
        "moveToFolder": {
          "type": [
            "string",
            "null"
          ],
          "description": "The ID of the folder that a message will be moved to."
        },
        "permanentDelete": {
          "type": [
            "boolean",
            "null"
          ],
          "description": "Indicates whether a message should be permanently deleted and not saved to the Deleted Items folder."
        },
        "redirectTo": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/microsoft.graph.recipient"
          },
          "description": "The email addresses to which a message should be redirected."
        },
        "stopProcessingRules": {
          "type": [
            "boolean",
            "null"
          ],
          "description": "Indicates whether subsequent rules should be evaluated."
        }
      },
      "additionalProperties": {
        "type": "object"
      }
    },
    "microsoft.graph.messageRulePredicates": {
      "title": "messageRulePredicates",
      "type": "object",
      "properties": {
        "bodyContains": {
          "type": "array",
          "items": {
            "type": [
              "string",
              "null"
            ]
          },
          "description": "Represents the strings that should appear in the body of an incoming message in order for the condition or exception to apply."
        },
        "bodyOrSubjectContains": {
          "type": "array",
          "items": {
            "type": [
              "string",
              "null"
            ]
          },
          "description": "Represents the strings that should appear in the body or subject of an incoming message in order for the condition or exception to apply."
        },
        "categories": {
          "type": "array",
          "items": {
            "type": [
              "string",
              "null"
            ]
          },
          "description": "Represents the categories that an incoming message should be labeled with in order for the condition or exception to apply."
        },
        "fromAddresses": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/microsoft.graph.recipient"
          },
          "description": "Represents the specific sender email addresses of an incoming message in order for the condition or exception to apply."
        },
        "hasAttachments": {
          "type": [
            "boolean",
            "null"
          ],
          "description": "Indicates whether an incoming message must have attachments in order for the condition or exception to apply."
        },
        "headerContains": {
          "type": "array",
          "items": {
            "type": [
              "string",
              "null"
            ]
          },
          "description": "Represents the strings that appear in the headers of an incoming message in order for the condition or exception to apply."
        },
        "importance": {
          "$ref": "#/$defs/microsoft.graph.importance"
        },
        "isApprovalRequest": {
          "type": [
            "boolean",
            "null"
          ],
          "description": "Indicates whether an incoming message must be an approval request in order for the condition or exception to apply."
        },
        "isAutomaticForward": {
          "type": [
            "boolean",
            "null"
          ],
          "description": "Indicates whether an incoming message must be automatically forwarded in order for the condition or exception to apply."
        },
        "isAutomaticReply": {
          "type": [
            "boolean",
            "null"
          ],
          "description": "Indicates whether an incoming message must be an auto reply in order for the condition or exception to apply."
        },
        "isEncrypted": {
          "type": [
            "boolean",
            "null"
          ],
          "description": "Indicates whether an incoming message must be encrypted in order for the condition or exception to apply."
        },
        "isMeetingRequest": {
          "type": [
            "boolean",
            "null"
          ],
          "description": "Indicates whether an incoming message must be a meeting request in order for the condition or exception to apply."
        },
        "isMeetingResponse": {
          "type": [
            "boolean",
            "null"
          ],
          "description": "Indicates whether an incoming message must be a meeting response in order for the condition or exception to apply."
        },
        "isNonDeliveryReport": {
          "type": [
            "boolean",
            "null"
          ],
          "description": "Indicates whether an incoming message must be a non-delivery report in order for the condition or exception to apply."
        },
        "isPermissionControlled": {
          "type": [
            "boolean",
            "null"
          ],
          "description": "Indicates whether an incoming message must be permission controlled (RMS-protected) in order for the condition or exception to apply."
        },
        "isReadReceipt": {
          "type": [
            "boolean",
            "null"
          ],
          "description": "Indicates whether an incoming message must be a read receipt in order for the condition or exception to apply."
        },
        "isSigned": {
          "type": [
            "boolean",
            "null"
          ],
          "description": "Indicates whether an incoming message must be S/MIME-signed in order for the condition or exception to apply."
        },
        "isVoicemail": {
          "type": [
            "boolean",
            "null"
          ],
          "description": "Indicates whether an incoming message must be a voice mail in order for the condition or exception to apply."
        },
        "messageActionFlag": {
          "$ref": "#/$defs/microsoft.graph.messageActionFlag"
        },
        "notSentToMe": {
          "type": [
            "boolean",
            "null"
          ],
          "description": "Indicates whether the owner of the mailbox must not be a recipient of an incoming message in order for the condition or exception to apply."
        },
        "recipientContains": {
          "type": "array",
          "items": {
            "type": [
              "string",
              "null"
            ]
          },
          "description": "Represents the strings that appear in either the toRecipients or ccRecipients properties of an incoming message in order for the condition or exception to apply."
        },
        "senderContains": {
          "type": "array",
          "items": {
            "type": [
              "string",
              "null"
            ]
          },
          "description": "Represents the strings that appear in the from property of an incoming message in order for the condition or exception to apply."
        },
        "sensitivity": {
          "$ref": "#/$defs/microsoft.graph.sensitivity"
        },
        "sentCcMe": {
          "type": [
            "boolean",
            "null"
          ],
          "description": "Indicates whether the owner of the mailbox must be in the ccRecipients property of an incoming message in order for the condition or exception to apply."
        },
        "sentOnlyToMe": {
          "type": [
            "boolean",
            "null"
          ],
          "description": "Indicates whether the owner of the mailbox must be the only recipient in an incoming message in order for the condition or exception to apply."
        },
        "sentToAddresses": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/microsoft.graph.recipient"
          },
          "description": "Represents the email addresses that an incoming message must have been sent to in order for the condition or exception to apply."
        },
        "sentToMe": {
          "type": [
            "boolean",
            "null"
          ],
          "description": "Indicates whether the owner of the mailbox must be in the toRecipients property of an incoming message in order for the condition or exception to apply."
        },
        "sentToOrCcMe": {
          "type": [
            "boolean",
            "null"
          ],
          "description": "Indicates whether the owner of the mailbox must be in either a toRecipients or ccRecipients property of an incoming message in order for the condition or exception to apply."
        },
        "subjectContains": {
          "type": "array",
          "items": {
            "type": [
              "string",
              "null"
            ]
          },
          "description": "Represents the strings that appear in the subject of an incoming message in order for the condition or exception to apply."
        },
        "withinSizeRange": {
          "$ref": "#/$defs/microsoft.graph.sizeRange"
        }
      },
      "additionalProperties": {
        "type": "object"
      }
    },
    "microsoft.graph.recipient": {
      "title": "recipient",
      "type": "object",
      "properties": {
        "emailAddress": {
          "$ref": "#/$defs/microsoft.graph.emailAddress"
        }
      },
      "additionalProperties": {
        "type": "object"
      }
    },
    "microsoft.graph.sensitivity": {
      "title": "sensitivity",
      "enum": [
        "normal",
        "personal",
        "private",
        "confidential"
      ],
      "type": "string"
    },
    "microsoft.graph.sizeRange": {
      "title": "sizeRange",
      "type": "object",
      "properties": {
        "maximumSize": {
          "maximum": 2147483647,
          "minimum": -2147483648,
          "type": [
            "number",
            "null"
          ],
          "description": "The maximum size (in kilobytes) that an incoming message must have in order for a condition or exception to apply.",
          "format": "int32"
        },
        "minimumSize": {
          "maximum": 2147483647,
          "minimum": -2147483648,
          "type": [
            "number",
            "null"
          ],
          "description": "The minimum size (in kilobytes) that an incoming message must have in order for a condition or exception to apply.",
          "format": "int32"
        }
      },
      "additionalProperties": {
        "type": "object"
      }
    }
  }
}