Create New DNS Record (Error Message)


I would like to use the api system to create DNS records according to the Cloudflare documentation.
I have already taken the API from the Cloudflare API v4 page, the ‘zone’ identificator, but I have not been able to build the new DNS record.

I’m using this curl command:
curl -X POST “
-H “X-Auth-Email: [email protected]
-H “X-Auth-Key: API Key generated”
-H “Content-Type:application/json”
–data ‘{“type”:“A”,“name”:“”,“content”:".*.139.91",“ttl”:120,“priority”:10,“proxied”:false}’

If I run this command I get this error message:
{“success”:false,“errors”:[{“code”:10000,“message”:“Authentication error”}]}

But If I run this command:
curl -X POST “
-H “Authorization: Bearer API Key Generated”
-H “Content-Type:application/json”
–data ‘{“type”:“A”,“name”:“”,“content”:".*.139.91",“ttl”:120,“priority”:10,“proxied”:false}’

I get this error message:
{“result”:null,“success”:false,“errors”:[{“code”:9207,“message”:“Content-type must be application/json.”}],“messages”:}

in both cases the request don’t create a new DNS record, what is wrong in these requests?


Do you have the \ in there so it’s read as one continuous line? As this is pasted in as formatted text, it’s difficult to see the actual text you’re sending. How about a screenshot with the sensitive information blacked out?

1 Like

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