DNS API Key
You will need to create a DNS API KEY for your account before you can use DNS API to manage your DNS remotely.
To create an API key, login to your account, click on “Settings” on the left menu and click “DNS API Key” to bring up the API Key
creation page. After the API Key has been created, you will need to use the key for every update of your DNS Records.
Dynamic IP Updates Made Easy |
Simply run curl or wget command to update your dynamic IP for any hosts or domains under your account. |
>> curl https://api.dnsexit.com/dns/ud/?apikey=API-KEY -d host=host1.domain.com,host2.domain2.com |
On any machine behind the router, just schedule a job to run the above command every few minutes. Our system will automatically detect your public IP address and update your hosts to the new IP. Alternatively, you may add parameter -d ip=xx.xx.xx.xx to overwrite the IP. For multiple hosts, just seperate them by , (comma). The API Key can be generated at your account Dashboard -> Settings. |
The return is JSON file with a successfull update like: |
{"code" : 0, "message" : "Success - some details about the update"}
|
code:0 indicates successfull updates while code:1 indicates IP address not changed. Other returning codes indicates errors. |
Bear in mind the parameter passed at Headers or http URL parameters will overwrite the value defined at JSON file.
Example JSON File to add SPF for the domain. SPF is the TXT record for the domain.
{
"domain":"example.com",
"add":{
"type":"TXT",
"name":"", //same as "name": "example.com"
"content":"v=spf1 mx include:dnsexit.com ~all",
"ttl":480, //ttl value is in minutes 480 = 6 hours
"overwrite":true //* optional, default false unless defined. True will overwrite existing settings
}
}
Example JSON File to add MX Record. MX defines the mail server that will receive Emails for the domain or mail zone
{
"domain": "example.com",
"add":{
"type": "MX",
"mail-zone":"", // "" is for Emails to @example.com. With value say "sub", will be for Emails for @sub.example.com
"mail-server": "mail.dnsexit.com",
"priority": 1, // the lower value has higher priority; therefore, the MX with lowest value will become the primary MX
"ttl": 480,
"overwrite": true // *filed optional. Default "false" unless defined. If true, it will just overwrite the existing definition
}
}
2. Add TXT for Domain SSL
Example JSON File setup TXT for Let's Encrypt SSL Verification for the example.com and www.example.com
{
"domain":"example.com",
"add":[
{
"type":"TXT",
"name":"_acme-challenge", //take the acme.sh name as example. Could be other name if you use other programs
"content":"ATZUQ6Inp0Dj6V5Qgv7ScT6rB8",
"ttl":0,
"overwrite":true
},
{
"type":"TXT",
"name":"_acme-challenge.www", //take the acme.sh name as example. Could be other name if you use other programs
"content":"_fFbVaP0gzAZsb9wOx__Kst9SWM",
"ttl":0,
"overwrite":true
}
]
}
1. Update the Domain's IP
Example JSON File to update the Domain's IPv4 address to 1.1.1.100
{
"domain":"example.com",
"update":{
"type":"A",
"name":"", //name can be "example.com" instead
"content":"1.1.1.100", //content is the new IPv4 address of the domain
"ttl":480 //ttl value is in minutes 480 = 6 hours
}
}
Create DNS for a Domain (multi-records)
Example creat DNS for a domain to have A (Host), CNAME (Alias), and 2 MX Records. You put the value "new-dns":"true" to indicate the request is to create new DNS
Note: "name":"", "content":"1.2.2.2" will assign the domain to have IP 1.2.2.2. Alternatively, you have put "name":"example.com" instead.
{
"new-dns":"true",
"domain":"911domain.com",
"add":[
{
"type":"A",
"name":"",
"content":"1.2.2.2"
},
{
"type":"CNAME",
"name":"www",
"content":"911domain.com"
},
{
"type":"MX",
"mail-zone":"",
"mail-server":"mail1.dnsexit.com",
"priority":1,
"ttl":480,
"overwrite":true
},
{
"type":"MX",
"mail-zone":"",
"mail-server":"mail2.dnsexit.com",
"priority":2,
"ttl":480,
"overwrite":true
}
]
}
Add Multiple Records
Example to add A (Host), CNAME (Alias), and 2 MX Records
{
"domain":"example.com",
"add":[
{
"type":"A",
"name":"host1",
"content":"1.2.2.2"
},
{
"type":"CNAME",
"name":"yahoomail",
"content":"mail.yahoo.com"
},
{
"type":"MX",
"mail-zone":"",
"mail-server":"mail1.dnsexit.com",
"priority":1,
"ttl":480,
"overwrite":true
},
{
"type":"MX",
"mail-zone":"",
"mail-server":"mail2.dnsexit.com",
"priority":2,
"ttl":480,
"overwrite":true
}
]
}
Update Multiple Records
{
"domain":"example.com",
"update":[
{
"type":"A",
"name":"host1",
"content":"1.2.2.2"
},
{
"type":"CNAME",
"name":"mail",
"content":"mail.yahoo.com"
},
{
"type":"MX",
"mail-zone":"",
"mail-server":"mail1.dnsexit.com",
"priority":1,
"ttl":480,
}
]
}
Mixed Add/Update/Delete
{
"domain":"example.com",
"add":[
{
"type":"A",
"name":"host1",
"content":"1.1.1.1"
},
{
"type":"CNAME",
"name":"mail2",
"content":"mail2.yahoo.com"
}
],
"update":[
{
"type":"A",
"name":"host2",
"content":"1.1.1.2"
},
{
"type":"CNAME",
"name":"mail",
"content":"mail.yahoo.com"
},
{
"type":"MX",
"mail-zone":"",
"mail-server":"mail1.example.com", //you can set it as "mail-server":"mail1" instead
"priority":1,
"ttl":480,
}
],
"delete":[
{
"type":"A",
"name":"host3"
},
{
"type":"TXT",
"name":"spf"
},
{
"type":"MX",
"mail-zone":"",
"mail-server":"mail3.dnsexit.com"
}
]
}