-
Notifications
You must be signed in to change notification settings - Fork 4
DNS Records for a Zone
{
"id": "372e67954025e0ba6aaa6d586b9e0b59",
"type": "A",
"name": "example.com",
"content": "198.51.100.4",
"proxiable": true,
"proxied": false,
"ttl": 120,
"locked": false,
"zone_id": "023e105f4ecef8ad9ca31a8372d0c353",
"zone_name": "example.com",
"created_on": "2014-01-01T05:20:00.12345Z",
"modified_on": "2014-01-01T05:20:00.12345Z",
"data": {},
"meta": {
"auto_added": true,
"source": "primary"
}
}
See this doc for more details: https://api.cloudflare.com/#dns-records-for-a-zone-properties
List, search, sort, and filter a zones' DNS records. See api doc here: https://api.cloudflare.com/#dns-records-for-a-zone-list-dns-records
Command: cf dns list <zone>
Options:
Options:
--version Show version number [boolean]
--help Show help [boolean]
--format Format the output, value: table, string, json, list [string]
--separator Separator value when the output format is string [string] [default: " "]
--fields Fields to return [string] [default: "id,type,name,content,proxied"]
--content DNS record content, ex: 1.1.1.1 [string]
--name DNS record name, ex: sub1.example.com [string]
--perPage Number of zones per page [default: 20]
--page Page number of paginated results [default: 1]
--order Field to order zones by [string] [default: "name"]
--direction Direction to order zones [string] [default: "asc"]
--status Status of the zone [string] [default: "active"]
--type DNS record type, valid values: A, AAAA, CNAME, TXT, SRV,
LOC, MX, NS, SPF, CERT, DNSKEY, DS, NAPTR,SMIMEA, SSHFP, TLSA, URI. [string]
Samples:
cf dns list example.com
cf dns list example.com --perPage=2 --page=3
cf dns list 372e67954025e0ba6aaa6d586b9e0b59
cf dns list example.com --name=sub1.example.com --fields=id
cf dns list example.com --type=A
cf dns list example.com --type=CNAME
Create a new DNS record for a zone. See the record object definitions for required attributes for each record type. See api doc here: https://api.cloudflare.com/#dns-records-for-a-zone-create-dns-record
Command: cf dns create <zone>
Options:
Options:
--version Show version number [boolean]
--help Show help [boolean]
--format Format the output, value: table, string, json, list [string]
--separator Separator value when the output format is string [string] [default: " "]
--fields Fields to return [string] [default: "id,type,name,content,proxied,ttl"]
--type DNS record type, default A [string] [required] [default: "A"]
--name DNS record name [string] [required]
--content DNS record content [string] [required]
--ttl Time to live for DNS record. Value of 1 is 'automatic' [string] [default: "1"]
--proxied Whether the record is receiving the performance and security
benefits of Cloudflare [string] [default: true]
--priority Used with some records like MX and SRV to determine priority.
If you do not supply a priority for an MX record, a default value of 0 will be set [string] [default: 0]
Samples:
cf dns create example.com --type=A --name=sub1 --content=1.2.3.4
cf dns create example.com --type=MX --name="example.com" --content=example.com
cf dns create example.com --type=TXT --name="example.com" --content="v=spf1 +a +mx +ip4:1.2.3.4 ~all"
Get information about a specific DNS record. See api doc here: https://api.cloudflare.com/#dns-records-for-a-zone-dns-record-details
Command: cf dns get <zone> <record>
Options:
Options:
--version Show version number [boolean]
--help Show help [boolean]
--fields Fields to return [string] [default: "id,type,name,content,proxied,ttl"]
--format Format the output, value: table, string, json, list [string] [default: "list"]
--separator Separator value when the output format is string [string] [default: " "]
Samples:
cf dns get example.com sub1.example.com
cf dns get example.com b9be87b67698e5d3c5efe837529d82d0
cf dns get example.com default._domainkey --field=content
Update information for a specific DNS record. See api doc here: https://api.cloudflare.com/#dns-records-for-a-zone-update-dns-record
Command: cf dns update <zone> <record>
Options:
Options:
--version Show version number [boolean]
--help Show help [boolean]
--format Format the output, value: table, string, json, list [string]
--separator Separator value when the output format is string [string] [default: " "]
--fields Fields to return [string] [default: "id,type,name,content,proxied,ttl"]
--type DNS record type, default A [string] [required] [default: "A"]
--content DNS record content [string] [required]
--ttl Time to live for DNS record. Value of 1 is 'automatic' [string] [default: "1"]
--proxied Whether the record is receiving the performance and security benefits of Cloudflare, default: true
[string] [default: true]
--priority Used with some records like MX and SRV to determine priority. If you do not supply a priority for an MX
record, a default value of 0 will be set [string] [default: 0]
Samples:
cf dns update example.com b9be87b67698e5d3c5efe837529d82d0 --type="TXT" --content="222"
cf dns update example.com sub1.example.com --content="1.2.3.4"
Delete a specific DNS record. See api doc here: https://api.cloudflare.com/#dns-records-for-a-zone-delete-dns-record
Command: cf dns delete <zone> <record>
Samples:
cf dns delete example.com b9be87b67698e5d3c5efe837529d82d0
cf dns delete example.com sub1.example.com
cf dns delete example.com sub1.example.com sub2.example.com sub3.example.com
You can upload your BIND config through this endpoint. It assumes that cURL is called from a location with bind_config.txt (valid BIND config) present. See api doc here: https://api.cloudflare.com/#dns-records-for-a-zone-import-dns-records
Command: cf dns import <zone> --inputFile /path/to/file
Options:
Options:
--inputFile Input file path [string] [required]
Samples:
cf dns import example.com ~/Downloads/dnsrecords.txt
You can export your BIND config through this endpoint. See api doc here: https://api.cloudflare.com/#dns-records-for-a-zone-export-dns-records
Command: cf dns export <zone> --output /path/to/file
Options:
Options:
--output Output file path [string] [required]
Samples:
cf dns export example.com ~/Downloads/dnsrecords.txt