WHM API.
https://api.docs.cpanel.net/_mock/specifications/whm.openapi/
https://{host}:{port}/json-api/
Request
This function deletes a DNS zone.
Important:
- The WHM API 1 adddns function adds an XDNS entry for a domain in the following locations:
- The
/var/cpanel/users/USERfile, whereUSERrepresents the domain's owner. - The
/etc/vdomainaliases/DOMAINdirectory, whereDOMAINrepresents the new zone's domain. - The
/etc/vfilters/DOMAINdirectory, whereDOMAINrepresents the new zone's domain. - This function does not automatically delete these entries. You must manually delete these entries, or you cannot use this domain as a value in other API functions.
- You cannot delete other DNS zones that reside on Write-only servers in a DNS cluster.
Important:
When you disable the DNS role, the system disables this function.
NOTE:
You cannot use this function to delete temporary domains.
- Mock server
https://api.docs.cpanel.net/_mock/specifications/whm.openapi/killdns
- A server running WHM.
https://whm-server.tld:2087/json-api/killdns
- curl
- JavaScript
- Node.js
- Python
- Java
- C#
- PHP
- Go
- Ruby
- R
- Payload
curl -i -X GET \
-u <username>:<password> \
'https://api.docs.cpanel.net/_mock/specifications/whm.openapi/killdns?domain=example.com'{ "metadata": { "command": "killdns", "output": { … }, "reason": "Zones Removed", "result": 1, "version": 1 } }
Request
This function lists the server's DNS zones.
Important:
When you disable the DNS role, the system disables this function.
- Mock server
https://api.docs.cpanel.net/_mock/specifications/whm.openapi/listzones
- A server running WHM.
https://whm-server.tld:2087/json-api/listzones
- curl
- JavaScript
- Node.js
- Python
- Java
- C#
- PHP
- Go
- Ruby
- R
- Payload
curl -i -X GET \
-u <username>:<password> \
https://api.docs.cpanel.net/_mock/specifications/whm.openapi/listzones{ "data": { "zone": [ … ] }, "metadata": { "command": "listzones", "reason": "OK", "result": 1, "version": 1 } }
Request
This function updates a given DNS zone. It can add, edit, and remove many records in a single call. It also ensures that each record not removed will occupy the same number of lines after the edit as it did before the edit.
NOTE:
You cannot use this function to modify temporary domains.
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.
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,AorTXT.data— An array of strings. The format and number of the strings depend on therecord_typevalue.
An A record.
A TXT record.
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 the0value. To edit the second line, give1, 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,AorTXT.data— An array of strings. The format and number of the strings depend on therecord_typevalue.
- Mock server
https://api.docs.cpanel.net/_mock/specifications/whm.openapi/mass_edit_dns_zone
- A server running WHM.
https://whm-server.tld:2087/json-api/mass_edit_dns_zone
- curl
- JavaScript
- Node.js
- Python
- Java
- C#
- PHP
- Go
- Ruby
- R
- Payload
curl -i -X GET \
-u <username>:<password> \
'https://api.docs.cpanel.net/_mock/specifications/whm.openapi/mass_edit_dns_zone?serial=202001010100&zone=example.com&add=string&edit=%27{%22line_index%22%3A+9%2C+%22dname%22%3A%22example%22%2C+%22ttl%22%3A14400%2C+%22record_type%22%3A+%22TXT%22%2C+%22data%22%3A%5B%22string1%22%2C+%22string2%22%5D}%27&remove=22'{ "data": { "new_serial": 2021031903 }, "metadata": { "command": "mass_edit_dns_zone", "reason": "OK", "result": 1, "version": 1 } }