---
title: "POST /guilds/{guild_id}/auto-moderation/rules"
method: POST
path: "/guilds/{guild_id}/auto-moderation/rules"
---

# POST /guilds/{guild_id}/auto-moderation/rules

`POST /guilds/{guild_id}/auto-moderation/rules`

## Request body

- union
  - DefaultKeywordListUpsertRequest
    - `name` string, required
    - `event_type` union, required
      - 1 — A user submitted a message to a channel
      - 2 — A user is attempting to join the server or a member's properties were updated.
    - `actions` union[], nullable
      - union
        - BlockMessageAction
          - `type` union, required
            - 1 — Block a user's message and prevent it from being posted. A custom explanation can be specified and shown to members whenever their message is blocked
            - 2 — Send a system message to a channel in order to log the user message that triggered the rule
            - 3 — Temporarily disable a user's ability to communicate in the server (timeout)
            - 4 — Prevent a user from interacting in the server
          - `metadata` BlockMessageActionMetadata
            - `custom_message` string, nullable
        - FlagToChannelAction
          - `type` union, required
            - 1 — Block a user's message and prevent it from being posted. A custom explanation can be specified and shown to members whenever their message is blocked
            - 2 — Send a system message to a channel in order to log the user message that triggered the rule
            - 3 — Temporarily disable a user's ability to communicate in the server (timeout)
            - 4 — Prevent a user from interacting in the server
          - `metadata` FlagToChannelActionMetadata, required
            - `channel_id` string, snowflake, required
        - QuarantineUserAction
          - `type` union, required
            - 1 — Block a user's message and prevent it from being posted. A custom explanation can be specified and shown to members whenever their message is blocked
            - 2 — Send a system message to a channel in order to log the user message that triggered the rule
            - 3 — Temporarily disable a user's ability to communicate in the server (timeout)
            - 4 — Prevent a user from interacting in the server
          - `metadata` QuarantineUserActionMetadata
        - UserCommunicationDisabledAction
          - `type` union, required
            - 1 — Block a user's message and prevent it from being posted. A custom explanation can be specified and shown to members whenever their message is blocked
            - 2 — Send a system message to a channel in order to log the user message that triggered the rule
            - 3 — Temporarily disable a user's ability to communicate in the server (timeout)
            - 4 — Prevent a user from interacting in the server
          - `metadata` UserCommunicationDisabledActionMetadata, required
            - `duration_seconds` integer, nullable
    - `enabled` boolean, nullable
    - `exempt_roles` SnowflakeType[], nullable
    - `exempt_channels` SnowflakeType[], nullable
    - `trigger_type` union, required
      - 1 — Check if content contains words from a list of keywords or matches regex
      - 3 — Check if content represents generic spam
      - 4 — Check if content contains words from internal pre-defined wordsets
      - 5 — Check if content contains more unique mentions than allowed
      - 6 — Check if user profile fields contains words from a list of keywords or matches regex
    - `trigger_metadata` DefaultKeywordListTriggerMetadata, required
      - `allow_list` string[], nullable
      - `presets` AutomodKeywordPresetType[], nullable
        - union
          - 1 — Words and phrases that may be considered profanity
          - 2 — Words and phrases that may be considered as sexual content
          - 3 — Words and phrases that may be considered slurs and hate speech
  - KeywordUpsertRequest
    - `name` string, required
    - `event_type` union, required
      - 1 — A user submitted a message to a channel
      - 2 — A user is attempting to join the server or a member's properties were updated.
    - `actions` union[], nullable
      - union
        - BlockMessageAction
          - `type` union, required
            - 1 — Block a user's message and prevent it from being posted. A custom explanation can be specified and shown to members whenever their message is blocked
            - 2 — Send a system message to a channel in order to log the user message that triggered the rule
            - 3 — Temporarily disable a user's ability to communicate in the server (timeout)
            - 4 — Prevent a user from interacting in the server
          - `metadata` BlockMessageActionMetadata
            - `custom_message` string, nullable
        - FlagToChannelAction
          - `type` union, required
            - 1 — Block a user's message and prevent it from being posted. A custom explanation can be specified and shown to members whenever their message is blocked
            - 2 — Send a system message to a channel in order to log the user message that triggered the rule
            - 3 — Temporarily disable a user's ability to communicate in the server (timeout)
            - 4 — Prevent a user from interacting in the server
          - `metadata` FlagToChannelActionMetadata, required
            - `channel_id` string, snowflake, required
        - QuarantineUserAction
          - `type` union, required
            - 1 — Block a user's message and prevent it from being posted. A custom explanation can be specified and shown to members whenever their message is blocked
            - 2 — Send a system message to a channel in order to log the user message that triggered the rule
            - 3 — Temporarily disable a user's ability to communicate in the server (timeout)
            - 4 — Prevent a user from interacting in the server
          - `metadata` QuarantineUserActionMetadata
        - UserCommunicationDisabledAction
          - `type` union, required
            - 1 — Block a user's message and prevent it from being posted. A custom explanation can be specified and shown to members whenever their message is blocked
            - 2 — Send a system message to a channel in order to log the user message that triggered the rule
            - 3 — Temporarily disable a user's ability to communicate in the server (timeout)
            - 4 — Prevent a user from interacting in the server
          - `metadata` UserCommunicationDisabledActionMetadata, required
            - `duration_seconds` integer, nullable
    - `enabled` boolean, nullable
    - `exempt_roles` SnowflakeType[], nullable
    - `exempt_channels` SnowflakeType[], nullable
    - `trigger_type` union, required
      - 1 — Check if content contains words from a list of keywords or matches regex
      - 3 — Check if content represents generic spam
      - 4 — Check if content contains words from internal pre-defined wordsets
      - 5 — Check if content contains more unique mentions than allowed
      - 6 — Check if user profile fields contains words from a list of keywords or matches regex
    - `trigger_metadata` KeywordTriggerMetadata
      - `keyword_filter` string[], nullable
      - `regex_patterns` string[], nullable
      - `allow_list` string[], nullable
  - MLSpamUpsertRequest
    - `name` string, required
    - `event_type` union, required
      - 1 — A user submitted a message to a channel
      - 2 — A user is attempting to join the server or a member's properties were updated.
    - `actions` union[], nullable
      - union
        - BlockMessageAction
          - `type` union, required
            - 1 — Block a user's message and prevent it from being posted. A custom explanation can be specified and shown to members whenever their message is blocked
            - 2 — Send a system message to a channel in order to log the user message that triggered the rule
            - 3 — Temporarily disable a user's ability to communicate in the server (timeout)
            - 4 — Prevent a user from interacting in the server
          - `metadata` BlockMessageActionMetadata
            - `custom_message` string, nullable
        - FlagToChannelAction
          - `type` union, required
            - 1 — Block a user's message and prevent it from being posted. A custom explanation can be specified and shown to members whenever their message is blocked
            - 2 — Send a system message to a channel in order to log the user message that triggered the rule
            - 3 — Temporarily disable a user's ability to communicate in the server (timeout)
            - 4 — Prevent a user from interacting in the server
          - `metadata` FlagToChannelActionMetadata, required
            - `channel_id` string, snowflake, required
        - QuarantineUserAction
          - `type` union, required
            - 1 — Block a user's message and prevent it from being posted. A custom explanation can be specified and shown to members whenever their message is blocked
            - 2 — Send a system message to a channel in order to log the user message that triggered the rule
            - 3 — Temporarily disable a user's ability to communicate in the server (timeout)
            - 4 — Prevent a user from interacting in the server
          - `metadata` QuarantineUserActionMetadata
        - UserCommunicationDisabledAction
          - `type` union, required
            - 1 — Block a user's message and prevent it from being posted. A custom explanation can be specified and shown to members whenever their message is blocked
            - 2 — Send a system message to a channel in order to log the user message that triggered the rule
            - 3 — Temporarily disable a user's ability to communicate in the server (timeout)
            - 4 — Prevent a user from interacting in the server
          - `metadata` UserCommunicationDisabledActionMetadata, required
            - `duration_seconds` integer, nullable
    - `enabled` boolean, nullable
    - `exempt_roles` SnowflakeType[], nullable
    - `exempt_channels` SnowflakeType[], nullable
    - `trigger_type` union, required
      - 1 — Check if content contains words from a list of keywords or matches regex
      - 3 — Check if content represents generic spam
      - 4 — Check if content contains words from internal pre-defined wordsets
      - 5 — Check if content contains more unique mentions than allowed
      - 6 — Check if user profile fields contains words from a list of keywords or matches regex
    - `trigger_metadata` MLSpamTriggerMetadata
  - MentionSpamUpsertRequest
    - `name` string, required
    - `event_type` union, required
      - 1 — A user submitted a message to a channel
      - 2 — A user is attempting to join the server or a member's properties were updated.
    - `actions` union[], nullable
      - union
        - BlockMessageAction
          - `type` union, required
            - 1 — Block a user's message and prevent it from being posted. A custom explanation can be specified and shown to members whenever their message is blocked
            - 2 — Send a system message to a channel in order to log the user message that triggered the rule
            - 3 — Temporarily disable a user's ability to communicate in the server (timeout)
            - 4 — Prevent a user from interacting in the server
          - `metadata` BlockMessageActionMetadata
            - `custom_message` string, nullable
        - FlagToChannelAction
          - `type` union, required
            - 1 — Block a user's message and prevent it from being posted. A custom explanation can be specified and shown to members whenever their message is blocked
            - 2 — Send a system message to a channel in order to log the user message that triggered the rule
            - 3 — Temporarily disable a user's ability to communicate in the server (timeout)
            - 4 — Prevent a user from interacting in the server
          - `metadata` FlagToChannelActionMetadata, required
            - `channel_id` string, snowflake, required
        - QuarantineUserAction
          - `type` union, required
            - 1 — Block a user's message and prevent it from being posted. A custom explanation can be specified and shown to members whenever their message is blocked
            - 2 — Send a system message to a channel in order to log the user message that triggered the rule
            - 3 — Temporarily disable a user's ability to communicate in the server (timeout)
            - 4 — Prevent a user from interacting in the server
          - `metadata` QuarantineUserActionMetadata
        - UserCommunicationDisabledAction
          - `type` union, required
            - 1 — Block a user's message and prevent it from being posted. A custom explanation can be specified and shown to members whenever their message is blocked
            - 2 — Send a system message to a channel in order to log the user message that triggered the rule
            - 3 — Temporarily disable a user's ability to communicate in the server (timeout)
            - 4 — Prevent a user from interacting in the server
          - `metadata` UserCommunicationDisabledActionMetadata, required
            - `duration_seconds` integer, nullable
    - `enabled` boolean, nullable
    - `exempt_roles` SnowflakeType[], nullable
    - `exempt_channels` SnowflakeType[], nullable
    - `trigger_type` union, required
      - 1 — Check if content contains words from a list of keywords or matches regex
      - 3 — Check if content represents generic spam
      - 4 — Check if content contains words from internal pre-defined wordsets
      - 5 — Check if content contains more unique mentions than allowed
      - 6 — Check if user profile fields contains words from a list of keywords or matches regex
    - `trigger_metadata` MentionSpamTriggerMetadata
      - `mention_total_limit` integer, nullable
      - `mention_raid_protection_enabled` boolean, nullable
  - UserProfileUpsertRequest
    - `name` string, required
    - `event_type` union, required
      - 1 — A user submitted a message to a channel
      - 2 — A user is attempting to join the server or a member's properties were updated.
    - `actions` union[], nullable
      - union
        - BlockMessageAction
          - `type` union, required
            - 1 — Block a user's message and prevent it from being posted. A custom explanation can be specified and shown to members whenever their message is blocked
            - 2 — Send a system message to a channel in order to log the user message that triggered the rule
            - 3 — Temporarily disable a user's ability to communicate in the server (timeout)
            - 4 — Prevent a user from interacting in the server
          - `metadata` BlockMessageActionMetadata
            - `custom_message` string, nullable
        - FlagToChannelAction
          - `type` union, required
            - 1 — Block a user's message and prevent it from being posted. A custom explanation can be specified and shown to members whenever their message is blocked
            - 2 — Send a system message to a channel in order to log the user message that triggered the rule
            - 3 — Temporarily disable a user's ability to communicate in the server (timeout)
            - 4 — Prevent a user from interacting in the server
          - `metadata` FlagToChannelActionMetadata, required
            - `channel_id` string, snowflake, required
        - QuarantineUserAction
          - `type` union, required
            - 1 — Block a user's message and prevent it from being posted. A custom explanation can be specified and shown to members whenever their message is blocked
            - 2 — Send a system message to a channel in order to log the user message that triggered the rule
            - 3 — Temporarily disable a user's ability to communicate in the server (timeout)
            - 4 — Prevent a user from interacting in the server
          - `metadata` QuarantineUserActionMetadata
        - UserCommunicationDisabledAction
          - `type` union, required
            - 1 — Block a user's message and prevent it from being posted. A custom explanation can be specified and shown to members whenever their message is blocked
            - 2 — Send a system message to a channel in order to log the user message that triggered the rule
            - 3 — Temporarily disable a user's ability to communicate in the server (timeout)
            - 4 — Prevent a user from interacting in the server
          - `metadata` UserCommunicationDisabledActionMetadata, required
            - `duration_seconds` integer, nullable
    - `enabled` boolean, nullable
    - `exempt_roles` SnowflakeType[], nullable
    - `exempt_channels` SnowflakeType[], nullable
    - `trigger_type` union, required
      - 1 — Check if content contains words from a list of keywords or matches regex
      - 3 — Check if content represents generic spam
      - 4 — Check if content contains words from internal pre-defined wordsets
      - 5 — Check if content contains more unique mentions than allowed
      - 6 — Check if user profile fields contains words from a list of keywords or matches regex
    - `trigger_metadata` UserProfileMetadata, required
      - `keyword_filter` string[], nullable
      - `regex_patterns` string[], nullable
      - `allow_list` string[], nullable

