Skip to main content

A full-coverage CLI for AdGuard Home, generated from its official OpenAPI spec

Project description

adguard-home-cli

A full-coverage CLI for AdGuard Home. Every endpoint in the AdGuard Home OpenAPI spec, exposed as a typed shell command. Generated from AdGuard Home's official OpenAPI spec using openapi-cli-gen.

Why

A CLI for AdGuard Home has been one of the most-requested community features — with dedicated feature requests asking for scripting, Infrastructure-as-Code, and automated provisioning. The project maintainers have focused on the web UI and DNS engine; there's no official CLI.

This fills the gap: every HTTP API endpoint in AdGuard Home becomes a shell command with typed flags. Useful for:

  • Ansible / homelab provisioning — set filter URLs, block lists, TLS config from a playbook
  • Sync across instances — dump config from one AdGuard Home, apply to another
  • Monitoring scripts — query protection state, blocked counts, query logs
  • Scheduled blocked-services toggles — turn Netflix on for movie night via cron
  • Bulk rule management — add / remove user rules programmatically

Install

pipx install adguard-home-cli

# Or with uv
uv tool install adguard-home-cli

Setup

Point it at your AdGuard Home instance. Note: the REST API is served under /control:

export ADGUARD_HOME_CLI_BASE_URL=http://your-adguard-host:3000/control

Authentication

AdGuard Home uses HTTP Basic auth with your admin credentials:

export ADGUARD_HOME_CLI_USERNAME=admin
export ADGUARD_HOME_CLI_PASSWORD=your-password

The CLI automatically sends the Authorization: Basic ... header on every request.

Quick Start

All commands below have been verified against a live AdGuard Home instance.

# Server status (version, DNS addresses, running state)
adguard-home-cli global status

# Stats summary
adguard-home-cli stats info
adguard-home-cli stats stats

# Filter status (which lists are enabled, update intervals)
adguard-home-cli filtering status

# Add a new blocklist URL. Note: --no-whitelist flag (boolean toggle),
# NOT --whitelist false
adguard-home-cli filtering add-url \
  --name "OISD Full" \
  --url "https://big.oisd.nl/" \
  --no-whitelist

# Refresh all filters
adguard-home-cli filtering refresh

# Set user-defined block rules (--root because --rules expects a list)
adguard-home-cli filtering set-rules --root '{"rules": ["||tracker.example||^", "||ads.example||^"]}'

# Look up a host (debugging)
adguard-home-cli filtering check-host --name doubleclick.net

# Client management
adguard-home-cli clients status
adguard-home-cli clients find

# Safe browsing / parental controls / safe search
adguard-home-cli safebrowsing status
adguard-home-cli parental status
adguard-home-cli safesearch status

# Query log
adguard-home-cli log query --limit 50

# DNS rewrites (local DNS entries)
adguard-home-cli rewrite list
adguard-home-cli rewrite add --domain home.lan --answer 192.168.1.10

# Remove the filter we added earlier
adguard-home-cli filtering remove-url --url "https://big.oisd.nl/" --no-whitelist

Boolean flags use --no-X form

AdGuard's spec has several boolean body fields (whitelist, enabled, etc.). These are rendered as pairs: --whitelist (sets true) or --no-whitelist (sets false). Do not pass --whitelist false or --whitelist true — pydantic-settings won't recognize them and argparse will reject the command.

Discover All Commands

# Top-level groups
adguard-home-cli --help

# Commands in a group
adguard-home-cli filtering --help

# Flags for a specific command
adguard-home-cli filtering add-url --help

Output Formats

Every command accepts --output-format:

adguard-home-cli global status --output-format table
adguard-home-cli stats info --output-format yaml
adguard-home-cli filtering status --output-format raw

Command Groups

Group What it covers
global Server status, DNS config, protection toggle, profile, updates
install Initial setup wizard (address discovery, configure, check-config)
filtering Block lists, allow lists, user rules, host lookup, refresh
clients Per-client access lists and settings
dhcp DHCP server + static leases
log Query log config + search
stats Query statistics + config
blocked-services Time-scheduled service blocking (Netflix, TikTok, etc.)
safebrowsing Google Safe Browsing toggle
parental Parental control toggle
safesearch Safe search enforcement
rewrite Local DNS rewrites (map domains to IPs)
tls HTTPS / DNS-over-TLS / DNS-over-HTTPS config
mobileconfig Generate iOS/macOS mobile config profiles
i18n UI language

Real Example: Bootstrap a New AdGuard Home Instance

#!/usr/bin/env bash
set -e

export ADGUARD_HOME_CLI_BASE_URL=http://new-adguard:3000/control
export ADGUARD_HOME_CLI_USERNAME=admin
export ADGUARD_HOME_CLI_PASSWORD=$ADMIN_PASSWORD

# Add block lists
adguard-home-cli filtering add-url --name "OISD"        --url "https://big.oisd.nl/"            --no-whitelist
adguard-home-cli filtering add-url --name "StevenBlack" --url "https://raw.githubusercontent.com/StevenBlack/hosts/master/hosts" --no-whitelist

# Refresh
adguard-home-cli filtering refresh

# Add local rewrites
adguard-home-cli rewrite add --domain router.lan --answer 192.168.1.1
adguard-home-cli rewrite add --domain nas.lan    --answer 192.168.1.20

# Enable safe browsing + parental
adguard-home-cli safebrowsing enable
adguard-home-cli parental    enable

# Verify
adguard-home-cli global status --output-format json | jq .protection_enabled

How It Works

This package is a thin wrapper:

  • Embeds the AdGuard Home OpenAPI spec (spec.yaml)
  • Delegates CLI generation to openapi-cli-gen at runtime

Since it's spec-driven, new AdGuard Home endpoints show up automatically on regeneration — no manual wrapping.

License

MIT. Not affiliated with AdGuard — this is an unofficial community CLI built on top of their public OpenAPI spec.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

adguard_home_cli-0.1.1.tar.gz (17.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

adguard_home_cli-0.1.1-py3-none-any.whl (18.8 kB view details)

Uploaded Python 3

File details

Details for the file adguard_home_cli-0.1.1.tar.gz.

File metadata

  • Download URL: adguard_home_cli-0.1.1.tar.gz
  • Upload date:
  • Size: 17.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.9

File hashes

Hashes for adguard_home_cli-0.1.1.tar.gz
Algorithm Hash digest
SHA256 863c7038d8f39adb0749b1bc20cbec0319fb80651f8a3a3e470aa100bdd88729
MD5 954476aa140c5324bb8d3be54a4c0e0e
BLAKE2b-256 0820a11980b8191f2d3a2956aeb04581d27245224f4e9fb273cea5d25f038625

See more details on using hashes here.

File details

Details for the file adguard_home_cli-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for adguard_home_cli-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 d7192c35106824f3f84dee3917a6c50fa42c09210e34faba2e1dde9327f39454
MD5 068c00ee3c36c9dc7a1a8116cd51895a
BLAKE2b-256 5e9f5bd3be55a08d0cfbadff9eed34c699db067f12c04df4f87af640d24517b2

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page