# Is there an API command to disable ad blocking?

**URL:** https://discourse.pi-hole.net/t/is-there-an-api-command-to-disable-ad-blocking/7693
**Category:** FAQs
**Created:** [March 3, 2018, 12:24am UTC](https://discourse.pi-hole.net/t/is-there-an-api-command-to-disable-ad-blocking/7693 "2018-03-03T00:24:58Z")
**Posts on this page:** 11
**Page:** 1

<div class="post-metadata">

### Author: ![FutureTense](https://discourse-cdn.pi-hole.net/letter_avatar_proxy/v4/letter/f/34f0e0/32.png) [@FutureTense](https://discourse.pi-hole.net/u/FutureTense)
#### Post date: [March 3, 2018, 12:24am UTC](https://discourse.pi-hole.net/t/is-there-an-api-command-to-disable-ad-blocking/7693/1 "2018-03-03T00:24:59Z")

</div>

I’d like to be able to create a bookmark in a browser that will turn off blocking for 5 minutes, just by clicking on the bookmark, with no password authentication. Is this possible? Ideally there would be a token in the bookmark. This could also be controlled with a service like IFTTT.com

---

<div class="post-metadata">

### Author: ![Mcat12](https://discourse-cdn.pi-hole.net/user_avatar/discourse.pi-hole.net/mcat12/32/20_2.png) [@Mcat12](https://discourse.pi-hole.net/u/Mcat12)
#### Post date: [March 3, 2018, 12:33am UTC](https://discourse.pi-hole.net/t/is-there-an-api-command-to-disable-ad-blocking/7693/2 "2018-03-03T00:33:28Z")

</div>

There is no way to do it without authentication. You will need to have this as your bookmark:  
[http://pi.hole/admin/api.php?disable&auth=PWHASH](http://pi.hole/admin/api.php?disable&auth=PWHASH)

Where `PWHASH` is the value of `WEBPASSWORD` in `/etc/pihole/setupVars.conf`  
You can also replace `disable` with `enable` to enable Pi-hole.

---

<div class="post-metadata">

### Author: ![FutureTense](https://discourse-cdn.pi-hole.net/letter_avatar_proxy/v4/letter/f/34f0e0/32.png) [@FutureTense](https://discourse.pi-hole.net/u/FutureTense)
#### Post date: [March 3, 2018, 6:46am UTC](https://discourse.pi-hole.net/t/is-there-an-api-command-to-disable-ad-blocking/7693/3 "2018-03-03T06:46:24Z")

</div>

Is there a way to disable it for only 5 minutes?

---

<div class="post-metadata">

### Author: ![Mcat12](https://discourse-cdn.pi-hole.net/user_avatar/discourse.pi-hole.net/mcat12/32/20_2.png) [@Mcat12](https://discourse.pi-hole.net/u/Mcat12)
#### Post date: [March 3, 2018, 5:59pm UTC](https://discourse.pi-hole.net/t/is-there-an-api-command-to-disable-ad-blocking/7693/4 "2018-03-03T17:59:43Z")

</div>

If you set the `disable` parameter to a number, it will disable it for that many seconds.  
[http://pi.hole/admin/api.php?disable=300&auth=PWHASH](http://pi.hole/admin/api.php?disable=300&auth=PWHASH)

---

<div class="post-metadata">

### Author: ![FutureTense](https://discourse-cdn.pi-hole.net/letter_avatar_proxy/v4/letter/f/34f0e0/32.png) [@FutureTense](https://discourse.pi-hole.net/u/FutureTense)
#### Post date: [March 4, 2018, 6:00pm UTC](https://discourse.pi-hole.net/t/is-there-an-api-command-to-disable-ad-blocking/7693/5 "2018-03-04T18:00:34Z")

</div>

> [@Mcat12](#):
>
> Where PWHASH is the value of WEBPASSWORD in /etc/pihole/setupVars.conf

This should be in the FAQ. Diabling ad blocking for a short period is extremely useful.

---

<div class="post-metadata">

### Author: ![Mcat12](https://discourse-cdn.pi-hole.net/user_avatar/discourse.pi-hole.net/mcat12/32/20_2.png) [@Mcat12](https://discourse.pi-hole.net/u/Mcat12)
#### Post date: [March 4, 2018, 7:13pm UTC](https://discourse.pi-hole.net/t/is-there-an-api-command-to-disable-ad-blocking/7693/6 "2018-03-04T19:13:21Z")

</div>

tada! It is now an FAQ 🎉

---

<div class="post-metadata">

### Author: ![Mcat12](https://discourse-cdn.pi-hole.net/user_avatar/discourse.pi-hole.net/mcat12/32/20_2.png) [@Mcat12](https://discourse.pi-hole.net/u/Mcat12)
#### Post date: [March 4, 2018, 8:28pm UTC](https://discourse.pi-hole.net/t/is-there-an-api-command-to-disable-ad-blocking/7693/7 "2018-03-04T20:28:06Z")

</div>

A post was split to a new topic: [Generate Disable API URL from Web Interface](https://discourse.pi-hole.net/t/generate-disable-api-url-from-web-interface/7744)

---

<div class="post-metadata">

### Author: ![linkcl](https://discourse-cdn.pi-hole.net/letter_avatar_proxy/v4/letter/l/c4cdca/32.png) [@linkcl](https://discourse.pi-hole.net/u/linkcl)
#### Post date: [May 18, 2018, 3:50pm UTC](https://discourse.pi-hole.net/t/is-there-an-api-command-to-disable-ad-blocking/7693/8 "2018-05-18T15:50:18Z")

</div>

Thank you for posting this information in the FAQ. I just found out about it this morning!

Currently this is a bookmark on my wife's phone's homepage where she can disable adblock for her mobile games. I set it up with curl because I plan to do more with it later this weekend. If you wish to use the script you'll need to **install php-curl** and reboot the webservice or device.

Thanks again Mcat12 for posting this information and FutureTense for requesting it.

```
<?php
// create in /var/www/html/<pagename>.php
$PWHASH = rtrim(shell_exec('grep -oPi "(?<=WEBPASSWORD\=).+" /etc/pihole/setupVars.conf'));

$localhost = rtrim(shell_exec('grep -oPi "(?<=IPV4_ADDRESS\=).+" /etc/pihole/setupVars.conf | egrep -o "^[^\/]+"'));

$ch = curl_init("http://${localhost}/admin/api.php?disable=300&auth=${PWHASH}");

$data = curl_exec($ch);
curl_close($ch);
?>

```

Use this with caution.

---

<div class="post-metadata">

### Author: ![t\_heinrich](https://discourse-cdn.pi-hole.net/letter_avatar_proxy/v4/letter/t/958977/32.png) [@t\_heinrich](https://discourse.pi-hole.net/u/t_heinrich)
#### Post date: [August 7, 2019, 4:00pm UTC](https://discourse.pi-hole.net/t/is-there-an-api-command-to-disable-ad-blocking/7693/9 "2019-08-07T16:00:38Z")

</div>

Hello,  
because I don't use the dhcp function of Pi-Hole I tried this URL:

```auto
http://192.168.1.37/admin/api.php?disable=10&auth=MYPASSWORD

```

Unfortunatly it doesn't work.  
With MYPASSWORD I can login into Pi-Hole.

What I'm doing wrong?

Thanks in advance.

 ![32](https://discourse.pi-hole.net/uploads/default/original/2X/4/4d2a91b2a0567524efdfbc9edd19077a5bbc312e.png)

---

<div class="post-metadata">

### Author: ![mibere](https://discourse-cdn.pi-hole.net/user_avatar/discourse.pi-hole.net/mibere/32/18057_2.png) [@mibere](https://discourse.pi-hole.net/u/mibere)
#### Post date: [August 7, 2019, 4:08pm UTC](https://discourse.pi-hole.net/t/is-there-an-api-command-to-disable-ad-blocking/7693/10 "2019-08-07T16:08:30Z")

</div>

If I read the above postings the correct command is

`http://pi.hole/admin/api.php?disable=300&auth=PWHASH`

So don't use your login password but

> Where `PWHASH` is the value of `WEBPASSWORD` in `/etc/pihole/setupVars.conf`

---

<div class="post-metadata">

### Author: ![t\_heinrich](https://discourse-cdn.pi-hole.net/letter_avatar_proxy/v4/letter/t/958977/32.png) [@t\_heinrich](https://discourse.pi-hole.net/u/t_heinrich)
#### Post date: [August 7, 2019, 6:55pm UTC](https://discourse.pi-hole.net/t/is-there-an-api-command-to-disable-ad-blocking/7693/11 "2019-08-07T18:55:44Z")

</div>

Yes you're totally right.  
I was wondering if I should see any changes here when executing the Url-command.

 ![26](https://discourse.pi-hole.net/uploads/default/original/2X/6/6b9688155fb58cb9da7f62479e66c81ed3bf203d.png)
