> To build or manage a Wix site with an AI agent, follow https://www.wix.com/headless/skill.md
> It builds a new Wix site or puts your own site online, from a prompt, and keeps changing it afterwards. The pages are code in any web technology, and Wix runs the backend.
> It works through the Wix plugin (the Wix MCP and the Wix skills), the Wix CLI or no Wix login, and puts the site live on Wix hosting or on another host.
> Business features include a store, bookings, events and tickets, a restaurant, a blog, forms, members and many more.
> Read the Wix skills online at https://www.wix.com/skills
> 
> Portal Navigation:
> 
> - Append `.md` to any URL under `https://dev.wix.com/docs/` to get its markdown version.
> - Pages are either content pages (article or reference text) or menu pages (a list of links to child pages).
> - To get a menu page, truncate any URL to a parent path and append `.md` (e.g. `https://dev.wix.com/docs/sdk.md`, `https://dev.wix.com/docs/sdk/core-modules.md`).
> - If a reference page seems to be missing its schema (parameters, return types, or type definitions), append `?schema=true` to its `.md` URL (e.g. `https://dev.wix.com/docs/contexts/contexts/stores/category-info/use-category-info-context.md?schema=true`).
> - Top-level index of all portals: https://dev.wix.com/docs/llms.txt
> - Full concatenated docs: https://dev.wix.com/docs/llms-full.txt

# CreateRule

# Package: feedbackModeration

# Namespace: ModerationRules

# Method link: https://dev.wix.com/docs/api-reference/crm/community/feedback-moderation/moderation-rules/create-rule.md

## Permission Scopes:
Manage Moderation Rules: SCOPE.MODERATION.MANAGE-MODERATION-RULES

## Introduction

Creates a rule.

You can create up to 20 rules per namespace.

---

## REST API

### Schema

