Adding multiple domains via the API



In the example below for adding multiple domains via the API, what is “id_of_that_account”? The email address associated with your Cloudflare account, or something different? I get “Malformed JSON in request body” errors using the email address.

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 ‘{account: {“id: “id_of_that_account”}, name”:"’$domain’",“jump_start”:true}’; done


Try this. It should return that ID.


That User ID might very well be the one in the URL when you go to


Thanks! I bet it is the one in the dashboard URL.

Still getting that “Malformed JSON in request body” error, but that’s a different topic, I guess.


Can confirm your first suggestion returns your user ID, and your second suggestion is the account ID.

Figured out the JSON error. There’re some mistakes in their example script.


Hi, how have you been able to fix this issue?
I am also planning to add more domains. Regards and thanks


In their example, this line:
–data ‘{account: {“id: “id_of_that_account”}, name”:"’$domain’",“jump_start”:true}’;
should be:
–data ‘{“account” : {“id” : “id_of_that_account”}, “name”:"’$domain’",“jump_start”:true}’;
It worked for me after that.


Thanks, I am using it on Windows and I was not able to get the content from file “domains.txt” as it is not exactly same in Linux. But I am able to do it with a batch file currently, a bit longer as there is the full syntax for each name.