# PUT /dns/distribution/zones/{name}

First published 12 Nov 2026 (release 0.2.28) · Unchanged since publication

UrbeStack release 0.2.35 API operation in the dns group.

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

- Who may call it: anyone (no token needed)
- Answers: 200 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

- [urbestack-dns-client-note](https://urbestack.com/docs/commands/urbestack-dns-client-note.md): Records when a DNS client last called the API using its key.

## Request body

JSON, the type [DnsDistributionZonePut](https://urbestack.com/docs/api/types/DnsDistributionZonePut.md).

- `rows` (array of DnsDistributionRow, required)
- `hash` (string): 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.
- `hostmaster` (string, 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.
- `serial` (integer): Zone serial on the sending server. The receiving server uses this serial so every node in the network serves the same serial.
- `soa` (object): SOA timers from the sending server, in seconds. The receiving server uses them in the zone's SOA.
  - `expire` (integer)
  - `negative` (integer)
  - `refresh` (integer)
  - `retry` (integer)
- `ttl` (integer): 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

Set $API to the base URL and $TOKEN to the token, as the [API overview](https://urbestack.com/docs/api.md) shows.

```
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

- 400: --address is required
- 400: Domain name required
- 400: Domain name too long
- 400: Invalid IPv4 address
- 400: Invalid IPv6 address
- 400: Invalid domain name
- 400: Invalid email address
- 400: Invalid port
- 400: Invalid setting key
- 400: X-Urbestack-Address must carry the client's own IPv4 address
- 401: Unknown key
- 402: This node refuses changes: <why>
- 403: The call came from <remote> but the server says its address is <said>. A server behind NAT cannot be a client
- 403: This key belongs to the client at <c.address>, and the call came from <remote>
- 403: This server was removed from the distribution network on 
- 404: Setting '<key>' not found
- 410: This server is no longer a node of the distribution network: it 