```
 Method: createRule
 Description: Creates a rule.  You can create up to 20 rules per namespace.
 URL: https://www.wixapis.com/moderation/v1/rules
 Method: POST
 # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present.
 Required parameters:  rule, rule.namespace, rule.audience, rule.trigger, rule.action
 Method parameters: 
   param name: rule | type: Rule   | required: true 
        - name: namespace | type: string | description: The app name and entity which the rule belongs to. Currently, moderation rules support [Comments](https://dev.wix.com/docs/rest/crm/community/comments/comments/introduction.md) and [Reviews](https://dev.wix.com/docs/rest/crm/community/reviews/reviews/introduction.md):  + When the `namespace` is `comments` the format is `comments/{APP_ID}`. For example, for moderating content on Wix Blog the `namespace` is `"comments/14bcded7-0066-7c35-14d7-466cb3f09103"`. + When the `namespace` is `reviews` the format is `reviews/{APP_NAME}`. For example, for moderating content on Wix Reviews the `namespace` is `"reviews/stores"`.  To retrieve the GUID for a Wix app, see [Apps Created By Wix](https://dev.wix.com/docs/rest/articles/get-started/apps-created-by-wix.md). | required: true | validation: minLength 1, maxLength 120
        - name: name | type: string | description: Rule name.  | validation: maxLength 120
        - name: audience | type: Audience | description: Audience to which the rule applies. | required: true 
           - ONE-OF: 
              - name: newMembersOptions | type: NewMembersOptions | description: Options for new members.  **Note:** This object is relevant only when `type` is `NEW_MEMBERS`.  
                 - name: durationInHours | type: integer | description: For how many hours the member is new.  | validation: format int32
           - name: type | type: Type | description: Audience type.  
                 - enum: VISITORS, MEMBERS, MEMBERS_AND_VISITORS, NEW_MEMBERS
        - name: trigger | type: Trigger | description: A condition that triggers the rule.  **Note:** If you need to have several triggers for the same `namespace`, create separate rules. | required: true 
           - ONE-OF: 
              - name: patternsOptions | type: Patterns | description: Options for the patterns trigger.  
                 - name: words | type: array<string> | description: List of words that can trigger a rule. The `*` wildcard can be used to match a partial word. For example: - `spam`: Matches only "spam". - `spam*`: Matches "spam", "spammer", "spammy". - `*spam`: Matches "antispam", "multispam". - `sp*m`: Matches "spim", "spam", "spum".  | validation: maxItems 1000, maxLength 50
                 - name: expressions | type: array<string> | description: [Regular expressions](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_expressions).  | validation: maxItems 10, maxLength 300
              - name: contentFeaturesOptions | type: ContentFeatures | description: Options for the content features trigger.  
                 - name: videos | type: boolean | description: Whether the content contains videos.  
                 - name: images | type: boolean | description: Whether the content contains images.  
                 - name: links | type: boolean | description: Whether the content contains links.  
                 - name: attachments | type: boolean | description: Whether the content contains attachments or files.  
              - name: attributeOptions | type: Attribute | description: Options for the attributes trigger. You can only have 1 attribute per rule.  
                 - name: name | type: string | description: Attribute name.  | validation: maxLength 20
                 - name: values | type: array<string> | description: Attribute values.  | validation: maxItems 20, maxLength 20
           - name: type | type: Type | description: Trigger type.  
                 - enum:
                 -     PATTERNS: The trigger is a specific word or phrase. You can specify additional options in the `patternsOptions` object.
                 -     CONTENT_FEATURES: The rule is triggered when non-textual features, such as videos, images, links, and attachments, exist in the content. You can specify additional options in the `contentFeaturesOptions` object.
                 -     ATTRIBUTE: A custom trigger based on an attribute and its value. For example, if you'd like to check all reviews with a low rating, then `name` would be `rating`, and `values` would be `[1, 2]`. You can specify additional options in the `patternsOptions` object.
                 -     ALWAYS: There is no specific trigger. The rule is triggered whenever new content is created or existing content is updated, with no other conditions required.
        - name: exemptions | type: Exemptions | description: List of site members or groups to whom the rule doesn't apply.  
           - name: memberGroups | type: array<string> | description: List of member groups.  | validation: maxItems 50, format GUID
           - name: memberIds | type: array<string> | description: List of member GUIDs.  | validation: maxItems 50, format GUID
        - name: action | type: Action | description: What action should be taken after the rule is triggered. | required: true 
           - name: type | type: Type | description: Action type.  
                 - enum:
                 -     UNKNOWN_TYPE: 
                 -     REJECT: Reject the content without any further review.
                 -     NEEDS_MANUAL_APPROVAL: Send the content for manual review.
        - name: enabled | type: boolean | description: Whether the rule is enabled.  
        - name: extendedFields | type: ExtendedFields | description: Custom field data for the rule object.  **Note:** You must configure extended fields using schema plugin extensions in your app's dashboard before you can access the extended fields with API calls.  
           - name: namespaces | type: object | description: Extended field data. Each key corresponds to the namespace of the app that created the extended fields. The value of each key is structured according to the schema defined when the extended fields were configured.  You can only access fields for which you have the appropriate permissions.  Learn more about [extended fields](https://dev.wix.com/docs/rest/articles/getting-started/extended-fields.md).  | validation: format map
 Return type: CreateRuleResponse
  - name: rule | type: Rule | description: Created rule.  
     - name: id | type: string | description: Rule GUID.  | read-only: true | validation: format GUID
     - name: revision | type: string | description: Revision number, which increments by 1 each time the rule is updated. To prevent conflicting changes, the existing `revision` must be used when updating a rule.  | read-only: true | validation: format int64
     - name: createdDate | type: string | description: Date and time when the rule was created.  | read-only: true | validation: format date-time
     - name: updatedDate | type: string | description: Date and time when the rule was updated.  | read-only: true | validation: format date-time
     - name: namespace | type: string | description: The app name and entity which the rule belongs to. Currently, moderation rules support [Comments](https://dev.wix.com/docs/rest/crm/community/comments/comments/introduction.md) and [Reviews](https://dev.wix.com/docs/rest/crm/community/reviews/reviews/introduction.md):  + When the `namespace` is `comments` the format is `comments/{APP_ID}`. For example, for moderating content on Wix Blog the `namespace` is `"comments/14bcded7-0066-7c35-14d7-466cb3f09103"`. + When the `namespace` is `reviews` the format is `reviews/{APP_NAME}`. For example, for moderating content on Wix Reviews the `namespace` is `"reviews/stores"`.  To retrieve the GUID for a Wix app, see [Apps Created By Wix](https://dev.wix.com/docs/rest/articles/get-started/apps-created-by-wix.md).  | validation: minLength 1, maxLength 120
     - name: name | type: string | description: Rule name.  | validation: maxLength 120
     - name: audience | type: Audience | description: Audience to which the rule applies.  
        - ONE-OF: 
           - name: newMembersOptions | type: NewMembersOptions | description: Options for new members.  **Note:** This object is relevant only when `type` is `NEW_MEMBERS`.  
              - name: durationInHours | type: integer | description: For how many hours the member is new.  | validation: format int32
        - name: type | type: Type | description: Audience type.  
             - enum: VISITORS, MEMBERS, MEMBERS_AND_VISITORS, NEW_MEMBERS
     - name: trigger | type: Trigger | description: A condition that triggers the rule.  **Note:** If you need to have several triggers for the same `namespace`, create separate rules.  
        - ONE-OF: 
           - name: patternsOptions | type: Patterns | description: Options for the patterns trigger.  
              - name: words | type: array<string> | description: List of words that can trigger a rule. The `*` wildcard can be used to match a partial word. For example: - `spam`: Matches only "spam". - `spam*`: Matches "spam", "spammer", "spammy". - `*spam`: Matches "antispam", "multispam". - `sp*m`: Matches "spim", "spam", "spum".  | validation: maxItems 1000, maxLength 50
              - name: expressions | type: array<string> | description: [Regular expressions](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_expressions).  | validation: maxItems 10, maxLength 300
           - name: contentFeaturesOptions | type: ContentFeatures | description: Options for the content features trigger.  
              - name: videos | type: boolean | description: Whether the content contains videos.  
              - name: images | type: boolean | description: Whether the content contains images.  
              - name: links | type: boolean | description: Whether the content contains links.  
              - name: attachments | type: boolean | description: Whether the content contains attachments or files.  
           - name: attributeOptions | type: Attribute | description: Options for the attributes trigger. You can only have 1 attribute per rule.  
              - name: name | type: string | description: Attribute name.  | validation: maxLength 20
              - name: values | type: array<string> | description: Attribute values.  | validation: maxItems 20, maxLength 20
        - name: type | type: Type | description: Trigger type.  
             - enum:
             -     PATTERNS: The trigger is a specific word or phrase. You can specify additional options in the `patternsOptions` object.
             -     CONTENT_FEATURES: The rule is triggered when non-textual features, such as videos, images, links, and attachments, exist in the content. You can specify additional options in the `contentFeaturesOptions` object.
             -     ATTRIBUTE: A custom trigger based on an attribute and its value. For example, if you'd like to check all reviews with a low rating, then `name` would be `rating`, and `values` would be `[1, 2]`. You can specify additional options in the `patternsOptions` object.
             -     ALWAYS: There is no specific trigger. The rule is triggered whenever new content is created or existing content is updated, with no other conditions required.
     - name: exemptions | type: Exemptions | description: List of site members or groups to whom the rule doesn't apply.  
        - name: memberGroups | type: array<string> | description: List of member groups.  | validation: maxItems 50, format GUID
        - name: memberIds | type: array<string> | description: List of member GUIDs.  | validation: maxItems 50, format GUID
     - name: action | type: Action | description: What action should be taken after the rule is triggered.  
        - name: type | type: Type | description: Action type.  
             - enum:
             -     UNKNOWN_TYPE: 
             -     REJECT: Reject the content without any further review.
             -     NEEDS_MANUAL_APPROVAL: Send the content for manual review.
     - name: enabled | type: boolean | description: Whether the rule is enabled.  
     - name: extendedFields | type: ExtendedFields | description: Custom field data for the rule object.  **Note:** You must configure extended fields using schema plugin extensions in your app's dashboard before you can access the extended fields with API calls.  
        - name: namespaces | type: object | description: Extended field data. Each key corresponds to the namespace of the app that created the extended fields. The value of each key is structured according to the schema defined when the extended fields were configured.  You can only access fields for which you have the appropriate permissions.  Learn more about [extended fields](https://dev.wix.com/docs/rest/articles/getting-started/extended-fields.md).  | validation: format map

 Possible Errors:
   HTTP Code: 428 | Status Code: FAILED_PRECONDITION | Application Code: TOO_MANY_RULES | Description: Exceeded the limit of rules for this `namespace`.


```