## Response `200`

200 response for create_auto_moderation_rule

- union
  - DefaultKeywordRuleResponse
    - `id` string, snowflake, required
    - `guild_id` string, snowflake, required
    - `creator_id` string, snowflake, required
    - `name` string, required
    - `event_type` union, required
      - 1 — A user submitted a message to a channel
      - 2 — A user is attempting to join the server or a member's properties were updated.
    - `actions` union[], required
      - union
        - BlockMessageActionResponse
          - `type` union, required
            - 1 — Block a user's message and prevent it from being posted. A custom explanation can be specified and shown to members whenever their message is blocked
            - 2 — Send a system message to a channel in order to log the user message that triggered the rule
            - 3 — Temporarily disable a user's ability to communicate in the server (timeout)
            - 4 — Prevent a user from interacting in the server
          - `metadata` BlockMessageActionMetadataResponse, required
            - `custom_message` string
        - FlagToChannelActionResponse
          - `type` union, required
            - 1 — Block a user's message and prevent it from being posted. A custom explanation can be specified and shown to members whenever their message is blocked
            - 2 — Send a system message to a channel in order to log the user message that triggered the rule
            - 3 — Temporarily disable a user's ability to communicate in the server (timeout)
            - 4 — Prevent a user from interacting in the server
          - `metadata` FlagToChannelActionMetadataResponse, required
            - `channel_id` string, snowflake, required
        - QuarantineUserActionResponse
          - `type` union, required
            - 1 — Block a user's message and prevent it from being posted. A custom explanation can be specified and shown to members whenever their message is blocked
            - 2 — Send a system message to a channel in order to log the user message that triggered the rule
            - 3 — Temporarily disable a user's ability to communicate in the server (timeout)
            - 4 — Prevent a user from interacting in the server
          - `metadata` QuarantineUserActionMetadataResponse, required
        - UserCommunicationDisabledActionResponse
          - `type` union, required
            - 1 — Block a user's message and prevent it from being posted. A custom explanation can be specified and shown to members whenever their message is blocked
            - 2 — Send a system message to a channel in order to log the user message that triggered the rule
            - 3 — Temporarily disable a user's ability to communicate in the server (timeout)
            - 4 — Prevent a user from interacting in the server
          - `metadata` UserCommunicationDisabledActionMetadataResponse, required
            - `duration_seconds` integer, required
    - `trigger_type` union, required
      - 1 — Check if content contains words from a list of keywords or matches regex
      - 3 — Check if content represents generic spam
      - 4 — Check if content contains words from internal pre-defined wordsets
      - 5 — Check if content contains more unique mentions than allowed
      - 6 — Check if user profile fields contains words from a list of keywords or matches regex
    - `enabled` boolean, required
    - `exempt_roles` SnowflakeType[], required
    - `exempt_channels` SnowflakeType[], required
    - `trigger_metadata` DefaultKeywordListTriggerMetadataResponse, required
      - `allow_list` string[], required
      - `presets` AutomodKeywordPresetType[], required
        - union
          - 1 — Words and phrases that may be considered profanity
          - 2 — Words and phrases that may be considered as sexual content
          - 3 — Words and phrases that may be considered slurs and hate speech
  - KeywordRuleResponse
    - `id` string, snowflake, required
    - `guild_id` string, snowflake, required
    - `creator_id` string, snowflake, required
    - `name` string, required
    - `event_type` union, required
      - 1 — A user submitted a message to a channel
      - 2 — A user is attempting to join the server or a member's properties were updated.
    - `actions` union[], required
      - union
        - BlockMessageActionResponse
          - `type` union, required
            - 1 — Block a user's message and prevent it from being posted. A custom explanation can be specified and shown to members whenever their message is blocked
            - 2 — Send a system message to a channel in order to log the user message that triggered the rule
            - 3 — Temporarily disable a user's ability to communicate in the server (timeout)
            - 4 — Prevent a user from interacting in the server
          - `metadata` BlockMessageActionMetadataResponse, required
            - `custom_message` string
        - FlagToChannelActionResponse
          - `type` union, required
            - 1 — Block a user's message and prevent it from being posted. A custom explanation can be specified and shown to members whenever their message is blocked
            - 2 — Send a system message to a channel in order to log the user message that triggered the rule
            - 3 — Temporarily disable a user's ability to communicate in the server (timeout)
            - 4 — Prevent a user from interacting in the server
          - `metadata` FlagToChannelActionMetadataResponse, required
            - `channel_id` string, snowflake, required
        - QuarantineUserActionResponse
          - `type` union, required
            - 1 — Block a user's message and prevent it from being posted. A custom explanation can be specified and shown to members whenever their message is blocked
            - 2 — Send a system message to a channel in order to log the user message that triggered the rule
            - 3 — Temporarily disable a user's ability to communicate in the server (timeout)
            - 4 — Prevent a user from interacting in the server
          - `metadata` QuarantineUserActionMetadataResponse, required
        - UserCommunicationDisabledActionResponse
          - `type` union, required
            - 1 — Block a user's message and prevent it from being posted. A custom explanation can be specified and shown to members whenever their message is blocked
            - 2 — Send a system message to a channel in order to log the user message that triggered the rule
            - 3 — Temporarily disable a user's ability to communicate in the server (timeout)
            - 4 — Prevent a user from interacting in the server
          - `metadata` UserCommunicationDisabledActionMetadataResponse, required
            - `duration_seconds` integer, required
    - `trigger_type` union, required
      - 1 — Check if content contains words from a list of keywords or matches regex
      - 3 — Check if content represents generic spam
      - 4 — Check if content contains words from internal pre-defined wordsets
      - 5 — Check if content contains more unique mentions than allowed
      - 6 — Check if user profile fields contains words from a list of keywords or matches regex
    - `enabled` boolean, required
    - `exempt_roles` SnowflakeType[], required
    - `exempt_channels` SnowflakeType[], required
    - `trigger_metadata` KeywordTriggerMetadataResponse, required
      - `keyword_filter` string[], required
      - `regex_patterns` string[], required
      - `allow_list` string[], required
  - MLSpamRuleResponse
    - `id` string, snowflake, required
    - `guild_id` string, snowflake, required
    - `creator_id` string, snowflake, required
    - `name` string, required
    - `event_type` union, required
      - 1 — A user submitted a message to a channel
      - 2 — A user is attempting to join the server or a member's properties were updated.
    - `actions` union[], required
      - union
        - BlockMessageActionResponse
          - `type` union, required
            - 1 — Block a user's message and prevent it from being posted. A custom explanation can be specified and shown to members whenever their message is blocked
            - 2 — Send a system message to a channel in order to log the user message that triggered the rule
            - 3 — Temporarily disable a user's ability to communicate in the server (timeout)
            - 4 — Prevent a user from interacting in the server
          - `metadata` BlockMessageActionMetadataResponse, required
            - `custom_message` string
        - FlagToChannelActionResponse
          - `type` union, required
            - 1 — Block a user's message and prevent it from being posted. A custom explanation can be specified and shown to members whenever their message is blocked
            - 2 — Send a system message to a channel in order to log the user message that triggered the rule
            - 3 — Temporarily disable a user's ability to communicate in the server (timeout)
            - 4 — Prevent a user from interacting in the server
          - `metadata` FlagToChannelActionMetadataResponse, required
            - `channel_id` string, snowflake, required
        - QuarantineUserActionResponse
          - `type` union, required
            - 1 — Block a user's message and prevent it from being posted. A custom explanation can be specified and shown to members whenever their message is blocked
            - 2 — Send a system message to a channel in order to log the user message that triggered the rule
            - 3 — Temporarily disable a user's ability to communicate in the server (timeout)
            - 4 — Prevent a user from interacting in the server
          - `metadata` QuarantineUserActionMetadataResponse, required
        - UserCommunicationDisabledActionResponse
          - `type` union, required
            - 1 — Block a user's message and prevent it from being posted. A custom explanation can be specified and shown to members whenever their message is blocked
            - 2 — Send a system message to a channel in order to log the user message that triggered the rule
            - 3 — Temporarily disable a user's ability to communicate in the server (timeout)
            - 4 — Prevent a user from interacting in the server
          - `metadata` UserCommunicationDisabledActionMetadataResponse, required
            - `duration_seconds` integer, required
    - `trigger_type` union, required
      - 1 — Check if content contains words from a list of keywords or matches regex
      - 3 — Check if content represents generic spam
      - 4 — Check if content contains words from internal pre-defined wordsets
      - 5 — Check if content contains more unique mentions than allowed
      - 6 — Check if user profile fields contains words from a list of keywords or matches regex
    - `enabled` boolean, required
    - `exempt_roles` SnowflakeType[], required
    - `exempt_channels` SnowflakeType[], required
    - `trigger_metadata` MLSpamTriggerMetadataResponse, required
  - MentionSpamRuleResponse
    - `id` string, snowflake, required
    - `guild_id` string, snowflake, required
    - `creator_id` string, snowflake, required
    - `name` string, required
    - `event_type` union, required
      - 1 — A user submitted a message to a channel
      - 2 — A user is attempting to join the server or a member's properties were updated.
    - `actions` union[], required
      - union
        - BlockMessageActionResponse
          - `type` union, required
            - 1 — Block a user's message and prevent it from being posted. A custom explanation can be specified and shown to members whenever their message is blocked
            - 2 — Send a system message to a channel in order to log the user message that triggered the rule
            - 3 — Temporarily disable a user's ability to communicate in the server (timeout)
            - 4 — Prevent a user from interacting in the server
          - `metadata` BlockMessageActionMetadataResponse, required
            - `custom_message` string
        - FlagToChannelActionResponse
          - `type` union, required
            - 1 — Block a user's message and prevent it from being posted. A custom explanation can be specified and shown to members whenever their message is blocked
            - 2 — Send a system message to a channel in order to log the user message that triggered the rule
            - 3 — Temporarily disable a user's ability to communicate in the server (timeout)
            - 4 — Prevent a user from interacting in the server
          - `metadata` FlagToChannelActionMetadataResponse, required
            - `channel_id` string, snowflake, required
        - QuarantineUserActionResponse
          - `type` union, required
            - 1 — Block a user's message and prevent it from being posted. A custom explanation can be specified and shown to members whenever their message is blocked
            - 2 — Send a system message to a channel in order to log the user message that triggered the rule
            - 3 — Temporarily disable a user's ability to communicate in the server (timeout)
            - 4 — Prevent a user from interacting in the server
          - `metadata` QuarantineUserActionMetadataResponse, required
        - UserCommunicationDisabledActionResponse
          - `type` union, required
            - 1 — Block a user's message and prevent it from being posted. A custom explanation can be specified and shown to members whenever their message is blocked
            - 2 — Send a system message to a channel in order to log the user message that triggered the rule
            - 3 — Temporarily disable a user's ability to communicate in the server (timeout)
            - 4 — Prevent a user from interacting in the server
          - `metadata` UserCommunicationDisabledActionMetadataResponse, required
            - `duration_seconds` integer, required
    - `trigger_type` union, required
      - 1 — Check if content contains words from a list of keywords or matches regex
      - 3 — Check if content represents generic spam
      - 4 — Check if content contains words from internal pre-defined wordsets
      - 5 — Check if content contains more unique mentions than allowed
      - 6 — Check if user profile fields contains words from a list of keywords or matches regex
    - `enabled` boolean, required
    - `exempt_roles` SnowflakeType[], required
    - `exempt_channels` SnowflakeType[], required
    - `trigger_metadata` MentionSpamTriggerMetadataResponse, required
      - `mention_total_limit` integer, required
      - `mention_raid_protection_enabled` boolean, required
  - UserProfileRuleResponse
    - `id` string, snowflake, required
    - `guild_id` string, snowflake, required
    - `creator_id` string, snowflake, required
    - `name` string, required
    - `event_type` union, required
      - 1 — A user submitted a message to a channel
      - 2 — A user is attempting to join the server or a member's properties were updated.
    - `actions` union[], required
      - union
        - BlockMessageActionResponse
          - `type` union, required
            - 1 — Block a user's message and prevent it from being posted. A custom explanation can be specified and shown to members whenever their message is blocked
            - 2 — Send a system message to a channel in order to log the user message that triggered the rule
            - 3 — Temporarily disable a user's ability to communicate in the server (timeout)
            - 4 — Prevent a user from interacting in the server
          - `metadata` BlockMessageActionMetadataResponse, required
            - `custom_message` string
        - FlagToChannelActionResponse
          - `type` union, required
            - 1 — Block a user's message and prevent it from being posted. A custom explanation can be specified and shown to members whenever their message is blocked
            - 2 — Send a system message to a channel in order to log the user message that triggered the rule
            - 3 — Temporarily disable a user's ability to communicate in the server (timeout)
            - 4 — Prevent a user from interacting in the server
          - `metadata` FlagToChannelActionMetadataResponse, required
            - `channel_id` string, snowflake, required
        - QuarantineUserActionResponse
          - `type` union, required
            - 1 — Block a user's message and prevent it from being posted. A custom explanation can be specified and shown to members whenever their message is blocked
            - 2 — Send a system message to a channel in order to log the user message that triggered the rule
            - 3 — Temporarily disable a user's ability to communicate in the server (timeout)
            - 4 — Prevent a user from interacting in the server
          - `metadata` QuarantineUserActionMetadataResponse, required
        - UserCommunicationDisabledActionResponse
          - `type` union, required
            - 1 — Block a user's message and prevent it from being posted. A custom explanation can be specified and shown to members whenever their message is blocked
            - 2 — Send a system message to a channel in order to log the user message that triggered the rule
            - 3 — Temporarily disable a user's ability to communicate in the server (timeout)
            - 4 — Prevent a user from interacting in the server
          - `metadata` UserCommunicationDisabledActionMetadataResponse, required
            - `duration_seconds` integer, required
    - `trigger_type` union, required
      - 1 — Check if content contains words from a list of keywords or matches regex
      - 3 — Check if content represents generic spam
      - 4 — Check if content contains words from internal pre-defined wordsets
      - 5 — Check if content contains more unique mentions than allowed
      - 6 — Check if user profile fields contains words from a list of keywords or matches regex
    - `enabled` boolean, required
    - `exempt_roles` SnowflakeType[], required
    - `exempt_channels` SnowflakeType[], required
    - `trigger_metadata` UserProfileMetadataResponse, required
      - `keyword_filter` string[], required
      - `regex_patterns` string[], required
      - `allow_list` string[], required

