Skip to content
Software capabilities
Cloudflare

Export DNS records as a BIND zone file

Export a zone’s DNS records in BIND format. The REST endpoint supports record filters. The generated TypeScript client currently exposes only the zone identifier for this call.

Documentation reviewed · 2 methods with sources

Ways to do it

  1. API: GET /zones/{zone_id}/dns_records/export
  2. SDK: client.dns.records.export()
API

GET /zones/{zone_id}/dns_records/export

Export a BIND-format file, optionally limiting it to matching records.

Read source: Cloudflare API: Export DNS Records
Requirements
A zone ID and an API token with DNS Read or DNS Write when using token auth.
Limitations
By default Cloudflare includes the SOA and assigned apex NS records even if they do not match the filters. Secondary zones need a stored SOA for that mode. Set include_generated_records=false to export matching stored records only.
SDK

client.dns.records.export()

Call client.dns.records.export to retrieve the zone’s BIND-format response as a string.

Read source: Generated Cloudflare TypeScript DNS method: GET /zones/{zone_id}/dns_records/export
Requirements
An authenticated Cloudflare TypeScript client and zone_id.
Limitations
Version 7.4.0 exposes only zone_id for this operation. Use the REST API for filters or include_generated_records.