{{define "content"}} {{$csrf := .CSRF}}

Settings

Server configuration, stored in the database.

{{template "settingsnav" .}}
API tokens
{{if .Data.Tokens}}
{{range .Data.Tokens}} {{end}}
NamePrefixCreated Last usedStatusActions
{{.Name}} {{if .Description}}
{{truncate 70 .Description}}
{{end}}
vibedns_{{.Prefix}}… {{timeAgo .CreatedAt}} {{if .LastUsedAt}}{{timeAgo .LastUsedAt}}{{else}}never{{end}} {{statusWord .Enabled}}
{{template "postform" dict "Action" (printf "/settings/api/tokens/%d/toggle" .ID) "CSRF" $csrf "Fields" (dict "enabled" (boolstr (not .Enabled))) "Icon" (toggleIcon .Enabled) "Class" "btn btn-sm btn-outline-secondary" "Title" (printf "%s this token" (toggleVerb .Enabled))}} {{template "confirmform" dict "Action" (printf "/settings/api/tokens/%d/delete" .ID) "CSRF" $csrf "Icon" "bi-trash" "Title" "Revoke permanently" "Message" (printf "Revoke the token %q? Any automation using it will stop working immediately." .Name)}}
{{else}}
{{template "empty" dict "Icon" "bi-key" "Title" "No API tokens yet" "Message" "A token lets a script use the REST API without the administrator password. Tokens are stored hashed, shown only once when created, and can be revoked individually."}}
{{end}}
Using the API

Every resource lives under /api/v1. Authenticate with a bearer token, or with the administrator's HTTP Basic credentials.

List zones
curl -H "Authorization: Bearer $VIBEDNS_TOKEN" \
  {{default "http://127.0.0.1:8080" .Data.BaseURL}}/api/v1/zones
Add an A record
curl -X POST -H "Authorization: Bearer $VIBEDNS_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"name":"www","type":"A","data":"192.0.2.10","ttl":3600}' \
  {{default "http://127.0.0.1:8080" .Data.BaseURL}}/api/v1/zones/1/records
Import a blocklist
curl -X POST -H "Authorization: Bearer $VIBEDNS_TOKEN" \
  --data-binary @hosts.txt \
  {{default "http://127.0.0.1:8080" .Data.BaseURL}}/api/v1/blacklists/1/import
How tokens are stored

A token is 256 bits from the system random source. Only a short prefix — enough to find the right row — and a SHA-256 hash are stored; the token itself is shown once, at creation, and cannot be recovered afterwards.

A fast hash is appropriate here precisely because a token is not a human-chosen password: there is no small guess space to search, and the hash is verified on every API request.

Tokens carry the same authority as the administrator over the API, but cannot be used to sign in to this interface or to change the administrator's credentials.

{{end}}