# POST /dns/replace

First published 14 Oct 2026 (release 0.2.0) · Last changed 26 Nov 2026 (release 0.2.35)

UrbeStack release 0.2.35 API operation in the dns group.

Replace an IP address or hostname in DNS records

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

Supply distinct from and to values of the same kind. UrbeStack matches whole IPv4 addresses in A records and SPF ip4: terms, whole IPv6 addresses in AAAA records and SPF ip6: terms, and whole hostnames in CNAME, MX, and SRV targets, regardless of who added the records. Use skip with a record ID or with ZONE:NAME:TYPE for a glue record drawn from the server's identity. Replacement includes the records UrbeStack maintains for the server, including its hostname's IP address and mail records and the nameservers' glue records. As in the zone editor, changing one of these records makes its record set manually maintained in that zone. Replacement skips delegations.

Template records that follow dns.ipv4 or dns.ipv6 take the new value and become manually maintained. If another record in the zone already has the same name, type, and new content, UrbeStack removes the old record. Each affected zone gets a new serial and is reloaded.

Supply zone to apply the replacement immediately and receive 200 with the result and publication outcome. Omit zone to queue a dns-replace job that applies the replacement across all zones. That response returns 202 with the job.

After trimming surrounding whitespace, from and to must contain 1 to 255 characters, excluding internal whitespace and U+0000 through U+001F. A missing from or to, a value that fails these checks, or a skip value other than an array or null returns 400.

## As commands

- [urbestack-dns-replace](https://urbestack.com/docs/commands/urbestack-dns-replace.md): Replaces an IP address or hostname across DNS zones, regardless of who added the matching records.
- [urbestack-dns-replace](https://urbestack.com/docs/commands/urbestack-dns-replace.md): Replaces an IP address or hostname across DNS zones, regardless of who added the matching records.

## Request body

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

- `from` (string, up to 255 characters, required): Value to find, which must be an IPv4 address, an IPv6 address, or a hostname.
- `to` (string, up to 255 characters, required): Replacement value, which must be of the same kind as from.
- `skip` (array of value): Records the GET /dns/replace preview listed that the change leaves alone, equivalent to unticking them in the web interface. Use a record ID, or ZONE:NAME:TYPE for a glue record drawn from the server's identity because it has no ID.
- `zone` (DomainName): Name of the zone to update immediately. Omit this field to apply the replacement across all zones as a job.

## 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/replace" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "from": "text",
    "skip": [
      "text"
    ],
    "to": "text",
    "zone": "example.com"
  }'
```

Response, 200 OK:

```
{
  "changes": [
    {
      "detached": true,
      "from": "text",
      "id": 1,
      "name": "alice",
      "removed": true,
      "taken": true,
      "to": "text",
      "type": "rebuild",
      "why": "text",
      "zone": "text"
    }
  ],
  "from": "text",
  "kept": [
    {
      "from": "text",
      "id": 1,
      "name": "alice",
      "type": "rebuild",
      "why": "text",
      "zone": "text"
    }
  ],
  "kind": "ipv4",
  "published": true,
  "records": 1,
  "reload": "text",
  "skipped": 1,
  "to": "text",
  "zone": "text",
  "zones": 1
}
```

## Errors

- 400: --from is required
- 400: --to is required, or --find to look only
- 400: A new job is queued or running
- 400: A record to leave alone is named by its id, or by ZONE:NAME:TYPE for one the panel writes from the identity, not '<s>'
- 400: Domain name required
- 400: Domain name too long
- 400: Invalid <what>: 
- 400: Invalid domain name
- 400: Invalid id
- 400: Invalid username: 2 to 32 lowercase letters, digits or underscores, starting with a letter
- 400: Job parameters must be an object
- 400: The new value must be 
- 400: The old and the new value are the same
- 400: Unknown job type
- 400: Username '<value>' is reserved
- 400: from is the value to look for: an IPv4 address, an IPv6 address or a host name
- 400: skip holds record ids, and ZONE:NAME:TYPE for records the panel writes from the identity, not '<s>'
- 400: skip is a list of record ids, and of ZONE:NAME:TYPE for records the panel writes from the identity
- 400: to is the new value
- 400: to is the new value: an IPv4 address, an IPv6 address or a host name
- 401: Authentication required
- 404: User '<user>' not found
- 404: Zone '<name>' not found

## Change log

Most recent first.

- 0.2.35 · 26 Nov 2026 · Replacement now includes the server's own records. As in the zone editor, replacing one of these records makes its record set manually maintained in that zone. Use ZONE:NAME:TYPE in skip for a glue record because it has no ID.
- 0.2.35 · 26 Nov 2026 · skip accepts ZONE:NAME:TYPE as well as record IDs. A glue record drawn from the server's identity has no ID, so you can skip it by zone, name and type. (from named type [`DnsReplace`](https://urbestack.com/docs/api/types/DnsReplace.md))
- 0.2.35 · 26 Nov 2026 · Added taken and made id nullable. taken marks a record UrbeStack maintains for the server, whose record set becomes manually maintained on replacement. A glue record drawn from the server's identity has id null. (from named type [`DnsReplaceChange`](https://urbestack.com/docs/api/types/DnsReplaceChange.md))
- 0.2.0 · 14 Oct 2026 · First published.
