v1

latestOpenAPI 3.0.2cPanel License2026-08-06657427.1 MB
DNS

Update IP addresses in zone files

This function replaces a domain's IPv4 address in the DNS zone file with the specified destination IPv4 address.

get/DNS/swap_ip_in_zones

Query parameters

dest_ipstring ipv4 required
Example:192.0.2.1

The IPv4 address to use as the replacement in the zone files.

domainstring domain required
Example:example.com

The domain to perform the zone file updates on.

Note:

To update multiple domains, increment or duplicate the parameter name. For example, domain-0, domain-1, and domain-2.

ftp_ipstring ipv4
Example:192.0.2.1

The IPv4 address to use as the replacement for FTP records in the zone files.

If this parameter is not provided, then the system will use the dest_ip value.

source_ipstring ipv4
Example:192.0.2.0

The IPv4 address to replace in the zone files. The detected source IPv4 address is one of:

  • If there is an A record for the root of the zone and the IP address is not a loopback address, then the system will use its address.
  • If there are any A records in the zone whose addresses are not loopback addresses, then the system will use the address of the first such A record in the zone file.
  • If no A records exist in the zone or all A records have loopback addresses, then the system will not update the zone file.

If you do not call this parameter, the system will automatically detect the IP addresses in the zone files.

Response

HTTP Request was successful.

apiversioninteger

The version of the API.

funcstring

The name of the method called.

modulestring

The name of the module called.

Example response

{
  "apiversion": 3,
  "func": "swap_ip_in_zones",
  "module": "DNS",
  "result": {
    "data": [
      {
        "zone_name": "example.com",
        "record_name": "example.com",
        "record_type": "A",
        "old_value": "192.0.2.0",
        "new_value": "192.0.2.1"
      }
    ],
    "status": 1
  }
}