Skip to content

DNS resolve

GET
/resolve
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);
}

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.

target
required
string

Hostname to target. Raw IP addresses are rejected.

Example

example.com
record
string
Allowed values: A AAAA SRV MX CNAME NS SOA TXT

DNS record type to look up (case-insensitive). Omit to return A/AAAA addresses split by family.

Example

MX

Either the address split (no record) or the requested record’s structured values.

Media typeapplication/json
One of:

Address resolution result, returned when no record param is supplied.

object
ok
required
boolean
query
required
string
addresses
required
object
v4
required
Array<string>
v6
required
Array<string>

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"
]
}
}
RateLimit
string

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=42
RateLimit-Limit
integer

Maximum requests allowed per client IP per window (60 requests per 60s).

Example
60
RateLimit-Remaining
integer

Requests remaining in the current window before the limit is hit.

Example
59
RateLimit-Reset
integer

Seconds until the current window resets.

Example
42

Missing or invalid parameter

Media typeapplication/json

Error response.

object
ok
required
boolean
msg
required
string

Example

{
"ok": false,
"msg": "query param target is required"
}
RateLimit
string

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=42
RateLimit-Limit
integer

Maximum requests allowed per client IP per window (60 requests per 60s).

Example
60
RateLimit-Remaining
integer

Requests remaining in the current window before the limit is hit.

Example
59
RateLimit-Reset
integer

Seconds until the current window resets.

Example
42

Target resolves to a private/reserved address

Media typeapplication/json

Error response.

object
ok
required
boolean
msg
required
string

Example

{
"ok": false,
"msg": "target doesn't resolve to a public addr"
}
RateLimit
string

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=42
RateLimit-Limit
integer

Maximum requests allowed per client IP per window (60 requests per 60s).

Example
60
RateLimit-Remaining
integer

Requests remaining in the current window before the limit is hit.

Example
59
RateLimit-Reset
integer

Seconds until the current window resets.

Example
42

The 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.

Media typeapplication/json

Error response.

object
ok
required
boolean
msg
required
string

Example

{
"ok": false,
"msg": "you're being rate limited, try again later."
}
RateLimit
string

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=42
RateLimit-Limit
integer

Maximum requests allowed per client IP per window (60 requests per 60s).

Example
60
RateLimit-Remaining
integer

Requests remaining in the current window before the limit is hit.

Example
59
RateLimit-Reset
integer

Seconds until the current window resets.

Example
42
Retry-After
integer

Seconds to wait before retrying after the per-client request limit is reached. Destination connection limits can return HTTP 429 without this header.

Example
42

Unexpected server error

Media typeapplication/json

Error response.

object
ok
required
boolean
msg
required
string

Example

{
"ok": false,
"msg": "unknown error"
}
RateLimit
string

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=42
RateLimit-Limit
integer

Maximum requests allowed per client IP per window (60 requests per 60s).

Example
60
RateLimit-Remaining
integer

Requests remaining in the current window before the limit is hit.

Example
59
RateLimit-Reset
integer

Seconds until the current window resets.

Example
42