## Other responses

- `429` — Client ratelimited response
- `4XX` — Client error response

## Changes

- **2026-06-05** `693bf1f99bba` — 9 breaking, 10 info
  - removed `subschema #2: SPAM_LINK` from the `oneOf[#/components/schemas/DefaultKeywordListUpsertRequest]/trigger_type/allOf[#/components/schemas/AutomodTriggerType]/` request property `oneOf` list
  - removed `subschema #2: SPAM_LINK` from the `oneOf[#/components/schemas/KeywordUpsertRequest]/trigger_type/allOf[#/components/schemas/AutomodTriggerType]/` request property `oneOf` list
  - removed `subschema #2: SPAM_LINK` from the `oneOf[#/components/schemas/MLSpamUpsertRequest]/trigger_type/allOf[#/components/schemas/AutomodTriggerType]/` request property `oneOf` list
  - removed `subschema #2: SPAM_LINK` from the `oneOf[#/components/schemas/MentionSpamUpsertRequest]/trigger_type/allOf[#/components/schemas/AutomodTriggerType]/` request property `oneOf` list
  - …15 more
- …earlier changes not shown

[Full history](https://skmtc.dev/discord/apis/discord-http-api-preview/changes/guilds/:guild_id/auto-moderation/rules/post.md)

---

[API](https://skmtc.dev/discord/apis/discord-http-api-preview.md) · [All operations](https://skmtc.dev/discord/apis/discord-http-api-preview/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/discord/discord-http-api-preview/revisions/49efa428e0dd/schema)
