All URIs are relative to https://developers.hostinger.com, except if the operation defines another base path.
Method | HTTP request | Description |
---|---|---|
deleteZoneRecordsV1() | DELETE /api/dns/v1/zones/{domain} | Delete zone records |
getRecordsV1() | GET /api/dns/v1/zones/{domain} | Get records |
resetZoneRecordsV1() | POST /api/dns/v1/zones/{domain}/reset | Reset zone records |
updateZoneRecordsV1() | PUT /api/dns/v1/zones/{domain} | Update zone records |
validateZoneRecordsV1() | POST /api/dns/v1/zones/{domain}/validate | Validate zone records |
deleteZoneRecordsV1($domain, $dNSV1ZoneDestroyRequest): \Hostinger\Model\CommonSuccessEmptyResource
Delete zone records
This endpoint deletes 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.
<?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->deleteZoneRecordsV1($domain, $dNSV1ZoneDestroyRequest);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling DNSZoneApi->deleteZoneRecordsV1: ', $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]
getRecordsV1($domain): \Hostinger\Model\DNSV1ZoneRecordResource[]
Get records
This endpoint retrieves DNS zone records for a specific domain.
<?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->getRecordsV1($domain);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling DNSZoneApi->getRecordsV1: ', $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]
resetZoneRecordsV1($domain, $dNSV1ZoneResetRequest): \Hostinger\Model\CommonSuccessEmptyResource
Reset zone records
This endpoint resets DNS zone to the default records.
<?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->resetZoneRecordsV1($domain, $dNSV1ZoneResetRequest);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling DNSZoneApi->resetZoneRecordsV1: ', $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]
updateZoneRecordsV1($domain, $dNSV1ZoneUpdateRequest): \Hostinger\Model\CommonSuccessEmptyResource
Update zone records
This endpoint updates 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.
<?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->updateZoneRecordsV1($domain, $dNSV1ZoneUpdateRequest);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling DNSZoneApi->updateZoneRecordsV1: ', $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]
validateZoneRecordsV1($domain, $dNSV1ZoneUpdateRequest): \Hostinger\Model\CommonSuccessEmptyResource
Validate zone records
This endpoint used to validate DNS records prior 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.
<?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->validateZoneRecordsV1($domain, $dNSV1ZoneUpdateRequest);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling DNSZoneApi->validateZoneRecordsV1: ', $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]