Error when adding multiple domains into Cloudflare using API

I used the step given by Cloudflare to add multiple domains into Cloudflare but get below error.

{“success”:false,“errors”:[{“code”:6007,“message”:“Malformed JSON in request body”}],“messages”:,“result”:null}

Step used:
export [email protected]
export CF_API_KEY=abc123def456ghi789
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”
“(https)://api.Cloudflare.com/client/v4/zones”
–data ‘{“account”: {“id”: “id_of_that_account”}, “name”:"’$domain’",“jump_start”:true}'; done

I put bracket for https because link was not allowed in topic.
It was working before and I have no idea why its not working anymore.

Can you post that in a code block like this please? Otherwise the forum makes changes to it, messing up the quotation marks and such. Put ``` before and after

I posted how I do it on my blog How To Bulk Domain Transfer To Cloudflare Registrar And Save On Domain Renewal Costs - Centmin Mod Blog

for domain in $(cat domains.txt); do \
  curl -sX POST -H "X-Auth-Key: $CF_API_KEY" -H "X-Auth-Email: $CF_API_EMAIL" \
  -H "Content-Type: application/json" \
  "https://api.cloudflare.com/client/v4/zones" \
  --data '{"name":"'$domain'","account":{"id":"'$CF_ACCOUNT_ID'"},"jump_start":true,"type":"full"}' | tee -a result.txt; done
1 Like

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.