Skip to content
Start here

Update catch-all rule

client.emailRouting.rules.catchAlls.update(CatchAllUpdateParams { zone_id, actions, matchers, 2 more } params, RequestOptionsoptions?): CatchAllUpdateResponse { id, actions, enabled, 3 more }
PUT/zones/{zone_id}/email/routing/rules/catch_all

Enable or disable catch-all routing rule, or change action to forward to specific destination address. Forward actions require all destination addresses to be verified.

Security

API Email + API Key

The previous authorization scheme for interacting with the Cloudflare API, used in conjunction with a Global API key.

Example:X-Auth-Email: user@example.com

The previous authorization scheme for interacting with the Cloudflare API. When possible, use API tokens instead of Global API keys.

Example:X-Auth-Key: 144c9defac04969c7bfad8efaa8ea194
Accepted Permissions (at least one required)
Email Routing Rules Write
ParametersExpand Collapse
params: CatchAllUpdateParams { zone_id, actions, matchers, 2 more }
zone_id: string

Path param: Identifier.

maxLength32
actions: Array<CatchAllAction { type, value } >

Body param: List actions for the catch-all routing rule.

type: "drop" | "forward" | "worker"

Type of action for catch-all rule.

One of the following:
"drop"
"forward"
"worker"
value?: Array<string>
matchers: Array<CatchAllMatcher { type } >

Body param: List of matchers for the catch-all routing rule.

type: "all"

Type of matcher. Default is ‘all’.

enabled?: true | false

Body param: Routing rule status.

One of the following:
true
false
name?: string

Body param: Routing rule name.

maxLength256
ReturnsExpand Collapse
CatchAllUpdateResponse { id, actions, enabled, 3 more }
id?: string

Routing rule identifier.

maxLength32
actions?: Array<CatchAllAction { type, value } >

List actions for the catch-all routing rule.

type: "drop" | "forward" | "worker"

Type of action for catch-all rule.

One of the following:
"drop"
"forward"
"worker"
value?: Array<string>
enabled?: true | false

Routing rule status.

One of the following:
true
false
matchers?: Array<CatchAllMatcher { type } >

List of matchers for the catch-all routing rule.

type: "all"

Type of matcher. Default is ‘all’.

name?: string

Routing rule name.

maxLength256
Deprecatedtag?: string

Routing rule tag. (Deprecated, replaced by routing rule identifier)

maxLength32

Update catch-all rule

import Cloudflare from 'cloudflare';

const client = new Cloudflare({
  apiEmail: process.env['CLOUDFLARE_EMAIL'], // This is the default and can be omitted
  apiKey: process.env['CLOUDFLARE_API_KEY'], // This is the default and can be omitted
});

const catchAll = await client.emailRouting.rules.catchAlls.update({
  zone_id: '023e105f4ecef8ad9ca31a8372d0c353',
  actions: [{ type: 'forward' }],
  matchers: [{ type: 'all' }],
});

console.log(catchAll.id);
{
  "errors": [
    {
      "code": 1000,
      "message": "message",
      "documentation_url": "documentation_url",
      "source": {
        "pointer": "pointer"
      }
    }
  ],
  "messages": [
    {
      "code": 1000,
      "message": "message",
      "documentation_url": "documentation_url",
      "source": {
        "pointer": "pointer"
      }
    }
  ],
  "success": true,
  "result": {
    "id": "a7e6fb77503c41d8a7f3113c6918f10c",
    "actions": [
      {
        "type": "forward",
        "value": [
          "destinationaddress@example.net"
        ]
      }
    ],
    "enabled": true,
    "matchers": [
      {
        "type": "all"
      }
    ],
    "name": "Send to user@example.net rule.",
    "tag": "a7e6fb77503c41d8a7f3113c6918f10c"
  }
}
Returns Examples
{
  "errors": [
    {
      "code": 1000,
      "message": "message",
      "documentation_url": "documentation_url",
      "source": {
        "pointer": "pointer"
      }
    }
  ],
  "messages": [
    {
      "code": 1000,
      "message": "message",
      "documentation_url": "documentation_url",
      "source": {
        "pointer": "pointer"
      }
    }
  ],
  "success": true,
  "result": {
    "id": "a7e6fb77503c41d8a7f3113c6918f10c",
    "actions": [
      {
        "type": "forward",
        "value": [
          "destinationaddress@example.net"
        ]
      }
    ],
    "enabled": true,
    "matchers": [
      {
        "type": "all"
      }
    ],
    "name": "Send to user@example.net rule.",
    "tag": "a7e6fb77503c41d8a7f3113c6918f10c"
  }
}