Skip to main content

dns

Creates, updates, deletes, gets or lists a dns resource.

Overview

Namedns
TypeResource
Idcloudflare.email_routing.dns

Fields

The following fields are returned by SELECT queries:

Email Routing - DNS settings response

NameDatatypeDescription
namestringDNS record name (or @ for the zone apex). (example: example.com)
contentstringDNS record content. (example: route1.mx.cloudflare.net)
prioritynumberRequired for MX, SRV and URI records. Unused by other record types. Records with lower priorities are preferred.
ttlnumberTime to live, in seconds, of the DNS record. Must be between 60 and 86400, or 1 for 'automatic'. (1)
typestringDNS record type. (A, AAAA, CNAME, HTTPS, TXT, SRV, LOC, MX, NS, CERT, DNSKEY, DS, NAPTR, SMIMEA, SSHFP, SVCB, TLSA, URI) (example: NS)

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
listselectzone_idsubdomainShow the DNS records needed to configure your Email Routing zone.
createinsertzone_idEnable you Email Routing zone. Add and lock the necessary MX and SPF records.
editupdatezone_idUnlock MX Records previously locked by Email Routing.
email_routing_settings_disable_email_routing_dnsdeletezone_idDisable your Email Routing zone. Also removes additional MX records previously required for Email Routing to work.

Parameters

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
zone_idstringThe Cloudflare zone ID.
subdomainstring

SELECT examples

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

SELECT
name,
content,
priority,
ttl,
type
FROM cloudflare.email_routing.dns
WHERE zone_id = '{{ zone_id }}' -- required
AND subdomain = '{{ subdomain }}'
;

INSERT examples

Enable you Email Routing zone. Add and lock the necessary MX and SPF records.

INSERT INTO cloudflare.email_routing.dns (
name,
zone_id
)
SELECT
'{{ name }}',
'{{ zone_id }}'
RETURNING
errors,
messages,
result,
success
;

UPDATE examples

Unlock MX Records previously locked by Email Routing.

UPDATE cloudflare.email_routing.dns
SET
name = '{{ name }}'
WHERE
zone_id = '{{ zone_id }}' --required
RETURNING
errors,
messages,
result,
success;

DELETE examples

Disable your Email Routing zone. Also removes additional MX records previously required for Email Routing to work.

DELETE FROM cloudflare.email_routing.dns
WHERE zone_id = '{{ zone_id }}' --required
;