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

# update_mail_rule

> Modify an existing mail rule — rename, enable/disable, or replace its conditions or actions — while keeping its id.

Updates an existing rule in place, preserving its identity: the `ruleId` and creation time stay stable, `modified` is bumped. Only the provided fields change; `conditions` and `actions` replace the current ones **wholesale** when given. Optionally applies the updated rule to existing mail with the same policy (and large-backfill confirmation) as [`create_mail_rule`](/reference/mcp/create-mail-rule).

## Parameters

<ParamField body="ruleId" type="string" required>
  The rule's id, as returned by `create_mail_rule` or listed by [`list_mail_rules`](/reference/mcp/list-mail-rules).
</ParamField>

<ParamField body="name" type="string">New name.</ParamField>
<ParamField body="enabled" type="boolean">Enable (`true`) or pause (`false`) the rule without deleting it.</ParamField>
<ParamField body="match" type="string">New condition combinator: `"all"` or `"any"`.</ParamField>
<ParamField body="conditions" type="object">Replacement conditions (at least one when given).</ParamField>
<ParamField body="actions" type="array">Replacement ordered action list.</ParamField>
<ParamField body="existingMail" type="object">Optionally apply the updated rule to existing mail (`mode`, `scope`, `confirmLargeApply`) after saving.</ParamField>

## Example

```json Call theme={null}
{
  "ruleId": "rule-3f8a1c2e",
  "actions": [
    { "type": "archive" },
    { "type": "addTag", "tag": "GitHub" },
    { "type": "markRead" }
  ]
}
```

```text Result theme={null}
Mail rule updated:

1. [rule-3f8a1c2e] Archive GitHub Notifications
   when ALL of: sender contains "notifications@github.com"
   then: archive, then add tag "github", then mark as read
   created: 2026-07-20T09:00:00.000Z, modified: 2026-07-22T12:00:00.000Z
```

## Errors

* `No mail rule with id <ruleId>. Use list_mail_rules to see the current rules and ids.`
* A denied large backfill updates **nothing** — re-call with `existingMail.confirmLargeApply: true` after confirming with the user.