### Examples

### Create a rule to manually approve reviews that contain videos
```curl
curl -X POST https://www.wixapis.com/moderation/v1/rules  \
    -H 'Content-Type: application/json;charset=UTF-8' \
    -H 'Authorization: <AUTH>' \
    -d '{
          "rule": {
            "namespace": "reviews/stores",
            "name": "Check for Videos",
            "audience": {
              "type": "MEMBERS_AND_VISITORS"
            },
            "trigger": {
              "type": "CONTENT_FEATURES",
              "contentFeaturesOptions": {
                "videos": true
              }
            },
            "action": {
              "type": "NEEDS_MANUAL_APPROVAL"
            },
            "enabled": true
          }
        }'
```

### Create a rule to reject comments that contain the "win a free" phrase
```curl
curl -X POST https://www.wixapis.com/moderation/v1/rules  \
    -H 'Content-Type: application/json;charset=UTF-8' \
    -H 'Authorization: <AUTH>' \
    -d '{
          "rule": {
            "namespace": "comments/6b0414fa-c128-4df7-9968-7c4a5c45e49a",
            "name": "Check for Win a Free Phrase",
            "audience": {
              "type": "MEMBERS_AND_VISITORS"
            },
            "trigger": {
              "type": "PATTERNS",
              "patternsOptions": {
                "words": ["win a free"]
              }
            },
            "action": {
              "type": "REJECT"
            },
            "enabled": true
          }
        }'
```

