# POST /dns/distribution/connect

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

UrbeStack release 0.2.35 API operation in the dns group.

Connect this server to a DNS distribution network

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

Generate a key for this server's licensed IPv4 address in the Clients tab of the DNS zones section on any node. If this server has no licensed IPv4 address on record, run urbestack-license-check first. The key lists each node's IPv4 address, port, and hostname. It starts with usk_ followed by 20 to 2048 ASCII letters, digits, underscores, or hyphens. Surrounding whitespace is allowed.

A malformed key returns 400. UrbeStack refuses keys that list this server as a node. An existing node must leave its network or stop the network if it is the only node before connecting as a client. UrbeStack contacts every node in the key and needs at least one to accept it. If every node is unreachable, the operation returns 502. If no node accepts the key and a node refuses it, the operation returns the node's 401, 402, or 403.

Set check to true to preview the connection without saving the key or sending zones. The first node to accept the key reports local zones whose names match, are subdomains of, or are parents of zones the network holds for another server. Overlaps are allowed. The preview returns 200 with connected set to false, nodes, and overlaps.

A connection saves the key and returns 202 with connected set to true and job for tracking the initial dns-push job. The job sends every local zone to each node, one request per zone and node. UrbeStack then sends changes as they occur. The timer retries unreachable nodes, nodes that refused the key, and failed deliveries. Replies from the network can identify nodes added later.

## As commands

- [urbestack-dns-connect](https://urbestack.com/docs/commands/urbestack-dns-connect.md): Connects this server as a client of a DNS distribution network so the network's UrbeStack nodes can serve this server's zones.
- [urbestack-dns-push](https://urbestack.com/docs/commands/urbestack-dns-push.md): Sends pending zone updates and deletions to this server's DNS distribution nodes.

## Request body

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

- `key` (string, required): Key from the DNS server's Clients tab, with the usk_ prefix followed by a base64url-encoded value.
- `check` (boolean): Whether to query the nodes named in the key for a preview without saving any changes.

## 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/connect" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "check": true,
    "key": "panel.port"
  }'
```

Response, 200 OK:

```
{
  "connected": true,
  "nodes": [
    {
      "address": "info@example.com",
      "host": "text",
      "port": 8443
    }
  ],
  "overlaps": [
    {
      "name": "alice",
      "relation": "same",
      "server": "text",
      "zone": "text"
    }
  ]
}
```

## Errors

- 400: --key or --key-stdin is required
- 400: A new job is queued or running
- 400: Domain name required
- 400: Domain name too long
- 400: Invalid <what>: 
- 400: Invalid IPv4 address
- 400: Invalid IPv6 address
- 400: Invalid domain name
- 400: Invalid port
- 400: Invalid setting key
- 400: Invalid username: 2 to 32 lowercase letters, digits or underscores, starting with a letter
- 400: Job parameters must be an object
- 400: This is not a key from an UrbeStack distribution network. A key starts with usk_ and comes from the Clients tab of one of the network's nodes
- 400: This is not a key from an UrbeStack distribution network. It does not carry the address, port and hostname of each node
- 400: This key names this server's own address, <me>, as a node of the network. Use it on the server it was generated for
- 400: Unknown job type
- 400: Username '<value>' is reserved
- 401: Authentication required
- 402: This server has no licensed address on record yet: run urbestack-license-check first
- 404: Setting '<key>' not found
- 404: User '<user>' not found
