Skip to content
Start here

Disable Email Routing

client.EmailRouting.DNS.Delete(ctx, body) (*SinglePage[DNSRecord], error)
DELETE/zones/{zone_id}/email/routing/dns

Disable your Email Routing zone. Also removes additional MX records previously required for Email Routing to work.

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)
Zone Settings Write
ParametersExpand Collapse
body DNSDeleteParams
ZoneID param.Field[string]

Identifier.

maxLength32
ReturnsExpand Collapse
type DNSRecord struct{…}

List of records needed to enable an Email Routing zone.

Content stringoptional

DNS record content.

Name stringoptional

DNS record name (or @ for the zone apex).

maxLength255
Priority float64optional

Required for MX, SRV and URI records. Unused by other record types. Records with lower priorities are preferred.

maximum65535
minimum0
TTL DNSRecordTTLoptional

Time to live, in seconds, of the DNS record. Must be between 60 and 86400, or 1 for 'automatic'.

One of the following:
float64
type DNSRecordTTL float64

Time to live, in seconds, of the DNS record. Must be between 60 and 86400, or 1 for 'automatic'.

Type DNSRecordTypeoptional

DNS record type.

One of the following:
const DNSRecordTypeA DNSRecordType = "A"
const DNSRecordTypeAAAA DNSRecordType = "AAAA"
const DNSRecordTypeCNAME DNSRecordType = "CNAME"
const DNSRecordTypeHTTPS DNSRecordType = "HTTPS"
const DNSRecordTypeTXT DNSRecordType = "TXT"
const DNSRecordTypeSRV DNSRecordType = "SRV"
const DNSRecordTypeLOC DNSRecordType = "LOC"
const DNSRecordTypeMX DNSRecordType = "MX"
const DNSRecordTypeNS DNSRecordType = "NS"
const DNSRecordTypeCERT DNSRecordType = "CERT"
const DNSRecordTypeDNSKEY DNSRecordType = "DNSKEY"
const DNSRecordTypeDS DNSRecordType = "DS"
const DNSRecordTypeNAPTR DNSRecordType = "NAPTR"
const DNSRecordTypeSMIMEA DNSRecordType = "SMIMEA"
const DNSRecordTypeSSHFP DNSRecordType = "SSHFP"
const DNSRecordTypeSVCB DNSRecordType = "SVCB"
const DNSRecordTypeTLSA DNSRecordType = "TLSA"
const DNSRecordTypeURI DNSRecordType = "URI"

Disable Email Routing

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"),
  )
  page, err := client.EmailRouting.DNS.Delete(context.TODO(), email_routing.DNSDeleteParams{
    ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"),
  })
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", page)
}
{
  "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
}
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
}