Skip to content

Instantly share code, notes, and snippets.

@anabelle
Created November 20, 2017 17:19
Show Gist options
  • Save anabelle/732e98f959376c85594957971c78cb60 to your computer and use it in GitHub Desktop.
Save anabelle/732e98f959376c85594957971c78cb60 to your computer and use it in GitHub Desktop.
A node.js script to change the paused status of all the sites under a cloudflare account at once.
// run 'npm install cloudflare' before running this script
var cf = require('cloudflare')({
email: '[email protected]', // Your cloudflare account email
key: 'yourapikey' // Your cloudflare api key, found in CLoudflare > My profile
});
cf.zones.browse({per_page: 60}).then( function( resp ){
for (var i = resp.result.length - 1; i >= 0; i--) {
console.log( "domain: ", resp.result[i].name );
cf.zones.edit( resp.result[i].id, { paused: true } ).then( function( resp ){ // change to paused: false when you want to unpause.
console.log("Paused: ", resp );
});
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment