All URIs are relative to https://developers.hostinger.com, except if the operation defines another base path.
| Method | HTTP request | Description |
|---|---|---|
| deleteDNSRecordsV1() | DELETE /api/dns/v1/zones/{domain} | Delete DNS records |
| getDNSRecordsV1() | GET /api/dns/v1/zones/{domain} | Get DNS records |
| resetDNSRecordsV1() | POST /api/dns/v1/zones/{domain}/reset | Reset DNS records |
| updateDNSRecordsV1() | PUT /api/dns/v1/zones/{domain} | Update DNS records |
| validateDNSRecordsV1() | POST /api/dns/v1/zones/{domain}/validate | Validate DNS records |
deleteDNSRecordsV1($domain, $dNSV1ZoneDestroyRequest): \Hostinger\Model\CommonSuccessEmptyResourceDelete DNS records
Delete DNS records for the selected domain. To filter which records to delete, add the name of the record and type to the filter. Multiple filters can be provided with single request. If you have multiple records with the same name and type, and you want to delete only part of them, refer to the Update zone records endpoint. Use this endpoint to remove specific DNS records from domains.
<?php
require_once(__DIR__ . '/vendor/autoload.php');
// Configure Bearer authorization: apiToken
$config = Hostinger\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');
$apiInstance = new Hostinger\Api\DNSZoneApi(config: $config);
$domain = mydomain.tld; // string | Domain name
$dNSV1ZoneDestroyRequest = new \Hostinger\Model\DNSV1ZoneDestroyRequest(); // \Hostinger\Model\DNSV1ZoneDestroyRequest
try {
$result = $apiInstance->deleteDNSRecordsV1($domain, $dNSV1ZoneDestroyRequest);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling DNSZoneApi->deleteDNSRecordsV1: ', $e->getMessage(), PHP_EOL;
}| Name | Type | Description | Notes |
|---|---|---|---|
| domain | string | Domain name | |
| dNSV1ZoneDestroyRequest | \Hostinger\Model\DNSV1ZoneDestroyRequest |
\Hostinger\Model\CommonSuccessEmptyResource
[Back to top] [Back to API list] [Back to Model list] [Back to README]
getDNSRecordsV1($domain): \Hostinger\Model\DNSV1ZoneRecordResource[]Get DNS records
Retrieve DNS zone records for a specific domain. Use this endpoint to view current DNS configuration for domain management.
<?php
require_once(__DIR__ . '/vendor/autoload.php');
// Configure Bearer authorization: apiToken
$config = Hostinger\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');
$apiInstance = new Hostinger\Api\DNSZoneApi(config: $config);
$domain = mydomain.tld; // string | Domain name
try {
$result = $apiInstance->getDNSRecordsV1($domain);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling DNSZoneApi->getDNSRecordsV1: ', $e->getMessage(), PHP_EOL;
}| Name | Type | Description | Notes |
|---|---|---|---|
| domain | string | Domain name |
\Hostinger\Model\DNSV1ZoneRecordResource[]
[Back to top] [Back to API list] [Back to Model list] [Back to README]
resetDNSRecordsV1($domain, $dNSV1ZoneResetRequest): \Hostinger\Model\CommonSuccessEmptyResourceReset DNS records
Reset DNS zone to the default records. Use this endpoint to restore domain DNS to original configuration.
<?php
require_once(__DIR__ . '/vendor/autoload.php');
// Configure Bearer authorization: apiToken
$config = Hostinger\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');
$apiInstance = new Hostinger\Api\DNSZoneApi(config: $config);
$domain = mydomain.tld; // string | Domain name
$dNSV1ZoneResetRequest = new \Hostinger\Model\DNSV1ZoneResetRequest(); // \Hostinger\Model\DNSV1ZoneResetRequest
try {
$result = $apiInstance->resetDNSRecordsV1($domain, $dNSV1ZoneResetRequest);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling DNSZoneApi->resetDNSRecordsV1: ', $e->getMessage(), PHP_EOL;
}| Name | Type | Description | Notes |
|---|---|---|---|
| domain | string | Domain name | |
| dNSV1ZoneResetRequest | \Hostinger\Model\DNSV1ZoneResetRequest |
\Hostinger\Model\CommonSuccessEmptyResource
[Back to top] [Back to API list] [Back to Model list] [Back to README]
updateDNSRecordsV1($domain, $dNSV1ZoneUpdateRequest): \Hostinger\Model\CommonSuccessEmptyResourceUpdate DNS records
Update DNS records for the selected domain. Using overwrite = true will replace existing records with the provided ones. Otherwise existing records will be updated and new records will be added. Use this endpoint to modify domain DNS configuration.
<?php
require_once(__DIR__ . '/vendor/autoload.php');
// Configure Bearer authorization: apiToken
$config = Hostinger\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');
$apiInstance = new Hostinger\Api\DNSZoneApi(config: $config);
$domain = mydomain.tld; // string | Domain name
$dNSV1ZoneUpdateRequest = new \Hostinger\Model\DNSV1ZoneUpdateRequest(); // \Hostinger\Model\DNSV1ZoneUpdateRequest
try {
$result = $apiInstance->updateDNSRecordsV1($domain, $dNSV1ZoneUpdateRequest);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling DNSZoneApi->updateDNSRecordsV1: ', $e->getMessage(), PHP_EOL;
}| Name | Type | Description | Notes |
|---|---|---|---|
| domain | string | Domain name | |
| dNSV1ZoneUpdateRequest | \Hostinger\Model\DNSV1ZoneUpdateRequest |
\Hostinger\Model\CommonSuccessEmptyResource
[Back to top] [Back to API list] [Back to Model list] [Back to README]
validateDNSRecordsV1($domain, $dNSV1ZoneUpdateRequest): \Hostinger\Model\CommonSuccessEmptyResourceValidate DNS records
Validate DNS records prior to update for the selected domain. If the validation is successful, the response will contain 200 Success code. If there is validation error, the response will fail with 422 Validation error code. Use this endpoint to verify DNS record validity before applying changes.
<?php
require_once(__DIR__ . '/vendor/autoload.php');
// Configure Bearer authorization: apiToken
$config = Hostinger\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');
$apiInstance = new Hostinger\Api\DNSZoneApi(config: $config);
$domain = mydomain.tld; // string | Domain name
$dNSV1ZoneUpdateRequest = new \Hostinger\Model\DNSV1ZoneUpdateRequest(); // \Hostinger\Model\DNSV1ZoneUpdateRequest
try {
$result = $apiInstance->validateDNSRecordsV1($domain, $dNSV1ZoneUpdateRequest);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling DNSZoneApi->validateDNSRecordsV1: ', $e->getMessage(), PHP_EOL;
}| Name | Type | Description | Notes |
|---|---|---|---|
| domain | string | Domain name | |
| dNSV1ZoneUpdateRequest | \Hostinger\Model\DNSV1ZoneUpdateRequest |
\Hostinger\Model\CommonSuccessEmptyResource
[Back to top] [Back to API list] [Back to Model list] [Back to README]