The DNS “import” button adds each record listed in the uploaded file. It would be nice to have a similar “batch delete” button that deletes each record listed in the uploaded file.
I agree and I know this has come up in the past, this may get merged with the earlier request. Best option at the moment is the API, Cloudflare API Documentation
1 Like
If you are not prepared to write your own, there is a nice toolset available from a Cloudflare Community member.
1 Like
Ended up using the API, thanks. I did pip install cloudflare
, generated a token online with DNS edit permissions, and then used the following script.
#!/usr/bin/env python3
import sys
import CloudFlare
with open('token') as f:
token = f.read().strip()
cf = CloudFlare.CloudFlare(token=token)
zones = cf.zones.get()
id = zones[0]['id']
todo = set()
for line in sys.stdin:
name,addr = line.split()
todo.add((name,addr))
dns_records = cf.zones.dns_records.get(id,params={'per_page':10000})
for r in dns_records:
if r['type'] != 'A': continue
if (r['name'],r['content']) not in todo: continue
cf.zones.dns_records.delete(id,r['id'])
1 Like
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.