OPNsense Forum

English Forums => 26.1, 26,4 Series => Topic started by: gspannu on April 16, 2026, 10:37:08 AM

Title: Unbound adblocking enable & disable using API - curl command ?
Post by: gspannu on April 16, 2026, 10:37:08 AM
Help needed....

Does anyone know as to how to use the API to enable & disable Unbound Blocklists using an API?

I have Unbound setup with a few blocklists and combination of source nets; so most of the time Unbound Blocklists can keep running.

However, there are times when other family members use laptops/machines (that are a part of the blocklists) but just need Ad-Unblocking for a short duration. Expecting them to login into the GUI in OPNsense to disable this is a bridge too far.


Q: Is there a global API (or some mechanism without having to log into OPNsense GUI) to temporarily disable all blocklists and then enable them later.

Q: Is there a quick way to do this via a simple curl command that can execute a preformed API call?  I can then create a shortcut on these machines that can be used to turn on/off Unbound blocking.

I have tried reading into the API docs, but unable to figure it out...
Title: Re: Unbound adblocking enable & disable using API - curl command ?
Post by: Patrick M. Hausen on April 16, 2026, 12:44:44 PM
May I suggest considering to use AdGuard Home instead for DNS blocking? There are nice mobile apps that let you disable filtering with a single tap - for 1 minute, 5 minutes, 1 hour ... etc.
Title: Re: Unbound adblocking enable & disable using API - curl command ?
Post by: nero355 on April 16, 2026, 03:14:40 PM
Quote from: Patrick M. Hausen on Today at 12:44:44 PMThere are nice mobile apps that let you disable filtering with a single tap - for 1 minute, 5 minutes, 1 hour ... etc.
To be honest : People should really avoid needing such a feature!

Is it really that hard to simply check your Pi-Hole Query Log (or the same in AdGuard) and figure out what is being blocked and solve the issue once and for all ?!
Nothing personal by the way. Talking about people in general!

And in the worst case you even have the option to use some kind of DoH/DoT feature in Mozilla Firefox for example to check if your adblocker is the issue at all :)
Title: Re: Unbound adblocking enable & disable using API - curl command ?
Post by: gspannu on April 16, 2026, 04:07:28 PM
Quote from: Patrick M. Hausen on Today at 12:44:44 PMMay I suggest considering to use AdGuard Home instead for DNS blocking? There are nice mobile apps that let you disable filtering with a single tap - for 1 minute, 5 minutes, 1 hour ... etc.

I have been using AGH for a long time, but was keen to start using Unbound and remove all (non-native components from OPNsense). hence, the query...
Title: Re: Unbound adblocking enable & disable using API - curl command ?
Post by: gspannu on April 16, 2026, 04:11:42 PM
Quote from: nero355 on Today at 03:14:40 PMTo be honest : People should really avoid needing such a feature!

Is it really that hard to simply check your Pi-Hole Query Log (or the same in AdGuard) and figure out what is being blocked and solve the issue once and for all ?!
Nothing personal by the way. Talking about people in general!

And in the worst case you even have the option to use some kind of DoH/DoT feature in Mozilla Firefox for example to check if your adblocker is the issue at all :)

It is not about whether I can analyse and check what websites are being blocked and then whitelist these permanently, its about other users in the home who are not that tech-savvy... and for the times that I am not available to do the same.

Hence, my request for a API call (I know that it exists, as the OPNsense API documentation does refer to adblocking... I just haven't been able to get my head around it to make it work !) - if anyone who understands API can help; then it would be much appreciated.