### Create a rule to manually approve reviews with a low rating
```curl
curl -X POST https://www.wixapis.com/moderation/v1/rules  \
    -H 'Content-Type: application/json;charset=UTF-8' \
    -H 'Authorization: <AUTH>' \
    -d '{
          "rule": {
            "namespace": "reviews/stores",
            "name": "Check for Store Review Rating",
            "audience": {
              "type": "MEMBERS_AND_VISITORS"
            },
            "trigger": {
              "type": "ATTRIBUTE",
              "attributeOptions": {
                "values": ["1", "2"],
                "name": "rating"
              }
            },
            "action": {
              "type": "NEEDS_MANUAL_APPROVAL"
            },
            "enabled": true
          }
        }'
```

---

## JavaScript SDK

### Schema

```
 Method: wixClientAdmin.moderationRules.moderationRules.createRule(rule)
 Description: Creates a rule.  You can create up to 20 rules per namespace.
 # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present.
 Required parameters:  rule, rule.namespace, rule.audience, rule.trigger, rule.action
 Method parameters: 
   param name: rule | type: Rule   | required: true 
        - name: namespace | type: string | description: The app name and entity which the rule belongs to. Currently, moderation rules support [Comments](https://dev.wix.com/docs/rest/crm/community/comments/comments/introduction.md) and [Reviews](https://dev.wix.com/docs/rest/crm/community/reviews/reviews/introduction.md):  + When the `namespace` is `comments` the format is `comments/{APP_ID}`. For example, for moderating content on Wix Blog the `namespace` is `"comments/14bcded7-0066-7c35-14d7-466cb3f09103"`. + When the `namespace` is `reviews` the format is `reviews/{APP_NAME}`. For example, for moderating content on Wix Reviews the `namespace` is `"reviews/stores"`.  To retrieve the GUID for a Wix app, see [Apps Created By Wix](https://dev.wix.com/docs/rest/articles/get-started/apps-created-by-wix.md). | required: true | validation: minLength 1, maxLength 120
        - name: name | type: string | description: Rule name.  | validation: maxLength 120
        - name: audience | type: Audience | description: Audience to which the rule applies. | required: true 
           - ONE-OF: 
              - name: newMembersOptions | type: NewMembersOptions | description: Options for new members.  **Note:** This object is relevant only when `type` is `NEW_MEMBERS`.  
                 - name: durationInHours | type: integer | description: For how many hours the member is new.  | validation: format int32
           - name: type | type: Type | description: Audience type.  
                 - enum: VISITORS, MEMBERS, MEMBERS_AND_VISITORS, NEW_MEMBERS
        - name: trigger | type: Trigger | description: A condition that triggers the rule.  **Note:** If you need to have several triggers for the same `namespace`, create separate rules. | required: true 
           - ONE-OF: 
              - name: patternsOptions | type: Patterns | description: Options for the patterns trigger.  
                 - name: words | type: array<string> | description: List of words that can trigger a rule. The `*` wildcard can be used to match a partial word. For example: - `spam`: Matches only "spam". - `spam*`: Matches "spam", "spammer", "spammy". - `*spam`: Matches "antispam", "multispam". - `sp*m`: Matches "spim", "spam", "spum".  | validation: maxItems 1000, maxLength 50
                 - name: expressions | type: array<string> | description: [Regular expressions](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_expressions).  | validation: maxItems 10, maxLength 300
              - name: contentFeaturesOptions | type: ContentFeatures | description: Options for the content features trigger.  
                 - name: videos | type: boolean | description: Whether the content contains videos.  
                 - name: images | type: boolean | description: Whether the content contains images.  
                 - name: links | type: boolean | description: Whether the content contains links.  
                 - name: attachments | type: boolean | description: Whether the content contains attachments or files.  
              - name: attributeOptions | type: Attribute | description: Options for the attributes trigger. You can only have 1 attribute per rule.  
                 - name: name | type: string | description: Attribute name.  | validation: maxLength 20
                 - name: values | type: array<string> | description: Attribute values.  | validation: maxItems 20, maxLength 20
           - name: type | type: Type | description: Trigger type.  
                 - enum:
                 -     PATTERNS: The trigger is a specific word or phrase. You can specify additional options in the `patternsOptions` object.
                 -     CONTENT_FEATURES: The rule is triggered when non-textual features, such as videos, images, links, and attachments, exist in the content. You can specify additional options in the `contentFeaturesOptions` object.
                 -     ATTRIBUTE: A custom trigger based on an attribute and its value. For example, if you'd like to check all reviews with a low rating, then `name` would be `rating`, and `values` would be `[1, 2]`. You can specify additional options in the `patternsOptions` object.
                 -     ALWAYS: There is no specific trigger. The rule is triggered whenever new content is created or existing content is updated, with no other conditions required.
        - name: exemptions | type: Exemptions | description: List of site members or groups to whom the rule doesn't apply.  
           - name: memberGroups | type: array<string> | description: List of member groups.  | validation: maxItems 50, format GUID
           - name: memberIds | type: array<string> | description: List of member GUIDs.  | validation: maxItems 50, format GUID
        - name: action | type: Action | description: What action should be taken after the rule is triggered. | required: true 
           - name: type | type: Type | description: Action type.  
                 - enum:
                 -     UNKNOWN_TYPE: 
                 -     REJECT: Reject the content without any further review.
                 -     NEEDS_MANUAL_APPROVAL: Send the content for manual review.
        - name: enabled | type: boolean | description: Whether the rule is enabled.  
        - name: extendedFields | type: ExtendedFields | description: Custom field data for the rule object.  **Note:** You must configure extended fields using schema plugin extensions in your app's dashboard before you can access the extended fields with API calls.  
           - name: namespaces | type: object | description: Extended field data. Each key corresponds to the namespace of the app that created the extended fields. The value of each key is structured according to the schema defined when the extended fields were configured.  You can only access fields for which you have the appropriate permissions.  Learn more about [extended fields](https://dev.wix.com/docs/rest/articles/getting-started/extended-fields.md).  | validation: format map
 Return type: PROMISE<Rule>
  - name: _id | type: string | description: Rule GUID.  | read-only: true | validation: format GUID
  - name: revision | type: string | description: Revision number, which increments by 1 each time the rule is updated. To prevent conflicting changes, the existing `revision` must be used when updating a rule.  | read-only: true | validation: format int64
  - name: _createdDate | type: Date | description: Date and time when the rule was created.  | read-only: true 
  - name: _updatedDate | type: Date | description: Date and time when the rule was updated.  | read-only: true 
  - name: namespace | type: string | description: The app name and entity which the rule belongs to. Currently, moderation rules support [Comments](https://dev.wix.com/docs/rest/crm/community/comments/comments/introduction.md) and [Reviews](https://dev.wix.com/docs/rest/crm/community/reviews/reviews/introduction.md):  + When the `namespace` is `comments` the format is `comments/{APP_ID}`. For example, for moderating content on Wix Blog the `namespace` is `"comments/14bcded7-0066-7c35-14d7-466cb3f09103"`. + When the `namespace` is `reviews` the format is `reviews/{APP_NAME}`. For example, for moderating content on Wix Reviews the `namespace` is `"reviews/stores"`.  To retrieve the GUID for a Wix app, see [Apps Created By Wix](https://dev.wix.com/docs/rest/articles/get-started/apps-created-by-wix.md).  | validation: minLength 1, maxLength 120
  - name: name | type: string | description: Rule name.  | validation: maxLength 120
  - name: audience | type: Audience | description: Audience to which the rule applies.  
     - ONE-OF: 
        - name: newMembersOptions | type: NewMembersOptions | description: Options for new members.  **Note:** This object is relevant only when `type` is `NEW_MEMBERS`.  
           - name: durationInHours | type: integer | description: For how many hours the member is new.  | validation: format int32
     - name: type | type: Type | description: Audience type.  
         - enum: VISITORS, MEMBERS, MEMBERS_AND_VISITORS, NEW_MEMBERS
  - name: trigger | type: Trigger | description: A condition that triggers the rule.  **Note:** If you need to have several triggers for the same `namespace`, create separate rules.  
     - ONE-OF: 
        - name: patternsOptions | type: Patterns | description: Options for the patterns trigger.  
           - name: words | type: array<string> | description: List of words that can trigger a rule. The `*` wildcard can be used to match a partial word. For example: - `spam`: Matches only "spam". - `spam*`: Matches "spam", "spammer", "spammy". - `*spam`: Matches "antispam", "multispam". - `sp*m`: Matches "spim", "spam", "spum".  | validation: maxItems 1000, maxLength 50
           - name: expressions | type: array<string> | description: [Regular expressions](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_expressions).  | validation: maxItems 10, maxLength 300
        - name: contentFeaturesOptions | type: ContentFeatures | description: Options for the content features trigger.  
           - name: videos | type: boolean | description: Whether the content contains videos.  
           - name: images | type: boolean | description: Whether the content contains images.  
           - name: links | type: boolean | description: Whether the content contains links.  
           - name: attachments | type: boolean | description: Whether the content contains attachments or files.  
        - name: attributeOptions | type: Attribute | description: Options for the attributes trigger. You can only have 1 attribute per rule.  
           - name: name | type: string | description: Attribute name.  | validation: maxLength 20
           - name: values | type: array<string> | description: Attribute values.  | validation: maxItems 20, maxLength 20
     - name: type | type: Type | description: Trigger type.  
         - enum:
         -     PATTERNS: The trigger is a specific word or phrase. You can specify additional options in the `patternsOptions` object.
         -     CONTENT_FEATURES: The rule is triggered when non-textual features, such as videos, images, links, and attachments, exist in the content. You can specify additional options in the `contentFeaturesOptions` object.
         -     ATTRIBUTE: A custom trigger based on an attribute and its value. For example, if you'd like to check all reviews with a low rating, then `name` would be `rating`, and `values` would be `[1, 2]`. You can specify additional options in the `patternsOptions` object.
         -     ALWAYS: There is no specific trigger. The rule is triggered whenever new content is created or existing content is updated, with no other conditions required.
  - name: exemptions | type: Exemptions | description: List of site members or groups to whom the rule doesn't apply.  
     - name: memberGroups | type: array<string> | description: List of member groups.  | validation: maxItems 50, format GUID
     - name: memberIds | type: array<string> | description: List of member GUIDs.  | validation: maxItems 50, format GUID
  - name: action | type: Action | description: What action should be taken after the rule is triggered.  
     - name: type | type: Type | description: Action type.  
         - enum:
         -     UNKNOWN_TYPE: 
         -     REJECT: Reject the content without any further review.
         -     NEEDS_MANUAL_APPROVAL: Send the content for manual review.
  - name: enabled | type: boolean | description: Whether the rule is enabled.  
  - name: extendedFields | type: ExtendedFields | description: Custom field data for the rule object.  **Note:** You must configure extended fields using schema plugin extensions in your app's dashboard before you can access the extended fields with API calls.  
     - name: namespaces | type: object | description: Extended field data. Each key corresponds to the namespace of the app that created the extended fields. The value of each key is structured according to the schema defined when the extended fields were configured.  You can only access fields for which you have the appropriate permissions.  Learn more about [extended fields](https://dev.wix.com/docs/rest/articles/getting-started/extended-fields.md).  | validation: format map

 Possible Errors:
   HTTP Code: 428 | Status Code: FAILED_PRECONDITION | Application Code: TOO_MANY_RULES | Description: Exceeded the limit of rules for this `namespace`.


```

### Examples

### createRule
```javascript
import { moderationRules } from '@wix/moderation-rules';

async function createRule(rule) {
  const response = await moderationRules.createRule(rule);
};
```

### createRule (with elevated permissions)
```javascript
import { moderationRules } from '@wix/moderation-rules';
import { auth } from '@wix/essentials';

async function myCreateRuleMethod(rule) {
  const elevatedCreateRule = auth.elevate(moderationRules.createRule);
  const response = await elevatedCreateRule(rule);
}
```

### createRule (self-managed)
Self-managed SDK calls require you to [create a client](https://dev.wix.com/docs/sdk/articles/work-with-the-sdk/about-the-wix-client.md).

```javascript
import { createClient } from '@wix/sdk';
import { moderationRules } from '@wix/moderation-rules';
// Import the auth strategy for the relevant access type
// Import the relevant host module if needed

const myWixClient = createClient ({
  modules: { moderationRules },
  // Include the auth strategy and host as relevant
});


async function createRule(rule) {
  const response = await myWixClient.moderationRules.createRule(rule);
};
```

---