# POST /dns/distribution/leave

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

UrbeStack release 0.2.35 API operation in the dns group.

Leave a DNS distribution network as a node

- Who may call it: administrator
- Token scope, any of: dns, all
- Answers: 200 OK

Call as an administrator with a token that has the dns scope, on a node in a network of two or three nodes. The only node in a network receives 409 and must stop the network with urbestack-dns-node-stop.

Use as=client to keep sending this server's zones to the network under its existing key. The network continues to serve its customers' zones. Use as=standalone to serve this server's own zones with the nameservers it used before joining. With as=standalone, zones=keep is the default and retains the last published copies on the network. Use zones=delete to remove those copies. The operation returns 400 if as is missing or invalid, or if zones is supplied with an invalid value. UrbeStack applies zones only in standalone mode.

UrbeStack notifies the other nodes. The first remaining node takes over this server's nameserver name, and UrbeStack updates the corresponding DNS records to the new node's IPv4 address and, if available, its IPv6 address. Update the corresponding host record at the registrar. Resolvers can still query this server until the change takes effect. UrbeStack preserves all local zones and continues to serve frozen copies of zones from other nodes and clients with updates disabled. For seven days, it reports the departure and the remaining nodes to servers that contact it. Unreachable nodes learn of the departure the next time they contact this server, and clients switch to the remaining nodes automatically.

The departure has a 240-second time limit. A 200 response includes left set to true, role, as, zones, at, nameservers, the number of frozen zones in frozen_zones, and the notification results in told.

## As a command

- [urbestack-dns-node-leave](https://urbestack.com/docs/commands/urbestack-dns-node-leave.md): Removes this server from its DNS distribution network and notifies the other nodes.

## Request body

JSON.

- `as` (string, one of client, standalone, required)
- `zones` (string, one of keep, delete)

## 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 POST "$API/dns/distribution/leave" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "as": "client",
    "zones": "keep"
  }'
```

Response, 200 OK:

```
{
  "as": "text",
  "at": "text",
  "frozen_zones": 1,
  "left": true,
  "nameservers": [
    "text"
  ],
  "role": "user",
  "told": [
    {
      "address": "info@example.com",
      "done": true,
      "error": "Domain 'example.com' already exists",
      "host": "text"
    }
  ],
  "zones": "text"
}
```

## Errors

- 400: --as client or --as standalone is required
- 400: --delete-frozen stands alone
- 400: Domain name required
- 400: Domain name too long
- 400: Invalid IPv4 address
- 400: Invalid IPv6 address
- 400: Invalid domain name
- 400: Invalid port
- 400: Invalid setting key
- 400: Leaving says what this server becomes: a client of the network, or standalone
- 400: as is client or standalone
- 400: zones is keep or delete
- 401: Authentication required
- 402: This server has no licensed address on record yet: run urbestack-license-check first
- 404: Setting '<key>' not found
- 409: This server holds no frozen zones
- 409: This server is not a node of a distribution network
- 409: This server is the only node of its network, so there is no network to leave. To go back to standalone, stop the network once it has no clients
