Skip to content
Start here

Apply Email Routing settings

client.EmailRouting.Update(ctx, params) (*Settings, error)
PUT/zones/{zone_id}/email/routing

Apply the provided settings to your Email Routing zone. Omitted settings retain their current values, as with PATCH.

Security
API Token

The preferred authorization scheme for interacting with the Cloudflare API. Create a token.

Example:Authorization: Bearer Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY
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)
Zone Settings Write
ParametersExpand Collapse
params EmailRoutingUpdateParams
ZoneID param.Field[string]

Path param: Identifier.

maxLength32
Enabled param.Field[EmailRoutingUpdateParamsEnabled]Optional

Body param: State of your zone Email Routing settings. No-op on this endpoint - use POST/DELETE /zones/{zone_id}/email/routing/dns.

const EmailRoutingUpdateParamsEnabledTrue EmailRoutingUpdateParamsEnabled = true
const EmailRoutingUpdateParamsEnabledFalse EmailRoutingUpdateParamsEnabled = false
SkipWizard param.Field[EmailRoutingUpdateParamsSkipWizard]Optional

Body param: Flag to check if the user skipped the configuration wizard.

const EmailRoutingUpdateParamsSkipWizardTrue EmailRoutingUpdateParamsSkipWizard = true
const EmailRoutingUpdateParamsSkipWizardFalse EmailRoutingUpdateParamsSkipWizard = false
SupportSubaddress param.Field[EmailRoutingUpdateParamsSupportSubaddress]Optional

Body param: Whether subaddressing (plus-addressing) is honored when matching incoming mail against routing rules.

const EmailRoutingUpdateParamsSupportSubaddressTrue EmailRoutingUpdateParamsSupportSubaddress = true
const EmailRoutingUpdateParamsSupportSubaddressFalse EmailRoutingUpdateParamsSupportSubaddress = false
ReturnsExpand Collapse
type Settings struct{…}
ID string

Email Routing settings identifier.

maxLength32
Enabled SettingsEnabled

State of the zone settings for Email Routing.

One of the following:
const SettingsEnabledTrue SettingsEnabled = true
const SettingsEnabledFalse SettingsEnabled = false
Name string

Domain of your zone.

Created TimeOptional

The date and time the settings have been created.

formatdate-time
Modified TimeOptional

The date and time the settings have been modified.

formatdate-time
SkipWizard SettingsSkipWizardOptional

Flag to check if the user skipped the configuration wizard.

One of the following:
const SettingsSkipWizardTrue SettingsSkipWizard = true
const SettingsSkipWizardFalse SettingsSkipWizard = false
Status SettingsStatusOptional

Show the state of your account, and the type or configuration error.

One of the following:
const SettingsStatusReady SettingsStatus = "ready"
const SettingsStatusUnconfigured SettingsStatus = "unconfigured"
const SettingsStatusMisconfigured SettingsStatus = "misconfigured"
const SettingsStatusMisconfiguredLocked SettingsStatus = "misconfigured/locked"
const SettingsStatusUnlocked SettingsStatus = "unlocked"
SupportSubaddress SettingsSupportSubaddressOptional

Whether subaddressing (plus-addressing) is honored when matching incoming mail against routing rules.

One of the following:
const SettingsSupportSubaddressTrue SettingsSupportSubaddress = true
const SettingsSupportSubaddressFalse SettingsSupportSubaddress = false
DeprecatedTag stringOptional

Email Routing settings tag. (Deprecated, replaced by Email Routing settings identifier)

maxLength32

Apply Email Routing settings

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.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"),
  )
  settings, err := client.EmailRouting.Update(context.TODO(), email_routing.EmailRoutingUpdateParams{
    ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"),
  })
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", settings.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": "75610dab9e69410a82cf7e400a09ecec",
    "enabled": true,
    "name": "example.net",
    "created": "2014-01-02T02:20:00Z",
    "modified": "2014-01-02T02:20:00Z",
    "skip_wizard": true,
    "status": "ready",
    "support_subaddress": true,
    "tag": "75610dab9e69410a82cf7e400a09ecec"
  }
}
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": "75610dab9e69410a82cf7e400a09ecec",
    "enabled": true,
    "name": "example.net",
    "created": "2014-01-02T02:20:00Z",
    "modified": "2014-01-02T02:20:00Z",
    "skip_wizard": true,
    "status": "ready",
    "support_subaddress": true,
    "tag": "75610dab9e69410a82cf7e400a09ecec"
  }
}