Cannot bulk delete dns records, and API not working

I had a wildcard dns when adding my domain, so Cloudflare things the right thing do to is to brute test random names and add 200 dns records out of thin air to my DNS setup.

Then also Cloudflare thinks there is no need to “delete all” button on the dns records.

I am told to delete and add the domain again after removing dns wildcard record, but the domain is now registered at Cloudflare, I delete domain, add it back and records are there again.

Then I am told I should be able to skip dns “importing” when adding the site, so I delete domain again, I add it again, there is no step to skip dns creation.

Then I am told I can remove the stupid DNS records by API, so I make this API call to retrieve dns records and I only get ONE record back, when the domain shows over 100 now in Cloudflare interface.

curl -X GET "[ZONE-ID]/dns_records?type=A&" -H "X-Auth-Email: [email protected]" -H "Authorization: Bearer [KEY]" -H "Content-Type: application/json"
{"result":[{"id":"[ID]","zone_id":"[ZONE ID]","zone_name":"","name":"","type":"A","content":"","proxiable":true,"proxied":true,"ttl":1,"locked":false,"meta ...

I am irritated as ■■■■, why the heck can’t Cloudflare add a “delete all records” button ? Even if API would somehow work, how does anyone things this is usable to make all kind of custom coding each time I want to manage one of my domains ?

Well, you’ve asked for the 1 A record that matches the root, no?


I asked for all records for “

name is the specific record name. mail would be the name for, etc - if you want all records under the zone of then you’ve already specified the zone with [ZONE-ID]


Thanks KianNH, I get all records when I just specify zone id without the domain name.

I am in the process of creating the API requests by PHP in order to delete all DNS records (because you need to loop over each one I think).

Call me crazy but I still think a “delete all records” button is just common sense instead of this nonsense :face_with_diagonal_mouth:

Or, you know, trivially detecting that a wildcard record is present and not doing the auto-import. But what do I know?


Would be better if it knew that 200 records with the same IP was a wildcard - or give you the option to skip imports at all - but that’s just my view on it.

But yeah, you need to send a DELETE request for each DNS record’s ID

1 Like



The “solution” with user having to remove it’s one wildcard record before adding a domain is no longer acceptable because if the domain is already transferred to Cloudflare, there will be no wildcard record to delete, and removing domain and adding it back will just place the 200 DNS records back.

You can use @Cyb3r-Jak3’s cloudflare-utils to batch delete unwanted names.

1 Like

You can use @Cyb3r-Jak3’s cloudflare-utils to batch delete unwanted names.

I know, but it’s risky to use someone else’s code to trigger commands on all my domain portfolio. Things can go very wrong.
So many unnecessary complications just because Cloudflare cannot add a “delete all” button.

I was under the impression that Cloudflare is more professional and more business inclined, but I doubt bigger serious businesses go trough such nonsense. I would have moved away if I didn’t already transferred many domains here :face_with_diagonal_mouth:.

I created my own PHP script that loops over all queries and deletes the records, but it took hours when it should take one second to click a STUPID button.

My code is open source on GitHub, so you can review it yourself.

The thing with a delete all button is how many times would you use it? Once probably. Sure would it be nice to have but hard to get an engineer to work on something that would be used once by free customers and probably not at all by business or enterprise customers who would likely not want such a button to exist in case it gets clicked accidentally.

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