close
Skip to content
Start here

Get sending subdomain DNS records

email_sending.subdomains.dns.get(strsubdomain_id, DNSGetParams**kwargs) -> SyncSinglePage[DNSRecord]
GET/zones/{zone_id}/email/sending/subdomains/{subdomain_id}/dns

Returns the expected DNS records for a sending subdomain.

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

Identifier.

maxLength32
subdomain_id: str

Sending subdomain identifier.

maxLength32
ReturnsExpand Collapse
class 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"

Get sending subdomain DNS records

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
)
page = client.email_sending.subdomains.dns.get(
    subdomain_id="aabbccdd11223344aabbccdd11223344",
    zone_id="023e105f4ecef8ad9ca31a8372d0c353",
)
page = page.result[0]
print(page.content)
{
  "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": [
    {
      "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": [
    {
      "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
  }
}