Adguard Home REST To Disable Protection On A Separate Server

Hey guys,

How do I get this to work? It says “403 Forbidden”. I don’t know how to correctly pass it in.

curl -X POST "http://Adguard_IP_Address:8083/control/protection" \
  -H "Accept: application/json" \
  -H "Content-Type: application/json" \
  -H "Authorization: Basic 'echo -n "admin_username:admin_password" | base64'"\
  -d '{"enabled":false,"duration":60000}'

This is what I have so far:

rest_command:
  adguard_disable_5_min:
    url: http://192.168.1.1:8080/control/protection
    method: POST
    headers:
      Authorization: !secret adguard_auth_header
      Content-Type: 'application/json'
    payload: '{ "enabled" : false, "timer" : 300000 }'
    content_type:  'application/json; charset=utf-8'
    verify_ssl: false

secrets.yaml

adguard_auth_header: Basic 'echo -n "admin_username:admin_password" | base64'

Out of curiosity, is there a reason why you are manually composing a REST query instead of using the built-in AdGuard integration?

To address your question, 403 almost certainly means your auth header is wrong. I would first try using a fixed string instead of piped commands in the secrets file, but I’m not an expert in http auth headers so maybe someone else knows better what AdGuard is expecting.

I forgot to mention it is not running on HASS. I don’t think the integration can connect to external instances.

I’m using it to connect to AdGuard Home running on my OpenWrt router.

Thanks. It was not clear to me in the documentation if it was for the addon or any server. I’m running it directly on my main router.