API - DNS - Add / modify multiple records


Active Member
Apr 6, 2012
cPanel Access Level
Root Administrator
Hi, I'm looking for a means of adding and/or modifying multiple DNS records for a single domain in one go, via a WHM API. Domains in the DNS have no relation to a WHM user.

When using multiple "editzonerecord" API calls, the SOA serial is +1'ed at every request and I have to juggle with line numbers when changing and removing multiple records in one go...

How can I achieve a DNS zone modification in a transaction of some sort?


Staff member
Apr 11, 2011

We document how to use this WHM API 1 function at:

WHM API 1 Functions - editzonerecord - Developer Documentation - cPanel Documentation

Using the dumpzone function and line numbers is the most effective way to use this API function, as noted:

This function edits a DNS zone record. To effectively use this function, use the following workflow:
  1. Run the dumpzone function on the DNS zone record to edit.
  2. Locate the Line value that corresponds to the data to edit.
  3. Use the values from that zone record to formulate the appropriate editzonerecord parameters.
Otherwise, an alternative would be to manually modify the zone file directly via the command line (/var/named/$domain.tld.db) outside of the API.

Thank you.


Well-Known Member
Oct 21, 2019
Cape Town
cPanel Access Level
DataCenter Provider
Hi there,

I googled "add dns record whm api" and got to this post. May I assume it's not possible to add single record to an existing zone?

E.g. if I want to add just an A record IN to zone "xyz.com" I need to first retrieve the entire zone? So no individual calls using an API to add / remove records?