Skip to content
Start here

Email Routing - DNS settings

client.emailRouting.dns.get(DNSGetParams { zone_id, subdomain } params, RequestOptionsoptions?): DNSGetResponse
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 { zone_id, subdomain }
zone_id: string

Path param: Identifier.

maxLength32
subdomain?: string

Query param: Domain of your zone.

ReturnsExpand Collapse
DNSGetResponse = EmailEmailRoutingDNSQueryResponse { errors, messages, success, 2 more } | EmailDNSSettingsResponseCollection { errors, messages, success, 2 more }
One of the following:
EmailEmailRoutingDNSQueryResponse { errors, messages, success, 2 more }
errors: Array<Error>
code: number
minimum1000
message: string
documentation_url?: string
source?: Source { pointer }
pointer?: string
messages: Array<Message>
code: number
minimum1000
message: string
documentation_url?: string
source?: Source { pointer }
pointer?: string
success: true

Whether the API call was successful.

result?: Result { errors, record }
errors?: Array<Error>
code?: string
missing?: DNSRecord { content, name, priority, 2 more }

List of records needed to enable an Email Routing zone.

content?: string

DNS record content.

name?: string

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

maxLength255
priority?: number

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

maximum65535
minimum0
ttl?: number | 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
type?: "A" | "AAAA" | "CNAME" | 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?: Array<DNSRecord { content, name, priority, 2 more } >
content?: string

DNS record content.

name?: string

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

maxLength255
priority?: number

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

maximum65535
minimum0
ttl?: number | 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
type?: "A" | "AAAA" | "CNAME" | 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?: ResultInfo { count, page, per_page, 2 more }
count?: number

Total number of results for the requested service.

page?: number

Current page within paginated list of results.

per_page?: number

Number of results per page of results.

total_count?: number

Total results available without any search parameters.

total_pages?: number

The number of total pages in the entire result set.

EmailDNSSettingsResponseCollection { errors, messages, success, 2 more }
errors: Array<Error>
code: number
minimum1000
message: string
documentation_url?: string
source?: Source { pointer }
pointer?: string
messages: Array<Message>
code: number
minimum1000
message: string
documentation_url?: string
source?: Source { pointer }
pointer?: string
success: true

Whether the API call was successful.

result?: Array<DNSRecord { content, name, priority, 2 more } >
content?: string

DNS record content.

name?: string

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

maxLength255
priority?: number

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

maximum65535
minimum0
ttl?: number | 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
type?: "A" | "AAAA" | "CNAME" | 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?: ResultInfo { count, page, per_page, 2 more }
count?: number

Total number of results for the requested service.

page?: number

Current page within paginated list of results.

per_page?: number

Number of results per page of results.

total_count?: number

Total results available without any search parameters.

total_pages?: number

The number of total pages in the entire result set.

Email Routing - DNS settings

import Cloudflare from 'cloudflare';

const client = new Cloudflare({
  apiEmail: process.env['CLOUDFLARE_EMAIL'], // This is the default and can be omitted
  apiKey: process.env['CLOUDFLARE_API_KEY'], // This is the default and can be omitted
});

const dns = await client.emailRouting.dns.get({ zone_id: '023e105f4ecef8ad9ca31a8372d0c353' });

console.log(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
  }
}