Built-in Webserver and HTTP API

The PowerDNS Recursor features a built-in built-in webserver that exposes a JSON/REST API. This API allows for controlling several functions and reading statistics.

The following documents contain the information for the PowerDNS API:


To launch the internal webserver, add a webserver to the configuration file. This will instruct PowerDNS to start a webserver on localhost at port 8081, without password protection. By default the webserver listens on localhost, meaning only local users (on the same host) will be able to access the webserver. Since the default ACL before 4.1.0 allows access from everywhere if webserver-address is set to a different value, we strongly advise the use of a password protection. The webserver lists a lot of potentially sensitive information about the PowerDNS process, including frequent queries, frequently failing queries, lists of remote hosts sending queries, hosts sending corrupt queries etc. The webserver does not allow remote management. The following webserver related configuration items are available:

  • webserver: If set to anything but ‘no’, a webserver is launched.
  • webserver-address: Address to bind the webserver to. Defaults to, which implies that only the local computer is able to connect to the nameserver! To allow remote hosts to connect, change to or the physical IP address of your nameserver.
  • webserver-password: If set, viewers will have to enter this password in order to gain access to the statistics.
  • webserver-port: Port to bind the webserver to.
  • webserver-allow-from: Netmasks that are allowed to connect to the webserver

Enabling the API

To enable the API, the webserver and the HTTP API need to be enabled. Add these lines to the recursor.conf:


And restart pdns_recursor, the following examples should start working:

curl -v -H 'X-API-Key: changeme' | jq .
curl -v -H 'X-API-Key: changeme' | jq .

A few examples for zone manipulation follow, first one is to create a forwarding zone:

curl --no-progress-meter -H 'X-API-Key: changeme' -H 'Content-type: application/json' -X POST --data-binary @- http://localhost:8082/api/v1/servers/localhost/zones << EOF | jq
  "name": "example.com.",
  "type": "Zone",
  "kind": "Forwarded",
  "servers": ["", ""],
  "recursion_desired" : false

Example output of the above command:

  "id": "example.com.",
  "kind": "Forwarded",
  "name": "example.com.",
  "records": [],
  "recursion_desired": false,
  "servers": [
  "url": "/api/v1/servers/localhost/zones/example.com."

To delete the forwarding zone added above:

curl --no-progress-meter -H 'X-API-Key: changeme' -X DELETE http://localhost:8082/api/v1/servers/localhost/zones/example.com.