niammuddin

remove all record in cloudflare

Jan 19th, 2022 (edited)
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.55 KB | None | 0 0
  1. #!/bin/bash
  2. TOKEN="API-TOKEN"
  3. ZONE_ID="ZONE-ID"
  4.  
  5. curl -s -X GET https://api.cloudflare.com/client/v4/zones/${ZONE_ID}/dns_records?per_page=500 \
  6.     -H "Authorization: Bearer ${TOKEN}" \
  7.     -H "Content-Type: application/json" | jq .result[].id |  tr -d '"' | (
  8.   while read id; do
  9.     curl -s -X DELETE https://api.cloudflare.com/client/v4/zones/${ZONE_ID}/dns_records/${id} \
  10.       -H "Authorization: Bearer ${TOKEN}" \
  11.       -H "Content-Type: application/json"
  12.   done
  13.   )
  14.  
  15.  
  16.  
  17. #source: https://gist.github.com/slayer/442fa2fffed57f8409e0b23bd0673a92
Add Comment
Please, Sign In to add comment