---
title: "Update an email rule"
method: PATCH
path: "/v1/email-rules/{rule_id}"
tags: ["Email"]
---

# Update an email rule

`PATCH /v1/email-rules/{rule_id}`

## Request

- Base URL: `https://api-eu.dynamicdocumentapi.com`
- URL: `https://api-eu.dynamicdocumentapi.com/v1/email-rules/{rule_id}`
- Auth: one of:
  - HTTP bearer
  - API key in header `X-API-Key`

Partial update; changing `position` moves the others. Switching a rule off (`enabled: false`) also cancels its emails that were not sent yet. Below the Growth plan, or while email delivery isn't enabled for the workspace, an update may only switch the rule off.

## Path parameters

- `rule_id` string, required

## Request body

- PatchedEmailRuleWrite
  - `attach_formats` string[]: Only files of these formats; empty = every file.
  - `attachments` 'attach_or_link' | 'attach' | 'link' | 'none': * `attach_or_link` - Attach Or Link * `attach` - Attach * `link` - Link * `none` - None
  - `bcc` string, nullable
  - `cc` string, nullable
  - `condition` string, nullable: An expression; the rule sends when it is true. Empty = always.
  - `connection_id` string: `emc_…` of this workspace.
  - `enabled` boolean
  - `from_email` string, nullable: Literal; empty = the connection's default sender. One the provider hasn't verified is saved with the warning `email_sender_unverified`.
  - `from_name` string, nullable: Template source; one line after rendering.
  - `html` string, nullable: Template source, values HTML-escaped (≤ 256 KiB).
  - `name` string
  - `position` integer: 0 to 4; the others move. Default: the end.
  - `provider_template` EmailProviderTemplate
    - `id` integer, required: The template's id in the Brevo account.
    - `params` string, required: Template source that must render to a JSON object (≤ 64 KiB).
  - `reply_to` string, nullable: Template source; one line after rendering.
  - `subject` string, nullable: Template source; required unless a provider template gives it.
  - `text` string, nullable: Template source; empty = derived from `html`.
  - `to` string, nullable: Template source rendering to addresses separated by `,` `;` or line breaks.

## Response `200`

- EmailRule
  - `attach_formats` string[], required
  - `attachments` 'attach_or_link' | 'attach' | 'link' | 'none', required: * `attach_or_link` - Attach Or Link * `attach` - Attach * `link` - Link * `none` - None
  - `bcc` string, required
  - `cc` string, required
  - `condition` string, required
  - `connection_id` string, required
  - `created_at` string, date-time, required
  - `enabled` boolean, required
  - `from_email` string, nullable, required: null = the connection's default sender.
  - `from_name` string, required
  - `html` string, required
  - `id` string, required: `emr_…`
  - `name` string, required
  - `object` string
  - `position` integer, required: 0 to 4: the order the template's rules send in.
  - `provider_template` EmailProviderTemplate, required
    - `id` integer, required: The template's id in the Brevo account.
    - `params` string, required: Template source that must render to a JSON object (≤ 64 KiB).
  - `reply_to` string, required
  - `subject` string, required
  - `template_id` string, required
  - `text` string, required
  - `to` string, required
  - `updated_at` string, date-time, required
  - `warnings` EmailRuleWarning[]: On create and update responses.
    - `code` string, required: `email_sender_unverified`
    - `message` string, required
    - `path` string, required

## Other responses

- `400`: Invalid request body (`errors[]` with JSON pointers).
- `401`: Missing, invalid, expired or revoked credentials.
- `402`: Email delivery needs the Growth plan or higher (`plan_feature_unavailable`).
- `403`: Insufficient scope, IP not allowed, workspace suspended or scheduled for deletion, or email not verified; or `feature_not_enabled`: email delivery isn't enabled for this workspace yet.
- `404`: Email rule not found.
- `422`: A field does not compile (`email_template_error`).
- `429`: Rate limited (`Retry-After`).
- `503`: The control plane is unreachable (`Retry-After`).

---

[API](https://skmtc.dev/dynamicdocumentapi/apis/dynamic-document-api.md) · [All operations](https://skmtc.dev/dynamicdocumentapi/apis/dynamic-document-api/llms.txt) · [OpenAPI document](https://skmtc.dev/dynamicdocumentapi/apis/dynamic-document-api/revisions/0f14bc0000f4?raw)
