2024-07-10 19:49:07 +03:00
# AdGuard DNS debug HTTP API
2022-08-26 14:18:35 +03:00
2024-07-10 19:49:07 +03:00
The AdGuard DNS debug HTTP API is served on [`LISTEN_PORT` ][env-listen_port] and contains various private debugging information.
2022-08-26 14:18:35 +03:00
2024-07-10 19:49:07 +03:00
## Contents
2022-08-26 14:18:35 +03:00
2024-07-10 19:49:07 +03:00
- [`GET /health-check` ](#health-check )
- [`GET /metrics` ](#metrics )
- [`GET /debug/pprof` ](#pprof )
- [`POST /debug/api/refresh` ](#api-refresh )
- [`POST /dnsdb/csv` ](#dnsdb-csv )
2022-08-26 14:18:35 +03:00
[env-listen_port]: environment.md#LISTEN_PORT
2024-07-10 19:49:07 +03:00
## <a href="#health-check" id="health-check" name="health-check">`GET /health-check`</a>
2022-08-26 14:18:35 +03:00
2024-07-10 19:49:07 +03:00
A simple health check API. Always responds with a `200 OK` status and the plain-text body `OK` .
2022-08-26 14:18:35 +03:00
2024-07-10 19:49:07 +03:00
## <a href="#metrics" id="metrics" name="metrics">`GET /metrics`</a>
2022-08-26 14:18:35 +03:00
2024-07-10 19:49:07 +03:00
Prometheus metrics HTTP API. See the [metrics page][metrics] for more details.
2022-08-26 14:18:35 +03:00
2024-07-10 19:49:07 +03:00
[metrics]: metrics.md
2022-08-26 14:18:35 +03:00
2024-07-10 19:49:07 +03:00
## <a href="#pprof" id="pprof" name="pprof">`GET /debug/pprof`</a>
2022-08-26 14:18:35 +03:00
2024-07-10 19:49:07 +03:00
The HTTP interface of Go's [PProf HTTP API][pprof api].
2022-08-26 14:18:35 +03:00
2024-07-10 19:49:07 +03:00
[pprof api]: https://pkg.go.dev/net/http/pprof
2022-08-26 14:18:35 +03:00
2024-07-10 19:49:07 +03:00
## <a href="#api-refresh" id="api-refresh" name="api-refresh">`POST /debug/api/refresh`</a>
2022-08-26 14:18:35 +03:00
2024-07-10 19:49:07 +03:00
Run some refresh jobs manually. This refresh does not alter the time of the next automatic refresh.
2022-08-26 14:18:35 +03:00
2024-07-10 19:49:07 +03:00
Example request:
2022-08-26 14:18:35 +03:00
2024-07-10 19:49:07 +03:00
```sh
curl -d '{"ids":["*"]}' -v "http://${LISTEN_ADDR}:${LISTEN_PORT}/debug/api/refresh"
```
2022-08-26 14:18:35 +03:00
2024-07-10 19:49:07 +03:00
Request body example:
2022-08-26 14:18:35 +03:00
2024-07-10 19:49:07 +03:00
```json
{
"ids": [
"filter_storage",
"adult_blocking"
]
}
```
2022-08-26 14:18:35 +03:00
2024-07-10 19:49:07 +03:00
Supported IDs:
2022-08-26 14:18:35 +03:00
2024-07-10 19:49:07 +03:00
- `adult_blocking` ;
- `filter_storage` ;
- `newly_registered_domains` ;
- `safe_browsing` .
2022-08-26 14:18:35 +03:00
2024-07-10 19:49:07 +03:00
The special ID `*` , when used alone, causes all available refresh tasks to be performed. Use with caution.
2022-08-26 14:18:35 +03:00
2024-07-10 19:49:07 +03:00
Response body example:
2022-08-26 14:18:35 +03:00
2024-07-10 19:49:07 +03:00
```json
{
"results": {
"adult_blocking": "ok",
"filter_storage": "ok"
}
}
```
2022-08-26 14:18:35 +03:00
2024-07-10 19:49:07 +03:00
## <a href="#dnsdb-csv" id="dnsdb-csv" name="dnsdb-csv">`POST /dnsdb/csv`</a>
2022-08-26 14:18:35 +03:00
2024-07-10 19:49:07 +03:00
The CSV dump of the current DNSDB statistics. Example of the output:
```csv
example.com,A,NOERROR,93.184.216.34,42
example.com,AAAA,NOERROR,2606:2800:220:1:248:1893:25c8:1946,123
```
The response is sent with the `Transfer-Encoding` set to `chunked` and with an HTTP trailer named `X-Error` which describes errors that might have occurred during the database dump.