API 文档
发起本机 IP 或单 IP 请求,然后使用响应。
从您的本机 IP 开始
根端点识别连接到 API 的公网地址。在网站或应用中嵌入查询时,请明确请求 JSON。
本机 IP 请求
const response = await fetch(
"https://api.ipquery.io/?format=json",
{ signal: AbortSignal.timeout(5000) }
);
if (!response.ok) {
const message = await response.text();
throw new Error("IPQuery " + response.status + ": " + message);
}
const data = await response.json();
console.log(JSON.stringify(data, null, 2));在 JavaScript 模块或浏览器控制台中使用原生 fetch 和 AbortSignal.timeout. 查看语言要求
查询特定 IPv4 或 IPv6 地址时,请将该单个地址放入路径中。由于滥用,批量查询已禁用。
阅读 API 参考实际响应
1.1.1.1实时单 IP 响应
{
"ip": "1.1.1.1",
"isp": {
"asn": "AS13335",
"org": "Cloudflare, Inc.",
"isp": "Cloudflare, Inc."
},
"location": {
"country": "Australia",
"country_code": "AU",
"city": "Brisbane",
"state": "Queensland",
"zipcode": "",
"latitude": -27.474848400186662,
"longitude": 153.00996200912815,
"timezone": "Australia/Brisbane",
"localtime": "2026-11-03T14:32:36"
},
"risk": {
"is_mobile": false,
"is_vpn": false,
"is_tor": false,
"is_proxy": false,
"is_datacenter": true,
"risk_score": 20
}
}