Get your free beta license ↗
API operation · dns group
PUT

/dns/distribution/zones/{name}

First published 12 Nov 20260.2.28Unchanged since publication

Create or replace a client's DNS zone on a distribution node

Who may call it
Anyone (no token needed)
Token
none
Answers200 OK

Authenticate with the client's DNS distribution key in the Authorization: Bearer KEY header. Send the client's registered IPv4 address in X-Urbestack-Address and make the request from that IPv4 address. A missing or invalid IPv4 address in the header returns 400. A mismatch between the header, the source IPv4 address, and the registered IPv4 address returns 403. If the node's license prevents changes, the operation returns 402.

An unknown key returns 401. For seven days after a client or node is removed from the network, its former key returns 403 with removal details. For seven days after the receiving server leaves or is removed from the network, it returns 410 to clients whose keys it still recognizes and identifies the remaining nodes. Other requests to a server outside the network return 401.

Each entry in rows contains name, type, ttl, priority, and content. rows defaults to an empty array. Send the client's ACME challenges as TXT records. Omit the SOA record and apex NS set from rows because the receiving node generates them. The node validates each record and checks the resulting zone with named-checkzone before storing it. A validation failure or a mismatch between the supplied hash and the hash computed by the node returns 400 before any zone changes are saved.

Use 64 lowercase hexadecimal digits for hash and 1 to 10 digits with no leading zero for serial. hostmaster accepts an email address or a DNS name whose first label identifies the mailbox, up to 320 characters. ttl is the zone's default TTL in seconds, from 1 to 604800. Supply soa as an object with refresh, retry, expire, and negative, or as four space-separated integers in that order. The ranges in seconds are 60 to 604800 for refresh and retry, 3600 to 31536000 for expire, and 0 to 86400 for negative.

The node assigns a new zone to the client and returns 201. For an existing zone held by that client, it replaces the previous records with the submitted records and returns 200. If another client or the receiving server holds the zone, the operation returns 409 and names the current holder. Both success responses include zone, the created flag, the record count in rows, the computed hash, DNS publication details in dns, and the current nameservers and nodes.

As a command

Run as root on the server

Request body

JSON ·DnsDistributionZonePut· 10 fields
rowsarray of DnsDistributionRowRequired
hashstring
SHA-256 hash in hexadecimal of the sorted zone row lines, as computed by the client. The receiving server recomputes the hash and rejects the request if the hashes differ.
hostmasterstring, up to 320 characters
Hostmaster of the sending server, given as a mailbox or a DNS name whose first label is the mailbox name. The receiving server uses it in the zone's SOA so every node in the network serves the same SOA.
serialinteger
Zone serial on the sending server. The receiving server uses this serial so every node in the network serves the same serial.
soaobject
SOA timers from the sending server, in seconds. The receiving server uses them in the zone's SOA.
soa.expireinteger
soa.negativeinteger
soa.refreshinteger
soa.retryinteger
ttlinteger
Default zone TTL in seconds on the sending server. The receiving server sets the zone's $TTL to this value so records without an explicit TTL have the same TTL on every node.

Example

See the API overview for how to set $API and $TOKEN.
Request
curl -sS -X PUT "$API/dns/distribution/zones/{name}" \
  -H "Content-Type: application/json" \
  -d '{
    "hash": "text",
    "hostmaster": "text",
    "rows": [
      {
        "content": "text",
        "name": "alice",
        "priority": 1,
        "ttl": 1,
        "type": "rebuild"
      }
    ],
    "serial": 1,
    "soa": {
      "expire": 1,
      "negative": 1,
      "refresh": 1,
      "retry": 1
    },
    "ttl": 1
  }'
Response · 200 OK
{
  "created": true,
  "dns": {},
  "hash": "text",
  "nameservers": [
    "text"
  ],
  "nodes": [
    {
      "address": "info@example.com",
      "hostname": "server.example.com",
      "ipv4": "text",
      "ipv6": "text",
      "nameservers": [
        "text"
      ],
      "port": 8443
    }
  ],
  "rows": 1,
  "zone": "text"
}

Errors

17 errors, each a status and a sentence
400--address is required
400Domain name required
400Domain name too long
400Invalid IPv4 address
400Invalid IPv6 address
400Invalid domain name
400Invalid email address
400Invalid port
400Invalid setting key
400X-Urbestack-Address must carry the client's own IPv4 address
401Unknown key
402This node refuses changes: <why>
403The call came from <remote> but the server says its address is <said>. A server behind NAT cannot be a client
403This key belongs to the client at <c.address>, and the call came from <remote>
403This server was removed from the distribution network on
404Setting '<key>' not found
410This server is no longer a node of the distribution network: it
Generated from release 0.2.35 (current) · the API’s own descriptionThis entry has been unchanged since it was first published in release 0.2.28 on 12 Nov 2026.
urbestack.com/docs/api/put-dns-distribution-zones-name/