Skip to main content
Everything the dashboard does goes through DNZ’s HTTP API under /api. The CLI uses the same API. For automation (Terraform, scripts, CI, ACME DNS-01 certificates), use an API token.

API tokens

Creating a token

Go to Settings → API tokens → Create token. This needs the Manage API tokens permission (tokens.manage), which the Owner role has.
A token has:
  • A division. It can only reach zones in the division it was created in.
  • Permissions: any of zones.read, records.write, zones.write and logs.read.
  • Zones: every zone in the division, or only some. A token limited to some zones can’t create new zones.
  • An expiry: 30 days, 90 days, 1 year, or never.
The token (dnz_…) is shown once, when it is created. DNZ only stores its hash. If you lose it, revoke it and create a new one.

A token never has more rights than its creator

You can only give a token permissions you have yourself in that division. The rights are checked again every time the token is used, so when the creator loses a right, the token loses it too. Every change made with a token appears in the audit log as <creator> via <token name>.

What a token can reach

Tokens can only call the zone, record, query log and ACME endpoints, the Dynamic DNS endpoint, and pushing a DHCP server’s lease file and reading leases and IPAM (DHCP). Account, user, role and settings endpoints always need a normal sign-in.

Authentication

Send the token as a Bearer token:
HTTP Basic works too, with the token as the password and any username. This is what lego and Traefik use:
GET /api/token answers with the token’s name, division, permissions and the zones it can reach, which makes it a handy check in scripts. See Token info.

Errors

Errors come back as JSON with an HTTP status:

Example: adding a record

Find a zone’s id with GET /api/divisions/{id}/zones, or with dnz --json zone list.
There is no DNZ Terraform provider yet. A generic REST provider works with these endpoints; see Terraform.

Endpoints

Zones

List, create, change, delete, export and refresh zones; the query log; token info.

Records

The record format, filtering and bulk changes.

ACME and Dynamic DNS

DNS-01 challenges for lego, Traefik and certbot; DynDNS2 for routers.

Filtering

Blocklists, rules, client groups, schedules, safe search and response policy zones.

DHCP and IPAM

DHCP servers, lease file pushes, leases, subnets and conflicts.

Settings

Response rate limiting and the GeoIP database.

Proxy

Proxies, routers, services and middlewares.