GET
/v1/lookup/:domain200 OK针对指定解析器查询域名的全部记录类型。可使用 ?types=A,MX,TXT 限定返回类型。
参数
| 名称 | 类型 | 默认值 | 说明 |
|---|---|---|---|
| domain | string | — | 必填,需要查询的主机名。 |
| types | string[] | all | 逗号分隔,例如 A,AAAA,MX |
| resolver | string | cloudflare | 可选 cloudflare、google、quad9、opendns、auth |
请求示例
cURL
$ curl "https://dnsfish.com/v1/lookup/github.com" \
-H "Accept: application/json"
响应
application/json200 OK
{
"domain": "github.com",
"resolver": "cloudflare",
"queried_at": "2026-05-24T18:42:11Z",
"latency_ms": 42,
"dnssec": { "signed": false, "ad": false },
"answers": {
"A": [{ "value": "140.82.114.4", "ttl": 60 }],
"MX": [{ "priority": 1, "value": "aspmx.l.google.com." }, /* 还有 4 条 */]
}
}
SDK 代码
JavaScript (fetch)
const r = await fetch(
"https://dnsfish.com/v1/lookup/github.com"
)
const data = await r.json()
console.log(data.answers.A)
Python (requests)
import requests
r = requests.get(
"https://dnsfish.com/v1/lookup/github.com"
)
print(r.json()["answers"]["A"])
Go (net/http)
resp, _ := http.Get(
"https://dnsfish.com/v1/lookup/github.com")
defer resp.Body.Close()
body, _ := io.ReadAll(resp.Body)
fmt.Println(string(body))
Shell (curl + jq)
$ curl -s "https://dnsfish.com/v1/lookup/github.com" \
| jq '.answers.A[].value'
"140.82.114.4"