Skip to main content

How to Import a DNS Zone File

Learn how to import your domain's zone file into Rapyd, including format requirements, supported record types, and troubleshooting common issues.

Updated yesterday

Introduction

Importing a zone file allows you to bulk-add DNS records to your domain in a single operation, rather than creating them one by one. This is especially useful when migrating a domain from another DNS provider to Rapyd, or when restoring a backup of your DNS configuration.


Rapyd accepts zone files in the industry-standard BIND format, the same format used by most DNS providers and servers worldwide. This guide covers how to import a zone file, what format requirements to follow, which record types are supported, and how to troubleshoot common issues.


Before You Begin

Before importing a zone file, make sure:

  • Your domain is already connected to Rapyd (via Cloudflare API or Cloudflare Nameservers).

  • Your zone file is in BIND format (see formatting requirements below).

  • The zone file size is under 256 KB (262,144 bytes).

Note: Importing a zone file adds records to your existing DNS configuration — it does not replace or delete existing records. If you have duplicate records (same name and type), you may see a warning during import.


Steps to Import a Zone File

  1. Log into the Rapyd dashboard and click Domains in the top navigation.

  2. Find the domain you want to import records for and select Manage DNS records from the context menu.

  3. Click the Actions button (next to Add record), then select Import zone file.

  4. Drag and drop your zone file or click to select it from your computer. The file must be in BIND format (see below). Accepted extensions: .txt, .zone, .db, or no extension.


After uploading, Rapyd will parse the file and display a summary showing the total records parsed, records to be added, and any warnings (duplicate records, unsupported types, or formatting issues). If the file is valid, you'll see an Uploaded message in green.

Review any warnings, then click Import to finalize. A confirmation message will appear indicating a successful import, and your records will now appear in the DNS records table.


Zone File Format Requirements

Rapyd accepts DNS zone files in BIND format, as defined in RFC 1035. This is the industry-standard format used by most DNS providers, including Cloudflare, GoDaddy, Namecheap, AWS Route 53, and others.

Basic Structure

A BIND zone file consists of directives (control statements) and resource records (DNS entries). Each entry is on its own line.

Example zone file:

$ORIGIN example.com.

$TTL 3600

@ IN SOA ns1.example.com. admin.example.com. (

2024010101 ; Serial

7200 ; Refresh

3600 ; Retry

1209600 ; Expire

3600 ) ; Minimum TTL

@ IN NS ns1.example.com.

@ IN NS ns2.example.com.

@ IN A 192.0.2.1

www IN A 192.0.2.1

mail IN A 192.0.2.2

@ IN MX 10 mail.example.com.

@ IN TXT "v=spf1 include:_spf.example.com ~all"

Supported Directives

Directive

Description

Supported

$ORIGIN

Sets the base domain name for relative hostnames.

✅ Yes

$TTL

Sets the default TTL for records that don't specify one.

✅ Yes

$GENERATE

BIND extension for generating sequential records.

✅ Yes

$INCLUDE

Includes another zone file.

❌ No

Note: If your zone file contains $INCLUDE directives, you'll receive a parsing error. Merge the included files into a single file before importing.

Record Format

Each resource record follows this structure:

<name> <TTL> <class> <type> <data>

  • Name: The hostname (e.g., www, mail, @ for the root domain). Relative names have the $ORIGIN appended.

  • TTL: Time to live in seconds (optional; uses $TTL default if omitted).

  • Class: Almost always IN for Internet (can be omitted; defaults to IN).

  • Type: The record type (e.g., A, AAAA, CNAME, MX, TXT).

  • Data: The record value (e.g., IP address, hostname, text string).

Important Formatting Rules

  1. Fully qualified domain names must end with a period.

    • Correct: mail.example.com.

    • Incorrect: mail.example.com (will have $ORIGIN appended)

  2. The @ symbol represents the root domain (zone apex).

  3. Comments start with a semicolon (;).

    • Everything after ; on a line is ignored.

  4. Multi-line records use parentheses for continuation (common for SOA records).

  5. TXT records with spaces must be quoted.

    • Correct: "v=spf1 include:_spf.example.com ~all"

  6. CNAME, MX, NS, SRV, and PTR targets should be fully qualified (ending with a period).


Supported Record Types

The following record types can be imported:

Record Type

Description

A

Maps a domain to an IPv4 address

AAAA

Maps a domain to an IPv6 address

CNAME

Alias pointing to another domain

MX

Mail exchange server with priority

TXT

Text data (SPF, DKIM, verification, etc.)

NS

Nameserver delegation

SRV

Service location (host, port, priority, weight)

CAA

Certificate Authority Authorization

PTR

Reverse DNS pointer

DS

DNSSEC Delegation Signer

DNSKEY

DNSSEC public key

SSHFP

SSH fingerprint

TLSA

TLS certificate association (DANE)

SMIMEA

S/MIME certificate association

CERT

Public key certificate

NAPTR

Naming Authority Pointer

URI

URI record

SVCB

Service Binding

HTTPS

HTTPS Service Binding

SOA records are not imported. Cloudflare automatically manages the SOA record for your zone. Any SOA record in your zone file will be parsed but not added.

For a detailed explanation of each record type, see our Guide to DNS Records.


Cloudflare-Specific Tags

When importing zone files, you can use special Cloudflare tags (added as comments) to control proxy status and CNAME flattening:

Proxy Status (cf-proxied)

Add cf_tags=cf-proxied:true or cf_tags=cf-proxied:false to control whether a record is proxied through Cloudflare:

www.example.com. 300 IN A 192.0.2.1 ; cf_tags=cf-proxied:true

api.example.com. 300 IN A 192.0.2.2 ; cf_tags=cf-proxied:false

If the tag is not present, the default import setting (selected in the import dialog) will apply.

CNAME Flattening (cf-flatten-cname)

For paid plans with per-record CNAME flattening enabled:

example.com. 300 IN CNAME target.example.net. ; cf_tags=cf-flatten-cname


Common Issues and Troubleshooting

"Unsupported file format"

Cause: The file is not in BIND format, or has an unsupported encoding.

Solution:

  • Ensure your file is plain text (UTF-8 encoding).

  • Check that the file follows BIND zone file syntax.

  • If exported from another provider, verify they export in BIND format (not CSV, JSON, or proprietary formats).

"$INCLUDE directive not allowed"

Cause: Your zone file references another file using $INCLUDE.

Solution: Merge the included files into a single zone file before importing.

"Duplicate records detected"

Cause: A record with the same name and type already exists in your DNS configuration.

Solution:

  • Review the existing records in your Rapyd dashboard.

  • Either delete the existing record first, or skip importing the duplicate.

  • Note: Having multiple A or AAAA records with the same name is valid (round-robin), but multiple identical records are not.

Records not appearing after import

Cause: The record type may be unsupported, or the record syntax was invalid.

Solution:

  • Check the import summary for warnings.

  • Verify that fully qualified domain names end with a period.

  • Ensure TXT record values are properly quoted.

TTL values ignored or changed

Cause: For proxied records, Cloudflare overrides the TTL to "Auto" (300 seconds).

Solution: This is expected behavior. TTL values are only respected for DNS-only (unproxied) records.

Zone file too large

Cause: The file exceeds the 256 KB size limit.

Solution:

  • Split the zone file into smaller chunks.

  • Import each chunk separately.

  • Remove any unnecessary comments or whitespace.


Exporting a Zone File from Other Providers

Most DNS providers allow you to export your zone file in BIND format. Here are instructions for common providers:

  • GoDaddy: DNS Management → Export Zone File (BIND format)

  • Namecheap: Domain List → Manage → Advanced DNS → Export (select BIND)

  • AWS Route 53: Hosted Zones → [Zone] → Export as BIND

  • Google Domains: DNS → Export DNS records

  • Cloudflare: DNS → Records → Import and Export → Export

Tip: After exporting, open the file in a text editor and remove any provider-specific comments or headers that might cause parsing issues. Also verify that the $ORIGIN matches your domain.


Conclusion

Importing a zone file is the fastest way to migrate DNS records to Rapyd or restore a backup. By ensuring your file is in the correct BIND format and contains supported record types, you can streamline DNS management and avoid manual entry errors.

If you encounter issues during import or have questions about specific record types, contact our support team via live chat or at [email protected].


Related Articles

Did this answer your question?