records
Creates, updates, deletes, gets or lists a records resource.
Overview
| Name | records |
| Type | Resource |
| Id | cloudflare.dns.records |
Fields
The following fields are returned by SELECT queries:
- get
DNS Record Details response
| Name | Datatype | Description |
|---|---|---|
id | string | Identifier. (example: 023e105f4ecef8ad9ca31a8372d0c353) |
name | string | Complete DNS record name, including the zone name, in Punycode. (example: example.com) |
comment | string | Comments or notes about the DNS record. This field has no effect on DNS responses. (example: Domain verification record) |
comment_modified_on | string (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) |
content | string (ipv4) | A valid IPv4 address. (example: 198.51.100.4) |
created_on | string (date-time) | When the record was created. (example: 2014-01-01T05:20:00.12345Z, x-stainless-terraform-configurability: computed) |
data | object | Components of a CAA record. |
meta | object | Extra Cloudflare-specific information about the record. (x-stainless-terraform-configurability: computed) |
modified_on | string (date-time) | When the record was last modified. (example: 2014-01-01T05:20:00.12345Z, x-stainless-terraform-configurability: computed) |
priority | number | Required 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_routing | boolean | Enables private network routing to the origin. |
proxiable | boolean | Whether the record can be proxied by Cloudflare or not. (x-stainless-terraform-configurability: computed) |
proxied | boolean | Whether the record is receiving the performance and security benefits of Cloudflare. |
settings | object | Settings for the DNS record. |
tags | array | Custom tags for the DNS record. This field has no effect on DNS responses. (x-stainless-collection-type: set) |
tags_modified_on | string (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) |
ttl | number | Time 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) |
type | string | Record type. (A) (example: A) |
Methods
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
get | select | dns_record_id, zone_id | ||
edit | update | dns_record_id, zone_id, name, ttl, type | 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 | replace | dns_record_id, zone_id, name, ttl, type | 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. | |
delete | delete | dns_record_id, zone_id | ||
scan_trigger | exec | zone_id | 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. |
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.
| Name | Datatype | Description |
|---|---|---|
dns_record_id | string | |
zone_id | string | The Cloudflare zone ID. |
SELECT examples
- get
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
- edit
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
- update
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
- delete
No description available.
DELETE FROM cloudflare.dns.records
WHERE dns_record_id = '{{ dns_record_id }}' --required
AND zone_id = '{{ zone_id }}' --required
;
Lifecycle Methods
- scan_trigger
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
;