> ## Documentation Index
> Fetch the complete documentation index at: https://docs.redbark.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Rules

> Skip, recategorise, rename, and annotate transactions before they reach a destination

Rules run on every transaction during a sync, before it is written to the destination. Each rule pairs a set of conditions with one action: skip the transaction, email you about it, or transform what gets written.

Rules live in **rulesets**: named, reusable lists of up to 50 rules. Build a ruleset once on the **Rules** page, then attach it to a sync from the sync's **Rules** tab. Rules run in order; drag to reorder.

## Conditions

A rule matches when any condition group matches, and a group matches when all of its conditions do (OR across groups, AND within a group).

Conditions can test:

| Field                      | Notes                                                                         |
| -------------------------- | ----------------------------------------------------------------------------- |
| Merchant                   | The cleaned merchant name                                                     |
| Description                | The raw bank description                                                      |
| Amount                     | Compared without sign, so one rule covers debits and credits                  |
| Signed amount              | Keeps the sign; `less than 0` matches only debits reported as negative        |
| Direction                  | Credit or debit                                                               |
| Category                   | Your [custom category](/categories) when one resolves, else the bank category |
| Subcategory                | The bank's more specific category, e.g. `FOOD_AND_DRINK_GROCERIES`            |
| Category group             | The group your resolved category belongs to                                   |
| Class                      | Payment, transfer, fee, interest, or other                                    |
| Account / Account name     | Pick an account, or match on its name                                         |
| Reference                  | The payment reference                                                         |
| Merchant category code     | The card network MCC, e.g. `5411` for grocery stores                          |
| Currency                   | ISO code, e.g. `AUD`                                                          |
| Day of month / Day of week | Derived from the posting date in the account's timezone                       |

String fields support `contains`, `equals`, `starts with`, `ends with`, pattern matching (`*` and `?` wildcards, e.g. `SQ *`), emptiness checks, and list membership. Numeric fields support greater than, less than, equals, and between.

## Actions

| Action                  | Effect                                                                                                                      |
| ----------------------- | --------------------------------------------------------------------------------------------------------------------------- |
| Skip transaction        | The transaction is never written. Applies to new rows only; corrections to rows already in the destination still go through |
| Send email notification | The transaction is written, and you get a digest email after the run. Each transaction notifies once, not on every re-sync  |
| Set category            | Overwrites the custom category                                                                                              |
| Set category group      | Overwrites the custom category group                                                                                        |
| Clear category          | Removes the custom category and group, so the raw bank category shows                                                       |
| Set merchant            | Overwrites the merchant name, everywhere including the YNAB payee                                                           |
| Set description         | Overwrites the description, everywhere                                                                                      |
| Set note                | Writes a Note column                                                                                                        |
| Add tag                 | Adds to a Tags column; multiple tag rules stack                                                                             |

When several transform rules match one transaction, the first rule (in order) wins each field. A matching skip rule stops evaluation.

### Placeholders

Merchant, description, note, and tag values can include placeholders, filled in from the transaction before any transforms apply: `{merchant}`, `{description}`, `{category}`, `{subcategory}`, `{amount}`, `{account}`, `{reference}`, `{date}`. For example, a note of `Review: {merchant} on {date}`.

## Where the outputs land

Category actions write the same `Custom Category` and `Custom Category Group` fields as [custom categories](/categories), on Google Sheets, Notion, and Webhook destinations. Notes and tags get their own fields:

| Surface                            | Fields                             |
| ---------------------------------- | ---------------------------------- |
| [Google Sheets](/google-sheets)    | Trailing `Note` and `Tags` columns |
| [Notion](/notion)                  | `Note` and `Tags` properties       |
| [Airtable](/airtable)              | `Note` and `Tags` fields           |
| [Webhook](/api-reference/webhooks) | `note` and `tags` payload fields   |

The columns only appear once the sync has a note or tag rule attached, and the sync must have **Include custom categories** switched on ([the same toggle](/categories#enabling-on-a-sync) that gates the category columns). YNAB has no note or tag fields.

Merchant and description changes apply on every destination.

## Suggestions

When you correct categories or merchant names directly in your destination, the **Suggestions** tab on the sync picks up repeated corrections and offers to turn each one into a rule. Accepting creates the rule in the sync's ruleset; future syncs apply it automatically.

## Rules and the API

Rulesets, rules, previews, and attachment are all available over the [REST API](/api-reference/v2/rules), including a dry-run preview endpoint that shows what a ruleset would do to recent transactions without writing anything.
