cPanel/DNS
cPanel module

DNS

10 functions, invoked through the cpanel_uapi tool.

scope cpanel:uapi
Call any function with cpanel_uapi(service_id, module="DNS", function, params). Live availability depends on the cPanel features JetHost has enabled on your account — call list_cpanel_operations to see what is active.

ensure_domains_reside_only_locally GET#

Return whether domains only resolve locally

This function indicates whether the account's domains resolve exclusively to this server.

domainstringRequired
The domain to check. Note: To check multiple domains, duplicate or increment the parameter name. For example, to exclude three domains, you could: Use the domain parameter multiple times. Use the domain, domain-1, and domain-2 parameters.

Response — normalized as { ok, data, errors[], warnings[] }; data is an array of:

The results from each domain parameter's DNS query. null - The domain only resolves locally to the server. A valid string that explains to where the domain resolves. Note: The function returns the results from the domains in the same order that you called them.

fetch_cpanel_generated_domains GET#

Retrieve cPanel-generated subdomains for a domain

This function retrieves the list of subdomains that cPanel automatically generates for a given domain. These include proxy subdomains such as webmail, mail, and cpanel, as well as other system-generated domain names.

domainstringRequired
The domain for which to retrieve cPanel-generated subdomains.

Response — normalized as { ok, data, errors[], warnings[] }; data is an array of:

domainstring
A cPanel-generated domain name, returned as a fully-qualified domain name (FQDN) with a trailing dot.

has_local_authority GET#

Return whether local DNS server is authoritative

This function checks whether the local server is authoritative for the domain's DNS records.

domainstringRequired
The domain to check whether the local server is authoritative for the domain's DNS records. Note: To check multiple domains, increment or duplicate the parameter name. For example, domain-0domain-1, and domain-2.

Response — normalized as { ok, data, errors[], warnings[] }; data is an array of:

domainstring
The queried domain.
errorstring
An error message that details the reason why the local server's authoritative check failed. Note: The function only returns this value when the check fails.
local_authorityinteger
Whether the local server is authoritative for the domain's DNS records. 1 — The local server is authoritative for the domain's DNS records. 0 — The local server is not authoritative for the domain's DNS records.
One of: 1 0
nameserversarray<string>
The domain's nameservers, if any exist.
zonestring
The domain's DNS zone, if one exists. * null — No valid DNS zone.

is_alias_available GET#

Return `ALIAS` DNS record availability & resolver

This function returns whether ALIAS and ANAME records are available and the value of the running PowerDNS (PDNS) resolver setting, if any exists. For more information, read our ALIAS documentation.

No parameters.

Response — normalized as { ok, data, errors[], warnings[] }; data contains:

aliasinteger
Whether ALIAS records are available. 1 - Available. 0 - Not available. When ALIAS records are enabled, they may work in API calls that accept A and AAAA records. However, the ALIAS record must use a fully qualified domain name (FQDN) rather than an IP address.
One of: 1 0
anameinteger
Whether ANAME records are available. 1 - Available. 0 - Not available. NOTE: The aname value is always set to false (i.e. Not available). The ANAME record is currently not supported. It is included for completeness and future proofing.
One of: 1 0
resolverstring
The value (if any) of the running PDNS’s resolver setting.

is_https_available GET#

Return DNS HTTPS record support information

This function fetches information regarding HTTPS records support. HTTPS records are defined in RFC 9460 and provide service parameters for HTTPS endpoints. For more information, read our Zone Editor documentation.

No parameters.

Response — normalized as { ok, data, errors[], warnings[] }; data contains:

httpsinteger
Whether HTTPS records are supported. 1 - Supported. 0 - Not supported.
One of: 1 0
dns_serverstring
The DNS server type currently in use (bind, pdns, etc.).

is_svcb_available GET#

Return DNS SVCB record support information

This function fetches information regarding SVCB records support. SVCB records are defined in RFC 9460 and provide service binding and aliasing for arbitrary services. For more information, read our Zone Editor documentation.

No parameters.

Response — normalized as { ok, data, errors[], warnings[] }; data contains:

svcbinteger
Whether SVCB records are supported. 1 - Supported. 0 - Not supported.
One of: 1 0
dns_serverstring
The DNS server type currently in use (bind, pdns, etc.).

lookup GET#

Return domain's DNS information

This function returns DNS zone information about a domain.

domainstringRequired
A fully qualified domain name.

Response — normalized as { ok, data, errors[], warnings[] }; data is an array of:

Contains each response item.

mass_edit_zone GET#

Update a DNS zone

This function updates a DNS zone by allowing multiple records to be added, modified, or removed in a single call. It also ensures modified records occupy the same number of lines as before the edit.

NOTE:

You cannot use this function to edit temporary domains.

serialintegerRequired
The current serial number in the DNS zone’s SOA (Start of Authority) record. If this value does not match the zone’s current state, the request fails.
zonestringRequired
The name of one of the user’s DNS zones.
addarray<any>Optional
The records to add to the zone. Each item must be a serialized JSON object that contains: dname — The record’s name. ttl — The record’s TTL (Time-To-Live) value. record_type — The record’s type. For example, A or TXT. data — An array of strings. The format and number of the strings depend on the record_type value.
editarray<any>Optional
The records to edit in the zone. Each item must be a serialized JSON object that contains: line_index — The line number in the DNS zone where the record starts. This is a 0-based index, so to edit the first line in the file use the 0 value. To edit the second line, give 1, and so forth. dname — The record’s name. ttl — The record’s TTL (Time-To-Live) value. record_type — The record’s new type. For example, A or TXT. * data — An array of strings. The format and number of the strings depend on the record_type value.
removearray<any>Optional
The line indexes of records to remove from the zone.

Response — normalized as { ok, data, errors[], warnings[] }; data contains:

new_serialinteger
The DNS zone’s SOA record’s new serial number. You can use this to submit later edits if you track the number of lines each record takes up.

parse_zone GET#

Return a parsed DNS zone

This function parses a given DNS zone.

Important:

Most DNS zones contain only 7-bit ASCII. However, it is possible for DNS zones to contain any binary sequence. An application that decodes this function's base64 output must be able to handle cases where the decoded octets do not match any specific character encoding.

zonestringRequired
The name of one of the user’s DNS zones.

Response — normalized as { ok, data, errors[], warnings[] }; data contains:

Payload varies by call.

swap_ip_in_zones GET#

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.

dest_ipstringRequired
The IPv4 address to use as the replacement in the zone files.
domainstringRequired
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_ipstringOptional
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_ipstringOptional
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 — normalized as { ok, data, errors[], warnings[] }; data contains:

An array of objects containing the updated DNS records, including their previous values.