[HOW-TO] Enable/ Disable Pi-Hole from CLI 🥧

Published by Alicia's Notes 🚀, View original

Pi Hole has an API that can be hit from browser, PostMan or CLI
This is useful for creating a physical button, voice command or automation script

To enable or diable Pi Hole, just hit the following end points
Disable URL : http://pi.hole/admin/api.php?disable&auth=[WEB_PASSWORD]
Enable URL : http://pi.hole/admin/api.php?enable&auth=[WEB_PASSWORD]
Disable for [X] Seconds: http://pi.hole/admin/api.php?disable=[X]&auth=[WEB_PASSWORD]

[WEB_PASSWORD] can be found in /etc/pihole/setupVars.conf
It is a 64-character string with the identifierWEBPASSWORD
It is NOT your pi-hole interface or server password

API Docs: https://discourse.pi-hole.net/t/pi-hole-api/1863

Or, if logged into pi server, run: pihole enable
Docs: https://docs.pi-hole.net/core/pihole-command