Set up a primary zone (Full setup)
Last updated Jul 29, 2026 Cloudflare DNS offers a few different setup options. A primary setup (also known as full) is the most common and the only one available for Free or Pro plans. For details, refer to About. For more introductory context, refer to Concepts.
Before you begin
Make sure that you:
- Create a Cloudflare account — If you have not already, sign up for a Cloudflare account.
- Own a domain name — You need a registered domain (for example,
example.com). If you do not have one, you can register a domain at-cost through Cloudflare Registrar ↗︎. Domains purchased through Cloudflare Registrar automatically use Cloudflare for authoritative DNS, so you can skip the rest of this tutorial.
1. Add your domain to Cloudflare
- Log in to the Cloudflare dashboard ↗︎. Go to Domains ↗
- Select Onboard a domain.
- Enter your apex domain (for example,
example.com) and choose how you would like to add your DNS records. - Select Continue and choose a plan ↗︎.
<details>
<summary>
Required API token permissions
</summary>
At least one of the following <a href="https://developers.cloudflare.com/fundamentals/api/reference/permissions/">token permissions</a> is required:
- <code>Zone Zone Edit</code>
- <code>Zone DNS Edit</code>
</details>
Create Zonebash
curl "https://api.cloudflare.com/client/v4/zones" \
--request POST \
--header "Authorization: Bearer $CLOUDFLARE_API_TOKEN" \
--json '{
"name": "<YOUR_DOMAIN>",
"account": {
"id": "<YOUR_ACCOUNT_ID>"
}
}'
Note
If Cloudflare is unable to identify your domain as a registered domain, make sure you are using an existing top-level domain ↗︎ (.com, .net, .biz, or others).
Cloudflare requires your apex domain to be one level below a valid TLD defined in the Public Suffix List (PSL) ↗︎. Enterprise customers can onboard lower-level subdomains using Subdomain setup.
<details>
<summary>
DNS records quick scan
</summary>
Cloudflare can <a href="https://developers.cloudflare.com/dns/zone-setups/reference/dns-quick-scan/">automatically scan for your records</a> and add them to the <a href="https://developers.cloudflare.com/dns/concepts/#zone">DNS zone</a> for you, or you can add records manually. These records show up under your domain on the <a href="https://dash.cloudflare.com/?to=/:account/:zone/dns/records">DNS Records ↗︎</a> page of the dashboard.
Note
If you add a zone via the <a href="https://developers.cloudflare.com/api/resources/zones/methods/create/">API</a>, you can manually invoke the quick scan with the <a href="https://developers.cloudflare.com/api/resources/dns/subresources/records/methods/scan_trigger/">Trigger DNS Records Scan endpoint</a>.
</details>
2. Review your DNS records
Your DNS records must be accurate for your domain to work properly. If you don't know what DNS records are, consider the video below for a quick explanation.
Note
If you activate your domain on Cloudflare without setting up the correct DNS records for your domain, your visitors may experience DNS_PROBE_FINISHED_NXDOMAIN errors.
Common records
Since the quick scan is not guaranteed to find all existing DNS records, you need to review your records, paying special attention to the following:
- Zone apex records (
example.com)<details><summary>
More about zone apex records</summary>
Zone apex refers to the domain or subdomain that you are <a href="https://developers.cloudflare.com/dns/concepts/#zone">adding to Cloudflare</a>.
Usually, the zone apex record makes your domain accessible by visitors. In this case, the necessary record type (<a href="https://developers.cloudflare.com/dns/manage-dns-records/reference/dns-record-types/#ip-address-resolution">A, AAAA, or CNAME</a>) and its content will depend on the provider that <a href="https://developers.cloudflare.com/fundamentals/manage-domains/#host-your-domain">hosts</a> your website or application.
If you are using Cloudflare Workers, refer to <a href="https://developers.cloudflare.com/workers/configuration/routing/custom-domains/">Custom domains</a>.
If you are using other providers, look for their guidance on how to connect domains managed on external DNS services. Then, make sure you have the records required by your hosting provider on your <a href="https://developers.cloudflare.com/dns/manage-dns-records/#dns-records-table">DNS records table</a> at Cloudflare.</details>
- Subdomain records (
www.example.comorblog.example.com)<details><summary>
More about subdomain records</summary>
Most subdomains serve a specific purpose within the overall context of your website. For example, <code>blog.example.com</code> might be your blog, <code>support.example.com</code> could be your customer help portal, and <code>store.example.com</code> would be your e-commerce site.
Even if you do not require specific subdomains, you might want to set up at least a subdomain record on <code>www</code>. It will usually point to the same content as what you have on the apex domain (<code>example.com</code>) or use a <a href="https://developers.cloudflare.com/fundamentals/manage-domains/manage-subdomains/#redirect-a-subdomain-to-the-apex-domain">redirect</a>. Having a subdomain DNS record on <code>www</code> helps guarantee that a visitor who types <code>www.</code> in front of your domain address can still find your website or application.</details>
- Email records<details><summary>
More about email records</summary>
Depending on your business needs, you can configure DNS records so that you can use your domain to receive emails, receive and send emails from your domain, or prevent others from sending emails on your behalf (spoofing).
Below are some examples of what those DNS records might look like. The exact values for your DNS mail records depend on your email provider. If you have issues, review the <a href="https://developers.cloudflare.com/dns/troubleshooting/email-issues/">Troubleshooting</a> and contact your email service provider to confirm your DNS records are correct.
| Type | Name | Content | Proxy status | TTL |
|---|---|---|---|---|
| A | <code>mail</code> | <code>192.0.2.1</code> | DNS Only | Auto |
| MX | <code>example.com</code> | <code>5 john.mx.example-server.test</code> | DNS Only | Auto |
| TXT | <code>_dmarc</code> | <code>"v=DMARC1; p=reject; sp=...</code> | DNS Only | Auto |
| TXT | <code>*._domainkey</code> | <code>"v=DKIM1; k=rsa; p=..."</code> | DNS Only | Auto |
| TXT | <code>example.com</code> | <code>"v=spf1 ip4:..."</code> | DNS Only | Auto |
Proxy status
Each A, AAAA, and CNAME record has a proxy status toggle:
- Proxied (orange cloud): web traffic goes through the Cloudflare network, which provides caching, DDoS protection, and other security features.
- DNS only (gray cloud): Cloudflare returns the DNS record value but does not proxy traffic. Use this for CNAME records that verify your domain for third-party services.
3. Change your nameservers
Your domain will be assigned two authoritative Cloudflare nameservers. Nameservers are specialized servers that store your domain's DNS records and "answer" requests from browsers by providing the specific IP address needed to connect to your website.
Caution
If your domain is particularly sensitive to downtime, review our suggestions to minimize downtime.
3.1. Get nameserver names
Your assigned nameservers are displayed as part of the onboarding flow. If you need to find them once again, go the zone Overview page.
<details>
<summary>
Required API token permissions
</summary>
At least one of the following <a href="https://developers.cloudflare.com/fundamentals/api/reference/permissions/">token permissions</a> is required:
- <code>Trust and Safety Write</code>
- <code>Trust and Safety Read</code>
- <code>Zero Trust: PII Read</code>
- <code>Zaraz Edit</code>
- <code>Zaraz Read</code>
- <code>Zaraz Admin</code>
- <code>Access: Apps and Policies Revoke</code>
- <code>Access: Apps and Policies Write</code>
- <code>Access: Apps and Policies Read</code>
- <code>Access: Apps and Policies Revoke</code>
- <code>Access: Mutual TLS Certificates Write</code>
- <code>Access: Organizations, Identity Providers, and Groups Write</code>
- <code>Zone Settings Write</code>
- <code>Zone Settings Read</code>
- <code>Zone Read</code>
- <code>DNS Read</code>
- <code>Workers Scripts Write</code>
- <code>Workers Scripts Read</code>
- <code>Zone Write</code>
- <code>Workers Routes Write</code>
- <code>Workers Routes Read</code>
- <code>Stream Write</code>
- <code>Stream Read</code>
- <code>SSL and Certificates Write</code>
- <code>SSL and Certificates Read</code>
- <code>Logs Write</code>
- <code>Logs Read</code>
- <code>Cache Purge</code>
- <code>Page Rules Write</code>
- <code>Page Rules Read</code>
- <code>Load Balancers Write</code>
- <code>Load Balancers Read</code>
- <code>Firewall Services Write</code>
- <code>Firewall Services Read</code>
- <code>DNS Write</code>
- <code>Apps Write</code>
- <code>Analytics Read</code>
- <code>Access: Apps and Policies Write</code>
- <code>Access: Apps and Policies Read</code>
</details>
Zone Detailsbash
curl "https://api.cloudflare.com/client/v4/zones/$ZONE_ID" \
--request GET \
--header "Authorization: Bearer $CLOUDFLARE_API_TOKEN"
Note
Cloudflare automatically assigns nameservers to a domain and these assignments cannot be changed. For more details, refer to Nameserver assignments.
3.2. Log in to your registrar
Log in to the admin account for your domain registrar. If you do not know your provider, use ICANN Lookup ↗︎.
Note
Depending on your use case, you may have to perform this step on the DNS records management of your domain parent zone, or at a domain reseller, instead. Refer to Nameservers for details.
3.3. Turn off DNSSEC
If your domain has DNSSEC<sup>1</sup> active, you must turn it off at your registrar before replacing nameservers. Changing nameservers while DNSSEC is active can cause your domain to become unreachable. You can re-enable DNSSEC through Cloudflare after your domain is active.
