Skip to main content

records

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

Overview

Namerecords
TypeResource
Idcloudflare.dns.records

Fields

The following fields are returned by SELECT queries:

DNS Record Details response

NameDatatypeDescription
idstringIdentifier. (example: 023e105f4ecef8ad9ca31a8372d0c353)
namestringComplete DNS record name, including the zone name, in Punycode. (example: example.com)
commentstringComments or notes about the DNS record. This field has no effect on DNS responses. (example: Domain verification record)
comment_modified_onstring (date-time)When the record comment was last modified. Omitted if there is no comment. (example: 2024-01-01T05:20:00.12345Z, x-stainless-terraform-configurability: computed)
contentstring (ipv4)A valid IPv4 address. (example: 198.51.100.4)
created_onstring (date-time)When the record was created. (example: 2014-01-01T05:20:00.12345Z, x-stainless-terraform-configurability: computed)
dataobjectComponents of a CAA record.
metaobjectExtra Cloudflare-specific information about the record. (x-stainless-terraform-configurability: computed)
modified_onstring (date-time)When the record was last modified. (example: 2014-01-01T05:20:00.12345Z, x-stainless-terraform-configurability: computed)
prioritynumberRequired for MX and URI records; ignored for other record types (but may still be returned by the API). Records with lower priorities are preferred. This field is to be deprecated in favor of the priority field within the data map.
private_routingbooleanEnables private network routing to the origin.
proxiablebooleanWhether the record can be proxied by Cloudflare or not. (x-stainless-terraform-configurability: computed)
proxiedbooleanWhether the record is receiving the performance and security benefits of Cloudflare.
settingsobjectSettings for the DNS record.
tagsarrayCustom tags for the DNS record. This field has no effect on DNS responses. (x-stainless-collection-type: set)
tags_modified_onstring (date-time)When the record tags were last modified. Omitted if there are no tags. (example: 2025-01-01T05:20:00.12345Z, x-stainless-terraform-configurability: computed)
ttlnumberTime To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. Value must be between 60 and 86400, with the minimum reduced to 30 for Enterprise zones. (1)
typestringRecord type. (A) (example: A)

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
getselectdns_record_id, zone_id
editupdatedns_record_id, zone_id, name, ttl, typeUpdate an existing DNS record. Notes: - A/AAAA records cannot exist on the same name as CNAME records. - NS records cannot exist on the same name as any other record type. - Domain names are always represented in Punycode, even if Unicode characters were used when creating the record.
updatereplacedns_record_id, zone_id, name, ttl, typeOverwrite an existing DNS record. Notes: - A/AAAA records cannot exist on the same name as CNAME records. - NS records cannot exist on the same name as any other record type. - Domain names are always represented in Punycode, even if Unicode characters were used when creating the record.
deletedeletedns_record_id, zone_id
scan_triggerexeczone_idInitiates an asynchronous scan for common DNS records on your domain. Note that this does not automatically add records to your zone. The scan runs in the background, and results can be reviewed later using the /scan/review endpoints. Useful if you haven't updated your nameservers yet.

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
dns_record_idstring
zone_idstringThe Cloudflare zone ID.

SELECT examples

DNS Record Details response

SELECT
id,
name,
comment,
comment_modified_on,
content,
created_on,
data,
meta,
modified_on,
priority,
private_routing,
proxiable,
proxied,
settings,
tags,
tags_modified_on,
ttl,
type
FROM cloudflare.dns.records
WHERE dns_record_id = '{{ dns_record_id }}' -- required
AND zone_id = '{{ zone_id }}' -- required
;

UPDATE examples

Update an existing DNS record. Notes: - A/AAAA records cannot exist on the same name as CNAME records. - NS records cannot exist on the same name as any other record type. - Domain names are always represented in Punycode, even if Unicode characters were used when creating the record.

UPDATE cloudflare.dns.records
SET
comment = '{{ comment }}',
name = '{{ name }}',
proxied = {{ proxied }},
settings = '{{ settings }}',
tags = '{{ tags }}',
ttl = {{ ttl }},
content = '{{ content }}',
private_routing = {{ private_routing }},
type = '{{ type }}',
priority = {{ priority }},
data = '{{ data }}'
WHERE
dns_record_id = '{{ dns_record_id }}' --required
AND zone_id = '{{ zone_id }}' --required
AND name = '{{ name }}' --required
AND ttl = '{{ ttl }}' --required
AND type = '{{ type }}' --required
RETURNING
errors,
messages,
result,
success;

REPLACE examples

Overwrite an existing DNS record. Notes: - A/AAAA records cannot exist on the same name as CNAME records. - NS records cannot exist on the same name as any other record type. - Domain names are always represented in Punycode, even if Unicode characters were used when creating the record.

REPLACE cloudflare.dns.records
SET
comment = '{{ comment }}',
name = '{{ name }}',
proxied = {{ proxied }},
settings = '{{ settings }}',
tags = '{{ tags }}',
ttl = {{ ttl }},
content = '{{ content }}',
private_routing = {{ private_routing }},
type = '{{ type }}',
priority = {{ priority }},
data = '{{ data }}'
WHERE
dns_record_id = '{{ dns_record_id }}' --required
AND zone_id = '{{ zone_id }}' --required
AND name = '{{ name }}' --required
AND ttl = '{{ ttl }}' --required
AND type = '{{ type }}' --required
RETURNING
errors,
messages,
result,
success;

DELETE examples

No description available.

DELETE FROM cloudflare.dns.records
WHERE dns_record_id = '{{ dns_record_id }}' --required
AND zone_id = '{{ zone_id }}' --required
;

Lifecycle Methods

Initiates an asynchronous scan for common DNS records on your domain. Note that this does not automatically add records to your zone. The scan runs in the background, and results can be reviewed later using the /scan/review endpoints. Useful if you haven't updated your nameservers yet.

EXEC cloudflare.dns.records.scan_trigger
@zone_id='{{ zone_id }}' --required
;