fagci

Bulk delete DNS records from Cloudflare

Feb 9th, 2022 (edited)
569
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.38 KB | None | 0 0
  1. curl -s -X GET "https://api.cloudflare.com/client/v4/zones/<ZONE>/dns_records" \
  2.   -H "Content-Type:application/json" -H "Authorization: Bearer <TOKEN>" \
  3.   | awk -vRS='},{' '{print}' \
  4.   | cut -d'"' -f 4 \
  5.   | xargs -I@ bash -c 'curl -X DELETE "https://api.cloudflare.com/client/v4/zones/<ZONE>/dns_records/@" -H "Content-Type:application/json" -H "Authorization: Bearer <TOKEN>"'
Add Comment
Please, Sign In to add comment