Portal Community

dns/export

Export all DNS records for a zone as a BIND-format zone file (RFC 1035).

When to Use

Configuration

Connection

FieldTypeRequiredDescription
ApiTokenstringrequiredScoped Cloudflare API Token with DNS.Read permission. Store in BizFirst Credentials Manager.

Operation Fields

FieldTypeRequiredDescription
ZoneIdstringrequired32-character hexadecimal Zone ID to export records from.

Sample Configuration

{
  "resource": "dns",
  "operation": "export",
  "connection": {
    "ApiToken": "{{ $credentials.cloudflare_dns_read }}"
  },
  "ZoneId": "023e105f4ecef8ad9ca31a8372d0c353"
}

Validation Errors

CodeConditionResolution
MISSING_API_TOKENApiToken is emptySet the ApiToken credential in the connection panel
MISSING_ZONE_IDZoneId is emptyProvide the Zone ID
UNKNOWN_ERRORCloudflare API errorVerify Zone ID and token permissions

Output

Success Port

FieldTypeDescription
zoneFilestringComplete BIND zone file content in RFC 1035 format. Can be written directly to S3, a file store, or passed to dns/import.

Error Port

On failure, the error port receives an object with code and message.

Sample Output

{
  "zoneFile": ";; Exported from Cloudflare\n$ORIGIN example.com.\n$TTL 1\n@ IN SOA victor.ns.cloudflare.com. dns.cloudflare.com. 2026052601 10000 2400 604800 3600\n@ IN NS victor.ns.cloudflare.com.\n@ IN NS uma.ns.cloudflare.com.\n@ IN A 198.51.100.4\nwww IN CNAME example.com.\nmail IN A 198.51.100.5\n@ IN MX 10 mail.example.com.\n@ IN TXT \"v=spf1 include:_spf.example.com ~all\"\n"
}

Expression Reference

ExpressionReturns
{{ $node.DnsExport.output.zoneFile }}Full BIND zone file as a string

Node Policies & GuardRails

PolicyDetail
Use DNS.Read scoped tokenExport is read-only — do not over-scope the token
Store ApiToken in Credentials ManagerNever hardcode the token in configuration JSON
Store exports with timestampsWhen writing zone files to S3 or storage, include a timestamp in the file name: example.com-2026-05-26.zone
Treat zone files as sensitive dataZone files reveal your full DNS configuration — store in access-controlled locations, not public buckets
Validate before importIf using the exported file for dns/import, verify the zone file is valid RFC 1035 before passing it to the import operation

Examples

Example 1: Nightly DNS Backup to S3

Scheduled workflow (2:00 AM UTC): (1) Call zone/list to get all active zone IDs. (2) For each zone, call dns/export. (3) Write each zone file to S3 at dns-backups/{zoneName}/{date}.zone. (4) Send a nightly summary notification with backup file counts.

Example 2: Staging vs. Production Diff

Before each release: (1) Call dns/export on staging zone. (2) Call dns/export on production zone. (3) Feed both zone files into a CodeExecute node running a diff. (4) Send the diff output to the release Slack channel for review before DNS changes are applied to production.

Example 3: Zone File for Disaster Recovery Package

Monthly workflow: Export zone files for all production zones. Bundle them with other infrastructure documentation (TLS cert metadata, zone settings) into a ZIP file. Upload to an offline cold storage bucket with a 7-year retention policy for compliance requirements.