Get Virtualizor

Add DNS Records

Use the Add DNS Records API to add a DNS record on the PowerDNS server database. These are name resolution record for resolving names to IP addresses. This API allows to define multiple types of DNS records viz. A record, CNAME record, MX record, TXT record, NS record and AAAA record. The API response will contain "done" as "true" on successful addition of the record.

HTTP Request



actGETadd_dnsrecordThe action will edit a dns recordYes
dns_typePOSTtextThe type of dns record to be added valid values are 'type_rdns' and 'type_dns'Yes
zone_namePOSTtextThe name of the zoneNo
hostPOSTtextThe hostname of the dns recordYes
record_typePOSTtextThe type of record that is being edited refer below table for valid valuesYes
contentPOSTcontectThe content of the dns recordYes
prioPOSTIntThe priority of the dns recordNo
ttlPOSTIntThe value for which the record will be activeYes
domainPOSTtextThe Fully Qualified domain name (Required if dns_type is type_rdns) which will be resolved to the below dns_ipNo
dns_ipPOSTtextThe dns server IP (Required if dns_type is type_rdns)No

Record Type

a_recordA (host)
cname_recordCNAME (Aliases)
mx_recordMX (Mail Exchange)
txt_recordTXT (Text)
ns_recordNS (Name Servers)
aaaa_recordAAAA (IPV6 Hosts)

Sample Code



    $key =  'your_api_key';
    $pass = 'your_api_pass';
    $ip = 'your_server_ip';

    $admin = new Virtualizor_Admin_API($ip, $key, $pass);

    $post['pdnsid'] = 6;
    // $post['dns_type'] = 'type_rdns' ;
    $post['dns_type'] = 'type_dns';
    $post['record_type'] = 'A';
    $post['host'] = '';
    $post['content'] = '';
    $post['ttl'] = 90000;

    $output = $admin->add_dnsrecord($post);




    "title": "Virtualizor",
    "done": "true",
    "timenow": "1480924964",
    "time_taken": "0.166"
    Was this page helpful?
    Newsletter Subscription
    Subscribing you to the mailing list