# Pihole does not stay disabled after API call to api.php

**URL:** <https://discourse.pi-hole.net/t/pihole-does-not-stay-disabled-after-api-call-to-api-php/14593>\
**Category:** Help\
**Created:** [November 22, 2018, 5:07pm UTC](https://discourse.pi-hole.net/t/pihole-does-not-stay-disabled-after-api-call-to-api-php/14593 "2018-11-22T17:07:00Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![Brayden\_Houston](https://discourse-cdn.pi-hole.net/letter_avatar_proxy/v4/letter/b/b3f665/32.png) [@Brayden\_Houston](https://discourse.pi-hole.net/u/Brayden_Houston)\
**Post date:** [November 22, 2018, 5:07pm UTC](https://discourse.pi-hole.net/t/pihole-does-not-stay-disabled-after-api-call-to-api-php/14593/1 "2018-11-22T17:07:00Z")

</div>

#### Please follow the below template, it will help us to help you!

## Expected Behaviour:

Calls to /admin/api.php should keep Pi-hole disabled for the allotted time specified in the disable parameter.

## Actual Behaviour:

Pi-hole will stay disabled for only a few seconds and then bounce right back up to "active" again. I am passing durations of 500 seconds through. This only seems to be the case when I make calls through the /api.php page. Disabling Pi-hole through the /admin webpage works as expected and will stay down for the selected time.

## Debug Token:

z16p4ywg0r

---

<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:** [November 23, 2018, 8:03pm UTC](https://discourse.pi-hole.net/t/pihole-does-not-stay-disabled-after-api-call-to-api-php/14593/2 "2018-11-23T20:03:08Z")

</div>

What exactly are you doing to make calls to `api.php`?

---

<div class="post-metadata">

**Author:** ![Brayden\_Houston](https://discourse-cdn.pi-hole.net/letter_avatar_proxy/v4/letter/b/b3f665/32.png) [@Brayden\_Houston](https://discourse.pi-hole.net/u/Brayden_Houston)\
**Post date:** [November 23, 2018, 10:21pm UTC](https://discourse.pi-hole.net/t/pihole-does-not-stay-disabled-after-api-call-to-api-php/14593/3 "2018-11-23T22:21:30Z")

</div>

I am making GET requests using Postman. It is not isolated to request made through Postman though.

---

<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:** [November 24, 2018, 4:23pm UTC](https://discourse.pi-hole.net/t/pihole-does-not-stay-disabled-after-api-call-to-api-php/14593/4 "2018-11-24T16:23:50Z")

</div>

Have you compared the requests you make with the ones the web interface makes? There must be some difference.

---

<div class="post-metadata">

**Author:** ![Brayden\_Houston](https://discourse-cdn.pi-hole.net/letter_avatar_proxy/v4/letter/b/b3f665/32.png) [@Brayden\_Houston](https://discourse.pi-hole.net/u/Brayden_Houston)\
**Post date:** [November 24, 2018, 5:31pm UTC](https://discourse.pi-hole.net/t/pihole-does-not-stay-disabled-after-api-call-to-api-php/14593/5 "2018-11-24T17:31:25Z")

</div>

The only difference I can see is that the Web Interface is using it's own API key that is different from the only listed on /admin/scripts/pi-hole/php/api\_token.php. I tried using that web interface key instead but any calls using it outside the web interface are rejected.

---

<div class="post-metadata">

**Author:** ![Brayden\_Houston](https://discourse-cdn.pi-hole.net/letter_avatar_proxy/v4/letter/b/b3f665/32.png) [@Brayden\_Houston](https://discourse.pi-hole.net/u/Brayden_Houston)\
**Post date:** [November 26, 2018, 5:29am UTC](https://discourse.pi-hole.net/t/pihole-does-not-stay-disabled-after-api-call-to-api-php/14593/6 "2018-11-26T05:29:42Z")

</div>

Updated with new debug token.

Is there anything else I can do to figure out what is going on or would it be better to wait for the new Rust REST API to launch?

---

<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:** [November 27, 2018, 11:07pm UTC](https://discourse.pi-hole.net/t/pihole-does-not-stay-disabled-after-api-call-to-api-php/14593/7 "2018-11-27T23:07:53Z")

</div>

Does your call look like the one here, but with an integer assigned to the `disable` parameter?

> [@Is there an API command to disable ad blocking?](https://discourse.pi-hole.net/t/is-there-an-api-command-to-disable-ad-blocking/7693/2):
>
> 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:** ![Brayden\_Houston](https://discourse-cdn.pi-hole.net/letter_avatar_proxy/v4/letter/b/b3f665/32.png) [@Brayden\_Houston](https://discourse.pi-hole.net/u/Brayden_Houston)\
**Post date:** [November 27, 2018, 11:42pm UTC](https://discourse.pi-hole.net/t/pihole-does-not-stay-disabled-after-api-call-to-api-php/14593/8 "2018-11-27T23:42:45Z")

</div>

Currently using (minus the API key),

```
http://pihole/admin/api.php?disable=500&auth=<apikey>

```

Seems to match. Am I missing something? 🤔

---

<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:** [November 28, 2018, 5:43pm UTC](https://discourse.pi-hole.net/t/pihole-does-not-stay-disabled-after-api-call-to-api-php/14593/9 "2018-11-28T17:43:06Z")

</div>

If you're doing that via the command line, make sure to quote the URL. Bash may be doing strange things with the `&` character (and possibly others).

---

<div class="post-metadata">

**Author:** ![system](https://discourse.pi-hole.net/uploads/default/original/3X/7/c/7c8792f649eeb921c5d2b4c41564ffa873d9a2b8.png) [@system](https://discourse.pi-hole.net/u/system)\
**Post date:** [December 19, 2018, 5:43pm UTC](https://discourse.pi-hole.net/t/pihole-does-not-stay-disabled-after-api-call-to-api-php/14593/10 "2018-12-19T17:43:16Z")

</div>

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.
