Skip to content
Start here

Email Routing - DNS settings

client.EmailRouting.DNS.Get(ctx, params) (*DNSGetResponse, error)
GET/zones/{zone_id}/email/routing/dns

Show the DNS records needed to configure your Email Routing zone.

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 WriteZone Settings Read
ParametersExpand Collapse
params DNSGetParams
ZoneID param.Field[string]

Path param: Identifier.

maxLength32
Subdomain param.Field[string]optional

Query param: Domain of your zone.

ReturnsExpand Collapse
type DNSGetResponse interface{…}
One of the following:
type DNSGetResponseEmailEmailRoutingDNSQueryResponse struct{…}
Errors []DNSGetResponseEmailEmailRoutingDNSQueryResponseError
Code int64
minimum1000
Message string
DocumentationURL stringoptional
Source DNSGetResponseEmailEmailRoutingDNSQueryResponseErrorsSourceoptional
Pointer stringoptional
Messages []DNSGetResponseEmailEmailRoutingDNSQueryResponseMessage
Code int64
minimum1000
Message string
DocumentationURL stringoptional
Source DNSGetResponseEmailEmailRoutingDNSQueryResponseMessagesSourceoptional
Pointer stringoptional
Success DNSGetResponseEmailEmailRoutingDNSQueryResponseSuccess

Whether the API call was successful.

Result DNSGetResponseEmailEmailRoutingDNSQueryResponseResultoptional
Errors []DNSGetResponseEmailEmailRoutingDNSQueryResponseResultErroroptional
Code stringoptional
Missing DNSRecordoptional

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"
Record []DNSRecordoptional
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"
ResultInfo DNSGetResponseEmailEmailRoutingDNSQueryResponseResultInfooptional
Count float64optional

Total number of results for the requested service.

Page float64optional

Current page within paginated list of results.

PerPage float64optional

Number of results per page of results.

TotalCount float64optional

Total results available without any search parameters.

TotalPages float64optional

The number of total pages in the entire result set.

type DNSGetResponseEmailDNSSettingsResponseCollection struct{…}
Errors []DNSGetResponseEmailDNSSettingsResponseCollectionError
Code int64
minimum1000
Message string
DocumentationURL stringoptional
Source DNSGetResponseEmailDNSSettingsResponseCollectionErrorsSourceoptional
Pointer stringoptional
Messages []DNSGetResponseEmailDNSSettingsResponseCollectionMessage
Code int64
minimum1000
Message string
DocumentationURL stringoptional
Source DNSGetResponseEmailDNSSettingsResponseCollectionMessagesSourceoptional
Pointer stringoptional
Success DNSGetResponseEmailDNSSettingsResponseCollectionSuccess

Whether the API call was successful.

Result []DNSRecordoptional
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"
ResultInfo DNSGetResponseEmailDNSSettingsResponseCollectionResultInfooptional
Count float64optional

Total number of results for the requested service.

Page float64optional

Current page within paginated list of results.

PerPage float64optional

Number of results per page of results.

TotalCount float64optional

Total results available without any search parameters.

TotalPages float64optional

The number of total pages in the entire result set.

Email Routing - DNS 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.WithAPIKey("144c9defac04969c7bfad8efaa8ea194"),
    option.WithAPIEmail("user@example.com"),
  )
  dns, err := client.EmailRouting.DNS.Get(context.TODO(), email_routing.DNSGetParams{
    ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"),
  })
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", dns)
}
{
  "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": {
    "errors": [
      {
        "code": "code",
        "missing": {
          "content": "route1.mx.cloudflare.net",
          "name": "example.com",
          "priority": 12,
          "ttl": 1,
          "type": "NS"
        }
      }
    ],
    "record": [
      {
        "content": "route1.mx.cloudflare.net",
        "name": "example.com",
        "priority": 12,
        "ttl": 1,
        "type": "NS"
      }
    ]
  },
  "result_info": {
    "count": 1,
    "page": 1,
    "per_page": 20,
    "total_count": 2000,
    "total_pages": 100
  }
}
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": {
    "errors": [
      {
        "code": "code",
        "missing": {
          "content": "route1.mx.cloudflare.net",
          "name": "example.com",
          "priority": 12,
          "ttl": 1,
          "type": "NS"
        }
      }
    ],
    "record": [
      {
        "content": "route1.mx.cloudflare.net",
        "name": "example.com",
        "priority": 12,
        "ttl": 1,
        "type": "NS"
      }
    ]
  },
  "result_info": {
    "count": 1,
    "page": 1,
    "per_page": 20,
    "total_count": 2000,
    "total_pages": 100
  }
}