/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
- Dashboard
- CLI
Go to Settings → API tokens → Create token. This needs the Manage API tokens permission
(
tokens.manage), which the Owner role has.- A division. It can only reach zones in the division it was created in.
- Permissions: any of
zones.read,records.write,zones.writeandlogs.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.
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, and the Dynamic DNS endpoint. Account, user, role and settings endpoints always need a normal sign-in.Authentication
Send the token as a Bearer token: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
GET /api/divisions/{id}/zones, or with dnz --json zone list.
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.
Settings
Response rate limiting and the GeoIP database.
Proxy
Proxies, routers, services and middlewares.