> For the complete documentation index, see [llms.txt](https://docs.lassomoderation.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.lassomoderation.com/custom-moderation-rules.md).

# Custom Moderation Rules

Custom moderation rules automate moderation on the Lasso platform. Each rule combines a set of conditions with one or more actions. When a piece of content or a user matches all of a rule's conditions, Lasso applies the rule's actions, without a moderator having to look at it first.

> **Note**: Some of the conditions and actions described on this page are not available by default and can be enabled on request. If you don't see one in your dashboard, contact us.

There are three types of rules:

* **Content rules**: run on incoming content (messages, images, videos, audio). They can use both content conditions and conditions about the user who posted the content.
* **User rules**: run on users. They can use user conditions, such as signup date, reports received or content volume.
* **Routing queue rules**: decide which review queue a flagged item goes to. They can use review conditions (priority, policy, review type) as well as user and content conditions.

<figure><img src="/files/GefO8dDzpDvFUP49UicI" alt="An example of a rule targeting images containing nudity"><figcaption><p>An example of a rule targeting images containing nudity</p></figcaption></figure>

### Anatomy of a rule

A rule consists of:

* **Name**: identifies the rule in the dashboard.
* **Notes** (optional): a short explanation of what the rule is for. Helpful when your team maintains many rules.
* **Conditions**: the criteria that must be met. A rule matches only when *all* of its conditions are met (they are combined with AND). To express an OR, create a separate rule.
* **Actions**: what happens when the rule matches. See Actions below.
* **Enabled / Disabled**: the rule is only evaluated when enabled. New and imported rules start disabled, so you can review them before they take effect.

### How rules are evaluated

Rules are evaluated from top to bottom, in the order shown in the rules list. You can drag rules to reorder them, and order matters:

* When a rule's action is **allow** or **remove/ban**, a match stops evaluation. Rules below it are not evaluated for that item.
* When a rule's action is **flag**, evaluation continues. Multiple flagging rules can match the same item, and each can add its own policy, tags and priority.
* A rule that has already been applied to an item is not applied again.
* Decisions made by a human moderator take precedence. If a moderator has removed an item, rules will not overrule that decision.

For routing queue rules, the first matching rule wins and determines the queue.

#### Confirming a rule before it goes live

When you enable or update a rule, Lasso shows a confirmation step that previews how the rule would have matched against your recent content or users, including match counts and percentages. This lets you catch a rule that matches far more (or less) than you intended before it starts taking action.

### Actions

Actions run when all conditions are met.

* **Change status**: the core action of every content and user rule. Sets the item's moderation status to **allowed**, **flagged** or **removed** (for users: **banned**). The exact wording of these statuses can be customized per dashboard.
* **Policy category**: categorizes the action under one of your policies. This is how you track which policy an automated action was taken under, and it is included in webhooks and analytics. Depending on your dashboard settings, a policy can be required for flag/remove actions. You can also add extra policy information as free text.
* **Priority**: shown when the action is *flag*. Sets the review priority of the flagged item: urgent, high, medium (default), low or very low. Routing queue rules can use this priority to route items to different queues.
* **Strike user**: give the user a strike as part of the action. Two variants:
  * **Strike**: adds a strike only if the user has no active strike yet.
  * **Add strike**: always adds a strike, even if the user already has one.
* **Add tags**: add tags to the content and/or the user when the rule matches. Useful for building segments, filtering queues, or feeding follow-up rules that use the *Content tags* / *User tags* conditions.
* **Hide all content** (user rules with a *ban* action): when a user is banned by the rule, all of their existing content is removed as well. You can select a separate policy category for the removed content.
* **Route to queue** (routing queue rules): sends matching items to the selected review queue.

Rule actions trigger the same webhooks as manual moderator actions, so your platform is notified of status changes, strikes and tag updates made by rules.

### Conditions

A rule can have one or more conditions, and conditions from different groups can be combined. For example, to catch potential spam you can combine *Signed up* (in the last 10 minutes) with *User's content volume* (more than 20 messages).

<figure><img src="/files/XsyQBxFP4ZSVnrsjsNQT" alt=""><figcaption><p>Example of a set of conditions targeting recently signed up users that have sent over 20 flagged or removed messages</p></figcaption></figure>

Every condition below lists what it checks and the options you can configure.

#### Text conditions

* **Text**: matches words, phrases, URLs, phone numbers or email addresses in the text. Lasso also extracts text from images, videos and audio, and you choose which of these sources the condition applies to. Matching options:

  * **Contains any word / not contains any word**: matches when the text contains one of your word list entries as a whole word, bounded by spaces, punctuation or the start/end of the text. The list entry "ball" matches "nice ball!" but not "football" or "ballroom". Use this for words that are only a problem on their own: an entry like "ass" won't match "class" or "grass". List entries can also be phrases containing spaces or special characters, such as "free money" or "sh\*t", and these match as a whole phrase.
  * **Contains part of any word / not contains part of any word**: matches when a list entry appears anywhere in the text, including inside longer words. The list entry "ball" also matches "football" and "ballroom". This casts a wider net and is harder to evade with creative spelling, but pick entries with care: short entries can match inside innocent words.
  * **Contains at least X words** and **contains part of any word at least X times**: like the above, but the item must contain a minimum number of (partial) matches. Useful for tolerating a single borderline word while catching repeated use.
  * **Contains regex**: matches patterns from one of your regex lists, for advanced cases that word lists can't express.
  * **Contains a URL / contains any URL / not contains any URL**: detect any link, or match links against one of your domain lists (for example an allowlist of your own domains).
  * **Contains a phone number / contains any phone number / not contains any phone number**: detect any phone number, or match against a phone number list.
  * **Contains an email / not contains an email**: detect email addresses in the text.

  Word matching is case-insensitive. Lasso also matches against a normalized version of the text: accents and look-alike characters are converted to their plain equivalents (for example "bäll", or a Cyrillic "а" styled to look like a Latin "a") and invisible characters are stripped, so common tricks to sneak words past a filter still match.
* **Text length**: the number of characters in the text, longer or shorter than a value you set. For example, flag messages over 300 characters to catch copy-paste spam.
* **Special characters in text**: the number of special characters (anything that is not a letter, number or space). Useful against zalgo text, ASCII art and other obfuscation.
* **Duplicate messages**: matches when the same user has sent the same exact text a minimum number of times within the recent period. A classic spam signal.
* **Language**: the detected language of the text, is (or is not) in a list of languages you select. For example, flag content in languages your moderation team doesn't cover.
* **AI scores**: Lasso's toxicity analysis of the text. Choose a score type (toxicity, threat, identity attack or profanity) and a minimum likelihood (0-100%). For example, remove content with a toxicity score of at least 90%, and flag content with a score of at least 50%.
* **Custom AI scores**: scores from your own custom AI text models. Depending on the model, you either set a minimum likelihood (0-100%) or match on the model's binary outcome (*is a violation* / *is not a violation*).
* **Topic**: the topic assigned to the content is (or is not) in a set of topics you select.

#### Image conditions

* **Image labels**: moderation labels (nudity, violence, drugs, weapons, etc.) that Lasso's AI detects in images. Select one or more labels and a minimum likelihood (0-100%). For example, remove images that are at least 80% likely to contain explicit nudity, and flag from 50%.
* **Custom AI scores (images)**: scores from your own custom AI image models, with a minimum likelihood.
* **Custom image labels**: images do (or do not) contain one of your custom-trained labels, with a minimum likelihood.
* **Image type**: the image's file type is (or is not) in a set you select, for example to treat GIFs differently from photos.
* **Similar images**: the image is the same as, very similar to, or somewhat similar to images that were previously removed, or images posted by banned users. When a moderator removes an image, this condition lets a rule automatically catch reposts of it, including slightly edited versions.
* **Number of people in image(s)**: how many people are detected in the image, compared to a number you set. For example, on a profile photo, require exactly one person.
* **Content's age range**: the estimated age of people in the image, compared to the user's own age or to a custom age you set. For example, flag profile photos where the estimated age is below the user's registered age.
* **QR code**: the image does (or does not) contain a QR code. QR codes are a common way to smuggle links past text filters.
* **Face recognition**: whether all faces in the image match the user's verified photo. Useful for profile photo verification flows.
* **Face close-up**: whether the image is (or is not) a close-up of a face.
* **Celebrity**: the image does (or does not) contain a recognized public figure, with a minimum confidence. Helps catch impersonation and fake accounts using celebrity photos.
* **CSAM**: the image matches (or does not match) known CSAM via industry hash-matching.

#### Video conditions

* **Video labels**: moderation labels detected in videos (similar to image labels), with a minimum likelihood.

#### General content conditions

* **Content type**: the content has text, image(s), video(s) or audio. Best combined with other conditions, for example: flag all images posted by users who signed up within the last day.
* **Project**: the project the content belongs to is (or is not) in a set you select, so you can apply stricter rules to specific projects. (This condition uses whatever name you have given projects in your dashboard, for example "Category" or "Room".)
* **Content tags**: the content's tags are (or are not) in a set you select. Combine with the *Add tags* action to build multi-step rule flows.

#### Report conditions

Available for both content and users:

* **# of times reported**: how often the item or user has been reported. You can count unique reporters or total reports, over all time or within a period, and filter by the type of user who reported (normal user, trusted user, moderator, admin). For example, remove content reported by 3 or more unique users within 24 hours.
* **Reported by**: the type of user the report came from, is (or is not) one of: normal, trusted, moderator, admin. A report from a moderator can be trusted more than one from a normal user, so you can act on it immediately.

User rules only:

* **# of reports made**: the number of reports the user has made, compared to a number you set. Useful for catching users who mass-report others in bad faith.

#### User conditions

These can be used in user rules, and in content rules to check the user who posted the content:

* **Name**: the user's name, with the same matching options as the *Text* condition (word lists, partial matches, regex). For example, flag users with offensive words in their name.
* **Status**: the user's moderation status is (or is not) allowed, flagged or banned. For example, flag all content posted by currently flagged users.
* **Type**: the user's type is (or is not) one of: normal, trusted, moderator, admin, testing. For example, skip moderation for your own moderators and admins.
* **Signed up**: how long ago the user signed up (more or less than a number of seconds, minutes, hours, days or weeks). New accounts are riskier, so many spam rules start here.
* **Signup method**: how the user signed up (email, phone, Google, Facebook, Apple, Twitter, etc.). Users signing up through SSO are less often spammers, so you could allow them without review.
* **Email domain**: the user's email domain, matched against one of your domain lists. For example, flag signups from disposable email domains.
* **Location (country)**: the user's country is (or is not) in one of your location lists.
* **IP address**: the user's IP address is (or is not) in one of your IP lists.
* **Profile image**: the user does (or does not) have a profile image. Accounts without one are more often fake, so this combines well with other signals.
* **Number of strikes**: the user's strike count, compared to a number you set. For example, ban users who reach 3 strikes.
* **User tags**: the user's tags are (or are not) in a set you select.
* **User's project**: the project the user belongs to is (or is not) in a set you select.
* **User's content volume**: how much content the user has posted. Choose what to count (messages, images, videos, or all content), which moderation statuses to include, a comparison and number, and whether to count in total or within a period (up to 30 days). For example, flag users with more than 5 removed messages in the last 7 days.\* **Topic volume**: like content volume, but counted per topic. For example, flag users who posted more than 10 items in a sensitive topic.

#### Review conditions (routing queue rules)

Routing queue rules can additionally match on properties of the review itself:

* **Priority**: the review priority is (or is not) urgent, high, medium, low or very low. For example, route urgent items to a dedicated queue.
* **Review type**: the item under review is content or a user.
* **Policy category**: the policy the item was flagged under is (or is not) in a set you select. For example, route everything flagged under your child safety policy to a specialist queue.

#### Custom attribute conditions

Any custom attributes you send with your content or users show up as conditions automatically, named after the attribute. The available options depend on the attribute's type:

* **Number**: compared to a threshold (greater than, at least, less than, at most). For example, flag marketplace listings with a price above 10,000.
* **Text**: the same matching options as the *Text* condition, including your word lists.
* **True/false**: the attribute is true or is false. For example, only apply a rule when `is_verified` is false.
* **Choice (enum)**: the value is (or is not) in a set of the attribute's possible values.

See [Custom attributes](/custom-attributes.md) for how to send these with your content and users.
