Portal / Nodes / Cloudflare / dns/import
dns/import
Import DNS records from a BIND-format zone file (RFC 1035) into a Cloudflare zone.
Non-destructive import: Existing records are not overwritten. Records in the zone file that match existing records are skipped and counted in recordsSkipped. No existing records are deleted.
When to Use
- Provider migration: Export a BIND zone file from your current DNS provider (Route 53, GoDaddy, cPanel, etc.) and import it directly into Cloudflare during migration.
- Backup restoration: Restore DNS records from a previously exported BIND zone file after accidental record deletions.
- Legacy infrastructure import: Import DNS records from legacy infrastructure documentation that was maintained as BIND zone files.
- External DNS tool integration: Import zone files generated by external DNS management tools, provisioning systems, or Terraform-managed DNS.
Configuration
Connection
| Field | Type | Required | Description |
ApiToken | string | required | Scoped Cloudflare API Token with DNS.Edit permission. Store in BizFirst Credentials Manager. |
Operation Fields
| Field | Type | Required | Description |
ZoneId | string | required | 32-character hexadecimal Zone ID to import records into. |
FileContent | string | required | Full BIND zone file content as a string (RFC 1035 format). Read from S3, a file node, or a variable. |
Sample Configuration
{
"resource": "dns",
"operation": "import",
"connection": {
"ApiToken": "{{ $credentials.cloudflare_dns_edit }}"
},
"ZoneId": "023e105f4ecef8ad9ca31a8372d0c353",
"FileContent": "{{ $node.ReadS3File.output.body }}"
}
Sample BIND Zone File (FileContent)
$ORIGIN example.com.
$TTL 3600
@ IN SOA ns1.example.com. admin.example.com. (
2024010101 ; serial
3600 ; refresh
900 ; retry
604800 ; expire
300 ) ; minimum TTL
@ IN NS ns1.example.com.
@ IN A 198.51.100.4
www IN CNAME example.com.
mail IN A 198.51.100.5
@ IN MX 10 mail.example.com.
@ IN TXT "v=spf1 include:_spf.example.com ~all"
Validation Errors
| Code | Condition | Resolution |
MISSING_API_TOKEN | ApiToken is empty | Set the ApiToken credential with DNS.Edit permission |
MISSING_ZONE_ID | ZoneId is empty | Provide the Zone ID |
UNKNOWN_ERROR | Invalid zone file format or API error | Validate zone file syntax — Cloudflare requires valid RFC 1035 format |
Output
Success Port
| Field | Type | Description |
recordsAdded | integer | Number of records successfully added to the zone |
recordsSkipped | integer | Number of records skipped because they already exist |
totalRecordsParsed | integer | Total records found in the zone file |
Error Port
On failure, the error port receives an object with code and message.
Sample Output
{
"recordsAdded": 5,
"recordsSkipped": 1,
"totalRecordsParsed": 6
}
Expression Reference
| Expression | Returns |
{{ $node.DnsImport.output.recordsAdded }} | Count of newly created records |
{{ $node.DnsImport.output.recordsSkipped }} | Count of already-existing records skipped |
{{ $node.DnsImport.output.totalRecordsParsed }} | Total records in the zone file |
Node Policies & GuardRails
| Policy | Detail |
| Validate zone file before import | Run the zone file through a BIND syntax validator before passing it to this node — malformed files return errors |
| Require DNS.Edit token | Import creates records and requires write permission |
| Store ApiToken in Credentials Manager | Never hardcode the token in configuration JSON |
| Import is non-destructive | Existing records are never overwritten — safe to import the same file multiple times; duplicates are skipped |
| Verify counts post-import | Compare recordsAdded + recordsSkipped against totalRecordsParsed — if they do not match, some records failed silently |
Examples
Example 1: Automated Provider Migration
Trigger: migration workflow initiated by ops team. Steps: (1) Read zone file from S3 bucket uploaded by the team. (2) Call dns/import with the file content. (3) Compare totalRecordsParsed against the expected count. (4) Send a Slack summary with recordsAdded and recordsSkipped counts.
Example 2: Restore from Backup
Connect to a Webhook trigger for "DNS restore" requests. Read the latest zone file from the dns-backups S3 bucket. Call dns/import. Log the restoration event with timestamp and record counts to the incident management system.
Example 3: Nightly Zone File Sync
A scheduled workflow reads a canonical zone file stored in a Git repository via an HTTP Request node. Calls dns/import to synchronize any new records added to the source of truth. Skipped records confirm no-change for existing entries. Alerts on recordsAdded > 0 for awareness.