Skip to content

Instantly share code, notes, and snippets.

@ducbo
Created March 4, 2022 12:20
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save ducbo/31d22f1fdea4e8f033abb311ade3692e to your computer and use it in GitHub Desktop.
Save ducbo/31d22f1fdea4e8f033abb311ade3692e to your computer and use it in GitHub Desktop.
Delete all cloudflare records
curl -s -X GET https://api.cloudflare.com/client/v4/zones/${ZONE_ID}/dns_records?per_page=500 \
-H "X-Auth-Email: ${EMAIL}" \
-H "X-Auth-Key: ${KEY}" \
-H "Content-Type: application/json" | jq .result[].id | tr -d '"' | (
while read id; do
curl -s -X DELETE https://api.cloudflare.com/client/v4/zones/${ZONE_ID}/dns_records/${id} \
-H "X-Auth-Email: ${EMAIL}" \
-H "X-Auth-Key: ${KEY}" \
-H "Content-Type: application/json"
done
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment