Skip to content
Start here

Email Routing - DNS settings

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
Path ParametersExpand Collapse
zone_id: string

Identifier.

maxLength32
Query ParametersExpand Collapse
subdomain: optional string

Domain of your zone.

ReturnsExpand Collapse
EmailEmailRoutingDNSQueryResponse = object { errors, messages, success, 2 more }
errors: array of object { code, message, documentation_url, source }
code: number
minimum1000
message: string
documentation_url: optional string
source: optional object { pointer }
pointer: optional string
messages: array of object { code, message, documentation_url, source }
code: number
minimum1000
message: string
documentation_url: optional string
source: optional object { pointer }
pointer: optional string
success: true

Whether the API call was successful.

result: optional object { errors, record }
errors: optional array of object { code, missing }
code: optional string
missing: optional DNSRecord { content, name, priority, 2 more }

List of records needed to enable an Email Routing zone.

content: optional string

DNS record content.

name: optional string

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

maxLength255
priority: optional number

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

maximum65535
minimum0
ttl: optional number or 1

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

One of the following:
number
1

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

type: optional "A" or "AAAA" or "CNAME" or 15 more

DNS record type.

One of the following:
"A"
"AAAA"
"CNAME"
"HTTPS"
"TXT"
"SRV"
"LOC"
"MX"
"NS"
"CERT"
"DNSKEY"
"DS"
"NAPTR"
"SMIMEA"
"SSHFP"
"SVCB"
"TLSA"
"URI"
record: optional array of DNSRecord { content, name, priority, 2 more }
content: optional string

DNS record content.

name: optional string

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

maxLength255
priority: optional number

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

maximum65535
minimum0
ttl: optional number or 1

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

One of the following:
number
1

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

type: optional "A" or "AAAA" or "CNAME" or 15 more

DNS record type.

One of the following:
"A"
"AAAA"
"CNAME"
"HTTPS"
"TXT"
"SRV"
"LOC"
"MX"
"NS"
"CERT"
"DNSKEY"
"DS"
"NAPTR"
"SMIMEA"
"SSHFP"
"SVCB"
"TLSA"
"URI"
result_info: optional object { count, page, per_page, 2 more }
count: optional number

Total number of results for the requested service.

page: optional number

Current page within paginated list of results.

per_page: optional number

Number of results per page of results.

total_count: optional number

Total results available without any search parameters.

total_pages: optional number

The number of total pages in the entire result set.

EmailDNSSettingsResponseCollection = object { errors, messages, success, 2 more }
errors: array of object { code, message, documentation_url, source }
code: number
minimum1000
message: string
documentation_url: optional string
source: optional object { pointer }
pointer: optional string
messages: array of object { code, message, documentation_url, source }
code: number
minimum1000
message: string
documentation_url: optional string
source: optional object { pointer }
pointer: optional string
success: true

Whether the API call was successful.

result: optional array of DNSRecord { content, name, priority, 2 more }
content: optional string

DNS record content.

name: optional string

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

maxLength255
priority: optional number

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

maximum65535
minimum0
ttl: optional number or 1

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

One of the following:
number
1

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

type: optional "A" or "AAAA" or "CNAME" or 15 more

DNS record type.

One of the following:
"A"
"AAAA"
"CNAME"
"HTTPS"
"TXT"
"SRV"
"LOC"
"MX"
"NS"
"CERT"
"DNSKEY"
"DS"
"NAPTR"
"SMIMEA"
"SSHFP"
"SVCB"
"TLSA"
"URI"
result_info: optional object { count, page, per_page, 2 more }
count: optional number

Total number of results for the requested service.

page: optional number

Current page within paginated list of results.

per_page: optional number

Number of results per page of results.

total_count: optional number

Total results available without any search parameters.

total_pages: optional number

The number of total pages in the entire result set.

Email Routing - DNS settings

curl https://api.cloudflare.com/client/v4/zones/$ZONE_ID/email/routing/dns \
    -H "X-Auth-Email: $CLOUDFLARE_EMAIL" \
    -H "X-Auth-Key: $CLOUDFLARE_API_KEY"
{
  "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
  }
}