latestOpenAPI 3.0.2cPanel License2026-08-106251554.3 MB

3da41671c02c

DNS
DNS Zones

Create DNS zone

This function creates a DNS zone. If trueowner=user, this function does the following:

  • Adds a DNS entry in the /var/cpanel/users/USER file, where USER represents the trueowner parameter's value.
  • Creates the /etc/vdomainaliases/DOMAIN file, where DOMAIN represents the new zone's domain.
  • Creates the /etc/vfilters/DOMAIN file, where DOMAIN represents the new zone's domain.

When you call this function, the system uses the domain name and IP address that you supply. WHM's standard zone template determines all other zone information.

This function generates the DNS zone's MX record, domain PTR, and A records automatically.

Important:

When you disable the DNS role, the system disables this function.

NOTE:

You cannot use this function to add temporary domains.

get/adddns

Query parameters

domainstring domain required
Example:example.com

The new zone's domain.

ipstring ipv4 required
Example:192.168.0.20

The domain's IP address.

ipv6string ipv6 nullable
Example:2001:0db8:0:0:1:0:0:1

The domain's IPv6 address.

templatestring
Example:standard

The zone file template.

  • standard
  • simple
  • standardvirtualftp
  • The name of a custom zone template file in the /var/cpanel/zonetemplates directory.
trueownerstring username nullable
Example:user

The new zone's owner. This parameter defaults to the currently-authenticated user.

Response

HTTP Request was successful.

Example response

{
  "metadata": {
    "command": "adddns",
    "reason": "Added example.com ok belonging to user user",
    "result": 1,
    "version": 1
  }
}