Skip to content
Start here

Email Routing - DNS settings

email_routing.dns.get(DNSGetParams**kwargs) -> 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
zone_id: str

Identifier.

maxLength32
subdomain: Optional[str]

Domain of your zone.

ReturnsExpand Collapse
One of the following:
class EmailEmailRoutingDNSQueryResponse:
errors: List[EmailEmailRoutingDNSQueryResponseError]
code: int
minimum1000
message: str
documentation_url: Optional[str]
source: Optional[EmailEmailRoutingDNSQueryResponseErrorSource]
pointer: Optional[str]
messages: List[EmailEmailRoutingDNSQueryResponseMessage]
code: int
minimum1000
message: str
documentation_url: Optional[str]
source: Optional[EmailEmailRoutingDNSQueryResponseMessageSource]
pointer: Optional[str]
success: Literal[true]

Whether the API call was successful.

result: Optional[EmailEmailRoutingDNSQueryResponseResult]
errors: Optional[List[EmailEmailRoutingDNSQueryResponseResultError]]
code: Optional[str]
missing: Optional[DNSRecord]

List of records needed to enable an Email Routing zone.

content: Optional[str]

DNS record content.

name: Optional[str]

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

maxLength255
priority: Optional[float]

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

maximum65535
minimum0
ttl: Optional[Union[float, Literal[1], null]]

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

One of the following:
float
Literal[1]

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

type: Optional[Literal["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: Optional[List[DNSRecord]]
content: Optional[str]

DNS record content.

name: Optional[str]

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

maxLength255
priority: Optional[float]

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

maximum65535
minimum0
ttl: Optional[Union[float, Literal[1], null]]

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

One of the following:
float
Literal[1]

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

type: Optional[Literal["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: Optional[EmailEmailRoutingDNSQueryResponseResultInfo]
count: Optional[float]

Total number of results for the requested service.

page: Optional[float]

Current page within paginated list of results.

per_page: Optional[float]

Number of results per page of results.

total_count: Optional[float]

Total results available without any search parameters.

total_pages: Optional[float]

The number of total pages in the entire result set.

class EmailDNSSettingsResponseCollection:
errors: List[EmailDNSSettingsResponseCollectionError]
code: int
minimum1000
message: str
documentation_url: Optional[str]
source: Optional[EmailDNSSettingsResponseCollectionErrorSource]
pointer: Optional[str]
messages: List[EmailDNSSettingsResponseCollectionMessage]
code: int
minimum1000
message: str
documentation_url: Optional[str]
source: Optional[EmailDNSSettingsResponseCollectionMessageSource]
pointer: Optional[str]
success: Literal[true]

Whether the API call was successful.

result: Optional[List[DNSRecord]]
content: Optional[str]

DNS record content.

name: Optional[str]

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

maxLength255
priority: Optional[float]

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

maximum65535
minimum0
ttl: Optional[Union[float, Literal[1], null]]

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

One of the following:
float
Literal[1]

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

type: Optional[Literal["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: Optional[EmailDNSSettingsResponseCollectionResultInfo]
count: Optional[float]

Total number of results for the requested service.

page: Optional[float]

Current page within paginated list of results.

per_page: Optional[float]

Number of results per page of results.

total_count: Optional[float]

Total results available without any search parameters.

total_pages: Optional[float]

The number of total pages in the entire result set.

Email Routing - DNS settings

import os
from cloudflare import Cloudflare

client = Cloudflare(
    api_email=os.environ.get("CLOUDFLARE_EMAIL"),  # This is the default and can be omitted
    api_key=os.environ.get("CLOUDFLARE_API_KEY"),  # This is the default and can be omitted
)
dns = client.email_routing.dns.get(
    zone_id="023e105f4ecef8ad9ca31a8372d0c353",
)
print(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
  }
}