Skip to main content
The DNS Records resource provides methods to manage DNS records for zones, including creating, updating, listing, and deleting records.

Main methods

create

Create a new DNS record for a zone.
string
required
Zone identifier
string
required
DNS record type (e.g., ‘A’, ‘AAAA’, ‘CNAME’, ‘MX’, ‘TXT’, ‘SRV’, etc.)
string
required
DNS record name (e.g., ‘example.com’ or ‘subdomain.example.com’)
string
DNS record content (varies by record type)
number
Time to live, in seconds. Use 1 for automatic (defaults to auto)
boolean
Whether the record is receiving Cloudflare’s performance and security benefits (only applicable to A, AAAA, and CNAME records)
number
Record priority (required for MX and SRV records)
string
DNS record identifier
string
Record type
string
DNS record name
string
DNS record content
boolean
Whether the record is proxied through Cloudflare
number
Time to live in seconds
boolean
Whether the record is locked from editing
string
When the record was created
string
When the record was last modified

update

Overwrite an existing DNS record.
string
required
DNS record identifier (first parameter)
string
required
Zone identifier
string
required
DNS record type
string
required
DNS record name
string
DNS record content
number
Time to live in seconds

list

List, search, sort, and filter a zone’s DNS records.
string
required
Zone identifier
string
Filter by DNS record type
string
Filter by DNS record name
string
Filter by DNS record content
boolean
Filter by proxy status
'type' | 'name' | 'content' | 'ttl' | 'proxied'
Field to order records by
'asc' | 'desc'
Direction to order records

delete

Delete a DNS record.
string
required
DNS record identifier (first parameter)
string
required
Zone identifier

get

Get DNS record details.
string
required
DNS record identifier (first parameter)
string
required
Zone identifier

Additional methods

edit

Update an existing DNS record (partial update).

batch

Send a batch of DNS record API calls to be executed together.

import

Import DNS records from a BIND config file.

export

Export DNS records in BIND config format.

Record types

Common DNS record types include:
  • A - Maps a domain to an IPv4 address
  • AAAA - Maps a domain to an IPv6 address
  • CNAME - Creates an alias for another domain
  • MX - Specifies mail servers for the domain
  • TXT - Stores text information
  • SRV - Defines service locations
  • NS - Delegates a subdomain to different nameservers
  • CAA - Specifies which certificate authorities can issue certificates
  • PTR - Reverse DNS lookup
  • HTTPS - HTTPS service binding
  • SVCB - Service binding

Important 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
  • Use ttl: 1 for automatic TTL (Cloudflare manages it)
  • Only A, AAAA, and CNAME records support the proxied option

Example usage