DNS resolve
package main
import ( "fmt" "net/http" "io")
func main() {
url := "https://api.dazrik.net/resolve?target=example.com&record=MX"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close() body, _ := io.ReadAll(res.Body)
fmt.Println(res) fmt.Println(string(body))
}HttpRequest request = HttpRequest.newBuilder() .uri(URI.create("https://api.dazrik.net/resolve?target=example.com&record=MX")) .method("GET", HttpRequest.BodyPublishers.noBody()) .build();HttpResponse<String> response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());System.out.println(response.body());OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder() .url("https://api.dazrik.net/resolve?target=example.com&record=MX") .get() .build();
Response response = client.newCall(request).execute();import axios from 'axios';
const options = { method: 'GET', url: 'https://api.dazrik.net/resolve', params: {target: 'example.com', record: 'MX'}};
try { const { data } = await axios.request(options); console.log(data);} catch (error) { console.error(error);}const url = 'https://api.dazrik.net/resolve?target=example.com&record=MX';const options = {method: 'GET'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}use reqwest;
#[tokio::main]pub async fn main() { let url = "https://api.dazrik.net/resolve";
let querystring = [ ("target", "example.com"), ("record", "MX"), ];
let client = reqwest::Client::new(); let response = client.get(url) .query(&querystring) .send() .await;
let results = response.unwrap() .json::<serde_json::Value>() .await .unwrap();
dbg!(results);}curl --request GET \ --url 'https://api.dazrik.net/resolve?target=example.com&record=MX'Without record, returns IPv4 and IPv6 address arrays in addresses.v4 and addresses.v6; either can be empty. With record, returns that record type’s values in result. When no records are returned, result is an empty array, or null for SOA. IP literals are not accepted as the target.
Parameters
Section titled “Parameters”Query Parameters
Section titled “Query Parameters”Hostname to target. Raw IP addresses are rejected.
Example
example.comDNS record type to look up (case-insensitive). Omit to return A/AAAA addresses split by family.
Example
MXResponses
Section titled “Responses”Either the address split (no record) or the requested record’s structured values.
Address resolution result, returned when no record param is supplied.
object
object
DNS record lookup result, returned when a record param is supplied. The shape of result depends on the record type.
object
A/AAAA/NS/CNAME/TXT return a string array, MX/SRV return an object array. SOA returns a single object (or null when absent).
A, AAAA, NS, CNAME, TXT
MX
A single MX record.
object
SRV
A single SRV record.
object
An SOA record.
object
Examples
IPv4 and IPv6 addresses
{ "ok": true, "query": "example.com", "addresses": { "v4": [ "93.184.216.34" ], "v6": [ "2606:2800:220:1:248:1893:25c8:1946" ] }}MX records
{ "ok": true, "query": "example.com", "record": "MX", "result": [ { "priority": 10, "exchange": "mail.example.com" }, { "priority": 20, "exchange": "mail2.example.com" } ]}SOA record
{ "ok": true, "query": "example.com", "record": "SOA", "result": { "nsname": "ns.example.com", "hostmaster": "hostmaster.example.com", "serial": 2024010101, "refresh": 7200, "retry": 3600, "expire": 1209600, "minttl": 3600 }}Headers
Section titled “Headers”Request budget for the current window: limit, remaining, and reset (seconds until the window resets). Returned by known GET endpoints.
Example
limit=60, remaining=59, reset=42Maximum requests allowed per client IP per window (60 requests per 60s).
Example
60Requests remaining in the current window before the limit is hit.
Example
59Seconds until the current window resets.
Example
42Missing or invalid parameter
Error response.
object
Example
{ "ok": false, "msg": "query param target is required"}Headers
Section titled “Headers”Request budget for the current window: limit, remaining, and reset (seconds until the window resets). Returned by known GET endpoints.
Example
limit=60, remaining=59, reset=42Maximum requests allowed per client IP per window (60 requests per 60s).
Example
60Requests remaining in the current window before the limit is hit.
Example
59Seconds until the current window resets.
Example
42Target resolves to a private/reserved address
Error response.
object
Example
{ "ok": false, "msg": "target doesn't resolve to a public addr"}Headers
Section titled “Headers”Request budget for the current window: limit, remaining, and reset (seconds until the window resets). Returned by known GET endpoints.
Example
limit=60, remaining=59, reset=42Maximum requests allowed per client IP per window (60 requests per 60s).
Example
60Requests remaining in the current window before the limit is hit.
Example
59Seconds until the current window resets.
Example
42The request limit of 60 requests per minute per client IP was reached, or /connect or /website requests to the same destination are temporarily limited. The per-client request limit includes Retry-After, the number of seconds until the request budget resets. Destination-limit responses omit that header. A destination limit can apply even when RateLimit-Remaining is greater than zero.
Error response.
object
Example
{ "ok": false, "msg": "you're being rate limited, try again later."}Headers
Section titled “Headers”Request budget for the current window: limit, remaining, and reset (seconds until the window resets). Returned by known GET endpoints.
Example
limit=60, remaining=59, reset=42Maximum requests allowed per client IP per window (60 requests per 60s).
Example
60Requests remaining in the current window before the limit is hit.
Example
59Seconds until the current window resets.
Example
42Seconds to wait before retrying after the per-client request limit is reached. Destination connection limits can return HTTP 429 without this header.
Example
42Unexpected server error
Error response.
object
Example
{ "ok": false, "msg": "unknown error"}Headers
Section titled “Headers”Request budget for the current window: limit, remaining, and reset (seconds until the window resets). Returned by known GET endpoints.
Example
limit=60, remaining=59, reset=42Maximum requests allowed per client IP per window (60 requests per 60s).
Example
60Requests remaining in the current window before the limit is hit.
Example
59Seconds until the current window resets.
Example
42