DELETE all records using API


#1

Hi,

Currently I am trying to automate the move of many domains from an existing DNS service provider to Cloudflare. I am using the API to do this: https://api.cloudflare.com/

The problem I encounter is that when I add a new zone via the API then it automatically queries its current DNS settings and adds them into Cloudflare.

Is it possible to change this behavior so when a new zone is added it gets added with no records at all? Or is there an API call that I can use to DELETE all current records rather than one by one?

Please let me know.
Thanks in advance.


#2

Hey there,

There isn’t a bulk delete call, I’m afraid. However, you should be able to script this.
List the DNS records, filter for the ID and pass that into the delete call.
Hope this helps.


#3

Hi,

Too bad. Then I guess I will have to do the lookup first.

Thanks!


#4

If you add the zone via API I believe you can tell us not to scan existing records:

https://api.cloudflare.com/#zone-create-a-zone

Set jump_start to false. Obviously at that point you’re on the hook for creating whatever DNS records need to be created in your zone (via API, BIND file import or manual creation).

HTH,

Chris


#5

Thanks!. That is exactly what I was looking for.


#6

Me again,

What if I am using the host API at https://api.cloudflare.com/host-gw.html with a partners.cloudflare.com account?

I tried to pass the -d ‘jump_start=false’ to https://api.cloudflare.com/host-gw.html but that did not do anything

Please let me know
Thanks!


#7

Hmm… I don’t see it listed in our internal docs either. We are working on improving parity/ consolidating some APIs to make things easier for partners and this may be on the list.

Course I could also be just flat out wrong, I’d recommend pinging support to see if they have a better answer. They’re way smarter than I am when it comes to the partner APIs. :wink: