Loading...
Loading...
Hostinger DNS API for zone record management, snapshots, and validation. Use when creating, updating, or deleting DNS records, restoring DNS snapshots, validating zone changes, or resetting DNS to defaults.
npx skill4agent add hostinger/hostinger-agent-skills dns| Type | Purpose | Example |
|---|---|---|
| A | IPv4 address | |
| AAAA | IPv6 address | |
| CNAME | Canonical name alias | |
| ALIAS | ANAME/ALIAS record | |
| MX | Mail exchange | |
| TXT | Text record | |
| NS | Name server | |
| SOA | Start of authority | Zone authority info |
| SRV | Service locator | |
| CAA | Certificate authority auth | |
overwriteoverwrite: trueoverwrite: false14400curl -X GET "https://developers.hostinger.com/api/dns/v1/zones/example.com" \
-H "Authorization: Bearer $HOSTINGER_API_TOKEN"from hostinger_api import Hostinger
client = Hostinger(api_token="YOUR_API_TOKEN")
records = client.dns.zone.get_dns_records("example.com")
for record in records:
print(f"{record.type} {record.name} -> {record.content}")import { Hostinger } from "hostinger-api-sdk";
const client = new Hostinger({ apiToken: "YOUR_API_TOKEN" });
const records = await client.dns.zone.getRecords("example.com");
for (const record of records) {
console.log(`${record.type} ${record.name} -> ${record.content}`);
}use Hostinger\Api\HostingerApi;
$client = new HostingerApi('YOUR_API_TOKEN');
$records = $client->dns->zone->getRecords('example.com');
foreach ($records as $record) {
echo "{$record->type} {$record->name} -> {$record->content}\n";
}# Add an A record for www subdomain
curl -X PUT "https://developers.hostinger.com/api/dns/v1/zones/example.com" \
-H "Authorization: Bearer $HOSTINGER_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"overwrite": true,
"zone": [
{
"name": "www",
"type": "A",
"ttl": 14400,
"records": [
{ "content": "192.168.1.1" }
]
}
]
}'
# Add MX records for email
curl -X PUT "https://developers.hostinger.com/api/dns/v1/zones/example.com" \
-H "Authorization: Bearer $HOSTINGER_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"overwrite": true,
"zone": [
{
"name": "@",
"type": "MX",
"ttl": 14400,
"records": [
{ "content": "10 mail1.example.com." },
{ "content": "20 mail2.example.com." }
]
}
]
}'
# Add a TXT record for SPF
curl -X PUT "https://developers.hostinger.com/api/dns/v1/zones/example.com" \
-H "Authorization: Bearer $HOSTINGER_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"overwrite": false,
"zone": [
{
"name": "@",
"type": "TXT",
"ttl": 14400,
"records": [
{ "content": "v=spf1 include:_spf.google.com ~all" }
]
}
]
}'# Validate records first (returns 200 if valid, 422 if invalid)
curl -X POST "https://developers.hostinger.com/api/dns/v1/zones/example.com/validate" \
-H "Authorization: Bearer $HOSTINGER_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"overwrite": true,
"zone": [
{
"name": "www",
"type": "CNAME",
"ttl": 14400,
"records": [
{ "content": "example.com." }
]
}
]
}'curl -X DELETE "https://developers.hostinger.com/api/dns/v1/zones/example.com" \
-H "Authorization: Bearer $HOSTINGER_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"filters": [
{ "name": "www", "type": "A" },
{ "name": "old", "type": "CNAME" }
]
}'curl -X POST "https://developers.hostinger.com/api/dns/v1/zones/example.com/reset" \
-H "Authorization: Bearer $HOSTINGER_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"sync": true,
"reset_email_records": false,
"whitelisted_record_types": ["MX", "TXT"]
}'# List available snapshots
curl -X GET "https://developers.hostinger.com/api/dns/v1/snapshots/example.com" \
-H "Authorization: Bearer $HOSTINGER_API_TOKEN"
# Get a specific snapshot with contents
curl -X GET "https://developers.hostinger.com/api/dns/v1/snapshots/example.com/42" \
-H "Authorization: Bearer $HOSTINGER_API_TOKEN"
# Restore from a snapshot
curl -X POST "https://developers.hostinger.com/api/dns/v1/snapshots/example.com/42/restore" \
-H "Authorization: Bearer $HOSTINGER_API_TOKEN"| Method | Endpoint | Description |
|---|---|---|
| | Get DNS records |
| | Update DNS records |
| | Delete DNS records |
| | Reset DNS to defaults |
| | Validate DNS records |
| Method | Endpoint | Description |
|---|---|---|
| | List DNS snapshots |
| | Get snapshot with contents |
| | Restore from snapshot |
/validateoverwrite: falseoverwrite: true@whitelisted_record_typesreset_email_records: falsedignslookupdig @8.8.8.8 example.com A.dig example.com MXnametypeemail-dns-setup.md