Created
August 1, 2024 17:10
-
-
Save aleofreddi/b5edf229bf2fb6d6b028c1c779560716 to your computer and use it in GitHub Desktop.
Cloudflare: remove all DNS records for a zone
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
zoneid=<<zoneid>> | |
bearer=<<bearer>> | |
curl \ | |
--header "Authorization: Bearer $bearer" \ | |
-s "https://api.cloudflare.com/client/v4/zones/$zoneid/dns_records?per_page=50000" \ | |
| jq -r '.result[].id' \ | |
| xargs -n 1 -I {} -P 20 -- curl --silent --request DELETE \ | |
--header "Authorization: Bearer $bearer" \ | |
"https://api.cloudflare.com/client/v4/zones/$zoneid/dns_records/{}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment