Mehrere Standorte hinzufügen Cloudflare durch Automatisierung

Wenn Sie versuchen, mehrere Standorte (10 +) Cloudflare auf einmal hinzufügen, können Sie so über die API Cloudflare tun. Hinzufügen von mehreren Standorten kann nützlich sein, wenn Sie:

  • Mehrere Domänen Zuordnung zurück zu einer einzigen, kanonische Domäne - z. B. Domänen in verschiedenen Ländern (.,., etc.), die Sie durch Cloudflare geschützt haben möchten
  • Sind Sie eine Agentur oder IT-Beratung, und verwalten Sie mehrere Domains im Auftrag Ihrer Kunden (Hinweis: sollten Sie unser Partner-Programm!)
  • Eine bestehende Gruppe von Websites bewegen, Cloudflare über

Using the API will allow you to add multiple sites quickly & efficiently, especially if you are already familiar with how to change your name-servers or add a DNS record.


You'll need:

  • An existing account on Cloudflare (sign up / log-in)
  • Basic familiarity with the command line
  • curl installed (by default on macOS & Linux)
  • Your Cloudflare API key at hand
  • A list of domains you want to add, each on a separate line (newline separated) - e.g. "domains.txt"

Adding Domains via the API

Cloudflare has a fully featured API (documentation) that allows you to automate the creation of new domains, as well as configure DNS records, Page Rules and our many security settings. We'll be using this API to automate adding multiple domains at once.

Open your terminal application (e.g. Terminal, or and set your API key & email -

export CF_API_KEY=abc123def456ghi789

Then, we'll write a simple for-loop that takes each domain name 

for domain in $(cat domains.txt); do \
curl -X POST -H "X-Auth-Key: $CF_API_KEY" -H "X-Auth-Email: $CF_API_EMAIL" \
-H "Content-Type: application/json" \
"" \
--data '{"name":"'$domain'","jump_start":true}'; done

The "jump_start" key will have Cloudflare automatically attempt to scan for common DNS records—e.g. "www", "mail", "blog" and many others—so that you don't have to configure them by hand (you should still confirm we found them all).

The API will return a response, including the nameservers you'll need to change at your registrar (where you registered the domain).

"result": {
"id": "abc123def456ghi789",
"name": "",
"status": "pending",
"paused": false,
"type": "full",
"development_mode": 0,
"name_servers": [
"original_name_servers": [
"original_registrar": null,
"original_dnshost": null,
"modified_on": "2018-02-12T01:42:13.827149Z",
"created_on": "2018-02-12T01:42:13.827149Z",
"meta": {
"step": 4,
"wildcard_proxiable": false,
"custom_certificate_quota": 0,
"page_rule_quota": 3,
"phishing_detected": false,
"multiple_railguns_allowed": false
"owner": {
"id": "abc123def456ghi789",
"type": "user",
"email": ""
"account": {
"id": "abc123def456ghi789",
"name": ""
"permissions": [
"plan": {
"id": "0feeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
"name": "Free Website",
"price": 0,
"currency": "USD",
"frequency": "",
"is_subscribed": true,
"can_subscribe": false,
"legacy_id": "free",
"legacy_discount": false,
"externally_managed": false
"success": true,
"errors": [],
"messages": []

Note the "name_servers" key in the response. These will be the same unique pair for all sites you add under your account - e.g.

"name_servers": [

Copy your values (not the ones above!) and update the nameservers at your registrar.

Adding Domains via flarectl (Cloudflare's CLI tool)

You can also add domains using flarectl, Cloudflare's official CLI. You can download a pre-built package for your operating system (Windows, macOS/Darwin, Linux) and create domains using it.

You'll need to set your API credentials first:

export CF_API_KEY=abc123def456ghi789

... and then run the following command in flarectl:

for domain in $(cat domains.txt); do flarectl zone create --zone=$domain --jumpstart=false; done

After this, you can get the name-servers for each domain via "flarectl zone list":

for domain in $(cat domains.txt); do flarectl zone info --zone=$domain; done

Common Issues

If any errors were returned in this process, the domain may not be registered (or only just registered), be a subdomain, or otherwise been invalid. The following articles cover the most common cases:

Not finding what you need?

95% of questions can be answered using the search tool. This is the quickest way to get a response.

Powered by Zendesk