1
Fork 0
satellite/scripts/dns/delete-all-records.sh

11 lines
460 B
Bash
Raw Normal View History

2024-05-09 04:12:28 +02:00
zoneid=$1
bearer=$2
# Taken from https://developers.cloudflare.com/dns/zone-setups/troubleshooting/delete-all-records/
curl --silent "https://api.cloudflare.com/client/v4/zones/$zoneid/dns_records?per_page=50000" \
--header "Authorization: Bearer $bearer" \
| jq --raw-output '.result[].id' | while read id
do
curl --silent --request DELETE "https://api.cloudflare.com/client/v4/zones/$zoneid/dns_records/$id" \
--header "Authorization: Bearer $bearer"
done