Skip to content
Start here

Get catch-all rule

client.EmailRouting.Rules.CatchAlls.Get(ctx, query) (*RuleCatchAllGetResponse, error)
GET/zones/{zone_id}/email/routing/rules/catch_all

Get information on the default catch-all routing rule.

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 WriteEmail Routing Rules Read
ParametersExpand Collapse
query RuleCatchAllGetParams
ZoneID param.Field[string]

Identifier.

maxLength32
ReturnsExpand Collapse
type RuleCatchAllGetResponse struct{…}
ID stringoptional

Routing rule identifier.

maxLength32
Actions []CatchAllActionoptional

List actions for the catch-all routing rule.

Type CatchAllActionType

Type of action for catch-all rule.

One of the following:
const CatchAllActionTypeDrop CatchAllActionType = "drop"
const CatchAllActionTypeForward CatchAllActionType = "forward"
const CatchAllActionTypeWorker CatchAllActionType = "worker"
Value []stringoptional
Enabled RuleCatchAllGetResponseEnabledoptional

Routing rule status.

One of the following:
const RuleCatchAllGetResponseEnabledTrue RuleCatchAllGetResponseEnabled = true
const RuleCatchAllGetResponseEnabledFalse RuleCatchAllGetResponseEnabled = false
Matchers []CatchAllMatcheroptional

List of matchers for the catch-all routing rule.

Type CatchAllMatcherType

Type of matcher. Default is ‘all’.

Name stringoptional

Routing rule name.

maxLength256
DeprecatedTag stringoptional

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

maxLength32

Get catch-all rule

package main

import (
  "context"
  "fmt"

  "github.com/cloudflare/cloudflare-go"
  "github.com/cloudflare/cloudflare-go/email_routing"
  "github.com/cloudflare/cloudflare-go/option"
)

func main() {
  client := cloudflare.NewClient(
    option.WithAPIKey("144c9defac04969c7bfad8efaa8ea194"),
    option.WithAPIEmail("user@example.com"),
  )
  catchAll, err := client.EmailRouting.Rules.CatchAlls.Get(context.TODO(), email_routing.RuleCatchAllGetParams{
    ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"),
  })
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", 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"
  }
}