API 参考 · v2 · 免费
IPINFO.ZIP API
一个 JSON API,数据与可下载的每周数据库完全相同。无需密钥,无需注册,无需 SDK:每个地址一次 GET 请求。
https://ipinfo.zip/api
GETipinfo.zip/api基础地址/8.8.8.8地址/asn.name字段?format=text格式
200 OK · text/plainGoogle LLC
- 0
- 需要创建的 API 密钥
- 120
- 每个 IP 每分钟查询次数
- 6
- 种响应格式
本页内容 简介
快速开始
简介
所有端点都位于 /api 下,除非你指定其他格式,否则返回 JSON。记录来自当前版本,每周一重新构建;X-Release 响应头标明应答所用的版本。
无需任何配置。从终端、浏览器、服务器或 AI 智能体发送请求,读取结果即可。
- 1选择一个地址。 任意 IPv4 或 IPv6 地址;留空则返回你自己的地址。
- 2调用 API。 GET /api/{ip}。如果不想要 JSON,添加 ?format=csv 或其他格式。
- 3留意响应头。 X-RateLimit-Remaining 表示该端点本分钟内还剩多少次请求。
- 格式
- 默认 JSON;也可按需返回 XML、YAML、CSV、纯文本和 Markdown。
- 错误
- JSON 格式,含稳定的机器可读代码和面向人的消息。
- 版本管理
- v2 中只会新增字段;任何破坏性变更都会使用新路径。
# 你自己的地址
curl https://ipinfo.zip/api/me
# 任意地址
curl https://ipinfo.zip/api/8.8.8.8
# 同一条记录的 CSV 格式
curl 'https://ipinfo.zip/api/8.8.8.8?format=csv'
# 单个字段,纯文本
curl 'https://ipinfo.zip/api/8.8.8.8/asn.name?format=text'
curl ipinfo.zip
在终端里使用
在命令行里可以省掉 /api:curl、Wget、HTTPie、xh、PowerShell 以及常见的 HTTP 库,直接访问网站本身的地址就能拿到数据。浏览器访问时仍然是网页。
curl ipinfo.zip- 你自己的记录,JSON 格式
curl ipinfo.zip/ip - 你的 IP 地址,纯文本
curl ipinfo.zip/location.city - 你记录中的一个字段,纯文本
curl ipinfo.zip/8.8.8.8 - 任意地址的记录,JSON 格式
curl ipinfo.zip/8.8.8.8/ asn.name - 该记录中的一个字段,纯文本
curl ipinfo.zip/AS13335 - 一个自治系统的概况
curl 'ipinfo.zip/1.1.1.1? format=yaml' - 任意格式,用 ?format= 或 Accept 指定
- 单个值以纯文本输出并带换行,可以直接赋给 shell 变量。加上 ?format=json 则返回 JSON。
- 当 User-Agent 是命令行客户端,或 Accept 头请求的是 JSON、XML、YAML、CSV 或纯文本而不是 HTML 时,请求会被当作来自终端。
- 返回内容、错误和速率限制都与 /api 相同:查自己的记录计入 me,查字段或其他地址计入 lookup。
- 在代码里请优先使用 /api/… 路径:无论谁来请求,它们的返回都一样。
# 你自己的记录(此处有删节)
$ curl ipinfo.zip
{
"ip": "1.1.1.1",
"network": "1.1.1.1/32",
"type": "IPv4",
"is_datacenter": true,
"is_vpn": false,
"location": {
"country_code": "AU",
"city": "Brisbane",
"timezone": "Australia/Brisbane"
},
"asn": {
"asn": 13335,
"name": "Cloudflare, Inc."
},
"…": "…"
}
# 只要你的地址
$ curl ipinfo.zip/ip
1.1.1.1
# 一个字段,纯文本
$ curl ipinfo.zip/8.8.8.8/asn.name
Google LLC
# 直接赋给变量
$ city=$(curl -s ipinfo.zip/2.26.145.96/location.city)
$ echo "$city"
Paris
# 任意格式
$ curl -s 'ipinfo.zip/1.1.1.1?format=yaml' | head -4
ip: "1.1.1.1"
network: "1.1.1.1/32"
is_bogon: false
is_announced: true
格式与内容协商
用 ?format= 选择格式;没有 ?format= 时,使用 Accept 请求头。两者都没有时,返回 JSON。
| format= | Accept | 说明 |
|---|---|---|
| json | application/json | 默认格式。带缩进美化。 |
| xml | application/xml | 每个字段一个元素,数组以 item 列表表示。 |
| yaml | application/yaml | 块样式,有歧义处加引号。 |
| csv | text/csv | 一行表头,每条记录一行;嵌套字段以点号展平。 |
| text | text/plain | key: value 格式的行;使用 /{ip}/{field} 时返回纯值。 |
| md | text/markdown | Markdown 表格,便于智能体和聊天场景使用。 |
本站每个 HTML 页面也提供 Markdown 版本:发送 Accept: text/markdown,或在路径后加 .md。
curl -H 'Accept: text/csv' https://ipinfo.zip/api/1.1.1.1
curl 'https://ipinfo.zip/api/1.1.1.1?format=yaml'
# 页面同样适用:发送 Accept: text/markdown
curl -H 'Accept: text/markdown' https://ipinfo.zip/faq
速率限制
限额按客户端 IP(IPv6 按 /56)计算,且每个端点单独计数,因此大量使用某个端点不会影响其他端点。每个响应都会告诉你当前额度。
| 计数桶 | 端点 | 限额 |
|---|---|---|
| lookup | GET /api/{ip}, GET /api/{ip}/{field} | 120 / 分钟 |
| me | GET /api/me | 240 / 分钟 |
| asn | GET /api/AS{n} | 60 / 分钟 |
| batch | POST /api/batch(每次最多 100 个 IP) | 10 / 分钟 |
| search | GET /api/search | 90 / 分钟 |
| stats | GET /api/stats | 60 / 分钟 |
| download | GET /download/* | 30 / 小时 |
| page | HTML 和 markdown 页面 | 240 / 分钟 |
| agent | llms.txt, openapi, mcp | 120 / 分钟 |
每个响应都会发送 X-RateLimit-Limit、X-RateLimit-Remaining 和 X-RateLimit-Reset,以及 IETF RateLimit 和 RateLimit-Policy 响应头。429 响应带有 Retry-After。需要更多?下载数据库在本地查询。
HTTP/1.1 200 OK
X-RateLimit-Limit: 120
X-RateLimit-Remaining: 119
X-RateLimit-Reset: 1796410040
RateLimit: "lookup"; r=119; t=60
RateLimit-Policy: "lookup"; q=120; w=60
X-Release: 2026-12-05
HTTP/1.1 429 Too Many Requests
Retry-After: 60
X-RateLimit-Remaining: 0
错误
错误以 JSON 对象返回,包含 HTTP 状态码、用于分支判断的稳定代码、面向人的消息,以及联系我们时需提供的 request_id。
| 状态码 | code | 触发条件 | 可重试 |
|---|---|---|---|
| 400 | invalid_ip | 路径不是有效的 IPv4 或 IPv6 地址。 | 否 |
| 400 | invalid_format | ?format= 不在六种格式之内。 | 否 |
| 400 | invalid_asn | AS 号超出范围。 | 否 |
| 404 | asn_not_found | 该 AS 不在当前版本中。 | 否 |
| 404 | asn_reserved | 该号码为保留号码(私有用途、文档示例、AS_TRANS 等),不代表任何网络。 | 否 |
| 404 | unknown_field | 该地址的记录中没有此字段。 | 否 |
| 410 | file_withheld | 请求了未压缩的文件:请改为下载其 .gz 版本(错误信息会说明是哪个)。 | 否 |
| 413 | batch_too_large | 单次批量请求超过 100 个地址。 | 否 |
| 429 | rate_limited | 你的 IP 已达到该端点的限额。 | 是 |
| 500 | internal_error | 我们这边的错误,已自动上报。 | 是 |
| 503 | not_ready | 尚未加载任何版本(首次构建中)。 | 是 |
{
"error": {
"status": 429,
"code": "rate_limited",
"message": "Too many requests on the \"lookup\" endpoint: 120 per 60s.",
"retry_after": 60,
"bucket": "lookup",
"request_id": "6f1c2a9e-…"
}
}
查询你自己的 IP
返回发出请求的地址的记录。如果经过代理,返回的是代理的地址。
- 共享缓存从不缓存此响应:结果取决于请求者。
- 记录结构与 GET /{ip} 相同。
请求
curl https://ipinfo.zip/api/me
const res = await fetch('https://ipinfo.zip/api/me');
const data = await res.json();
console.log(data, res.headers.get('X-RateLimit-Remaining'));
import requests
res = requests.get('https://ipinfo.zip/api/me', timeout=10)
data = res.json()
print(data, res.headers['X-RateLimit-Remaining'])
resp, err := http.Get("https://ipinfo.zip/api/me")
if err != nil {
log.Fatal(err)
}
defer resp.Body.Close()
var data map[string]any
json.NewDecoder(resp.Body).Decode(&data)
fmt.Println(data)
<?php
$data = json_decode(file_get_contents('https://ipinfo.zip/api/me'), true);
print_r($data);
响应
{
"ip": "8.8.8.8",
"network": "8.8.8.8/32",
"type": "IPv4",
"is_datacenter": true,
"is_vpn": false,
"is_tor": false,
"isp": "Google LLC",
"location": {
"country_code": "US",
"country": "United States",
"city": "Mountain View",
"timezone": "America/Los_Angeles"
},
"asn": {
"asn": 15169,
"name": "Google LLC",
"route": "8.8.8.0/24"
},
"…": "…",
"release": "2026-12-05"
}
{
"error": {
"status": 429,
"code": "rate_limited",
"message": "Too many requests on the \"me\" endpoint: 240 per 60s.",
"retry_after": 60,
"bucket": "me",
"request_id": "6f1c2a9e-…"
}
}
查询 IP 地址
单个 IPv4 或 IPv6 地址的完整记录:位置、网络、公司、滥用投诉联系人、隐私和威胁标记、路由。
- IPv4 映射的 IPv6 地址(::ffff:1.2.3.4)会被解包。
- network 是数据库中包含该地址的最小地址段。
- 未知或未宣告的地址返回 200,且 found: false。
参数
| 字段 | 类型 | 说明 |
|---|---|---|
| ip 必填path | string | IPv4 或 IPv6 地址。 |
| formatquery | json | xml | yaml | csv | text | md | 响应格式。优先于 Accept 请求头。默认为 json。 |
请求
curl https://ipinfo.zip/api/8.8.8.8
const res = await fetch('https://ipinfo.zip/api/8.8.8.8');
const data = await res.json();
console.log(data, res.headers.get('X-RateLimit-Remaining'));
import requests
res = requests.get('https://ipinfo.zip/api/8.8.8.8', timeout=10)
data = res.json()
print(data, res.headers['X-RateLimit-Remaining'])
resp, err := http.Get("https://ipinfo.zip/api/8.8.8.8")
if err != nil {
log.Fatal(err)
}
defer resp.Body.Close()
var data map[string]any
json.NewDecoder(resp.Body).Decode(&data)
fmt.Println(data)
<?php
$data = json_decode(file_get_contents('https://ipinfo.zip/api/8.8.8.8'), true);
print_r($data);
响应
{
"ip": "8.8.8.8",
"network": "8.8.8.8/32",
"is_bogon": false,
"is_announced": true,
"is_datacenter": true,
"is_cloud_provider": true,
"is_mobile": false,
"is_satellite": false,
"is_anycast": true,
"is_ixp": false,
"is_crawler": false,
"is_scanner": false,
"is_vpn": false,
"is_proxy": false,
"is_residential_proxy": false,
"is_tor": false,
"is_relay": false,
"is_anonymous": false,
"is_abuser": false,
"is_attacker": false,
"is_threat": false,
"is_drop": false,
"is_mail_blocklisted": false,
"is_leased": false,
"usage_type": "CDN",
"connection_type": "Corporate",
"user_type": "content_delivery_network",
"privacy": {
"vpn": false,
"proxy": false,
"tor": false,
"relay": false,
"hosting": true
},
"rir": "ARIN",
"isp": "Google LLC",
"domains": {
"total": 134,
"domains": [
"proof-dns.com",
"meetcircle-blue.co",
"dns-redirect.com"
]
},
"datacenter": {
"datacenter": "Google Cloud",
"domain": "cloud.google.com",
"network": "8.8.8.0 - 8.8.8.255"
},
"company": {
"name": "Google LLC",
"abuser_score": 0,
"abuser_level": "Very Low",
"domain": "google.com",
"type": "hosting",
"network": "8.8.8.0 - 8.8.8.255",
"netname": "GOGL",
"created": "2023-12-28",
"updated": "2023-12-28"
},
"abuse": {
"name": "Abuse",
"email": "network-abuse@google.com",
"phone": "+1-650-253-0000",
"address": "1600 Amphitheatre Parkway, Mountain View, CA, 94043, United States",
"network": "8.8.8.0 - 8.8.8.255"
},
"asn": {
"asn": 15169,
"name": "Google LLC",
"handle": "GOOGLE",
"descr": "GOOGLE - Google LLC, US",
"org": "Google LLC",
"country": "US",
"domain": "google.com",
"domains": [
"google.com",
"about.google"
],
"website": "https://about.google/intl/en/",
"abuse": "network-abuse@google.com",
"abuse_contact": {
"name": "Abuse",
"email": "network-abuse@google.com",
"phone": "+1-650-253-0000"
},
"type": "hosting",
"rir": "ARIN",
"registered": "2000-03-30",
"created": "2000-03-30",
"updated": "2012-02-24",
"active": true,
"num_ipv4": 1764352,
"num_ipv6": "910925605079623083141103616000",
"prefixes_v4": 1281,
"prefixes_v6": 180,
"rank": 1579,
"cone_size": 21,
"upstreams": 7,
"peers": 292,
"customers": 19,
"upstream_asns": [
3356,
6453,
6762,
12956,
52468,
203291,
214292
],
"abuser_score": 0.0015,
"abuser_level": "Elevated",
"rpki": {
"valid": 1457,
"invalid": 4,
"not_found": 0,
"coverage": 0.9973
},
"tags": [
"a10k",
"anycast",
"cdn",
"icrit",
"vpn",
"vpsh"
],
"bgp_class": "Content",
"users": 725983,
"peeringdb": {
"type": "Content",
"ratio": "Mostly Outbound",
"scope": "Global",
"website": "https://about.google/intl/en/",
"policy": "Selective"
},
"ratio": "Mostly Outbound",
"scope": "Global",
"policy": "Selective",
"traffic_profile": {
"source": "derived",
"class": "mixed"
},
"registry": {
"org_handle": "GOGL",
"org_name": "Google LLC",
"source": "ARIN RDAP"
},
"mail_blocklist_score": 137.3,
"hosting_votes": 6,
"route": "8.8.8.0/24",
"rpki_status": "valid"
},
"routing": {
"route": "8.8.8.0/24",
"origin_asns": [
15169
],
"rpki_status": "valid",
"visibility": 0.8292,
"first_seen": "2010-01-01",
"last_seen": "2026-12-05",
"as_path": [
55720,
15169
]
},
"location": {
"continent": "NA",
"continent_name": "North America",
"country": "United States",
"country_code": "US",
"is_eu_member": false,
"calling_code": "1",
"currency_code": "USD",
"currency": "US Dollar",
"capital": "Washington",
"state": "California",
"region_code": "US-CA",
"city": "Mountain View",
"zip": "94035",
"latitude": 37.3861,
"longitude": -122.0838,
"timezone": "America/Los_Angeles",
"accuracy": "VERY_HIGH",
"geoname_id": 5375480,
"country_info": {
"country_code3": "USA",
"country_numeric": 840,
"geoname_id": 6252001,
"flag": "🇺🇸",
"tld": ".us",
"capital": "Washington",
"area_km2": 9629091,
"population": 341784857,
"population_density": 35.5,
"languages": [
"en-US",
"es-US",
"haw",
"fr"
],
"language": "English",
"borders": [
"CA",
"MX",
"CU"
],
"currency_symbol": "$",
"currency_symbol_native": "$",
"postal_format": "#####-####"
},
"local_time": "2026-12-06T09:09:40-08:00",
"utcoffset": "-08:00",
"is_dst": false,
"timezone_abbr": "PST",
"timezone_name": "Pacific Standard Time"
},
"registry": {
"rir": "ARIN",
"country": "US",
"network": "8.8.8.0 - 8.8.8.255",
"allocated": "2023-12-28",
"status": "allocated",
"registrant": {
"name": "Google LLC",
"handle": "NET-8-8-8-0-2",
"netname": "GOGL",
"network": "8.8.8.0 - 8.8.8.255",
"created": "2023-12-28",
"updated": "2023-12-28",
"source": "ARIN RDAP"
}
},
"abuse_density": {
"subnet24_ips": 256,
"subnet24_abusive": 0,
"subnet24_abusive_share": 0,
"asn_ips": 1764352,
"asn_abusive": 2580,
"asn_abusive_share": 0.001462
},
"tags": [
"hosting",
"cloud",
"anycast"
],
"type": "IPv4",
"release": "2026-12-05",
"elapsed_ms": 0.273
}
{
"error": {
"status": 400,
"code": "invalid_ip",
"message": "\"not-an-ip\" is not a valid IPv4 or IPv6 address.",
"request_id": "6f1c2a9e-…"
}
}
读取单个字段
用点号路径从记录中取出一个字段。适合在 shell 脚本和电子表格中使用。
- ?format=text 返回纯值,不带 JSON。
- 未知路径返回 404 unknown_field。
参数
| 字段 | 类型 | 说明 |
|---|---|---|
| ip 必填path | string | IPv4 或 IPv6 地址。 |
| field 必填path | string | 点号路径,如 location.country_code 或 asn.name。 |
| formatquery | json | xml | yaml | csv | text | md | 响应格式。优先于 Accept 请求头。默认为 json。 |
请求
curl https://ipinfo.zip/api/8.8.8.8/location.country_code
const res = await fetch('https://ipinfo.zip/api/8.8.8.8/location.country_code');
const data = await res.json();
console.log(data, res.headers.get('X-RateLimit-Remaining'));
import requests
res = requests.get('https://ipinfo.zip/api/8.8.8.8/location.country_code', timeout=10)
data = res.json()
print(data, res.headers['X-RateLimit-Remaining'])
resp, err := http.Get("https://ipinfo.zip/api/8.8.8.8/location.country_code")
if err != nil {
log.Fatal(err)
}
defer resp.Body.Close()
var data map[string]any
json.NewDecoder(resp.Body).Decode(&data)
fmt.Println(data)
<?php
$data = json_decode(file_get_contents('https://ipinfo.zip/api/8.8.8.8/location.country_code'), true);
print_r($data);
响应
自治系统概况
所有者、注册身份和联系人、带 RPKI 和可见度信息的已宣告前缀、上游、对等方与下游、排名、滥用率以及 PeeringDB 数据。
- 已注册但未宣告的 AS 号也包括在内。
- 邻居信息来自公开的 BGP 关系推断。
参数
| 字段 | 类型 | 说明 |
|---|---|---|
| number 必填path | integer | AS 号,可带或不带 AS 前缀。 |
| formatquery | json | xml | yaml | csv | text | md | 响应格式。优先于 Accept 请求头。默认为 json。 |
请求
curl https://ipinfo.zip/api/AS13335
const res = await fetch('https://ipinfo.zip/api/AS13335');
const data = await res.json();
console.log(data, res.headers.get('X-RateLimit-Remaining'));
import requests
res = requests.get('https://ipinfo.zip/api/AS13335', timeout=10)
data = res.json()
print(data, res.headers['X-RateLimit-Remaining'])
resp, err := http.Get("https://ipinfo.zip/api/AS13335")
if err != nil {
log.Fatal(err)
}
defer resp.Body.Close()
var data map[string]any
json.NewDecoder(resp.Body).Decode(&data)
fmt.Println(data)
<?php
$data = json_decode(file_get_contents('https://ipinfo.zip/api/AS13335'), true);
print_r($data);
响应
{
"asn": 13335,
"name": "Cloudflare, Inc.",
"handle": "CLOUDFLARENET",
"org": "Cloudflare, Inc.",
"country": "US",
"domain": "cloudflare.com",
"type": "hosting",
"rir": "ARIN",
"registered": "2010-07-14",
"num_ipv4": 1466624,
"num_ipv6": "1520898798772741150272502366208",
"rank": 61,
"upstreams": 93,
"peers": 1305,
"customers": 1063,
"abuser_score": 0.0023,
"prefixes": [
{
"route": "152.114.0.0/17",
"family": "v4",
"num_ips": 32768,
"rpki_status": "unknown",
"visibility": 0.8314,
"first_seen": "2026-01-01",
"last_seen": "2026-12-05",
"country": "GB",
"city": "Hemel Hempstead"
},
{
"route": "150.48.128.0/18",
"family": "v4",
"num_ips": 16384,
"rpki_status": "valid",
"visibility": 0.8314,
"first_seen": "2025-01-01",
"last_seen": "2026-12-05",
"country": "US",
"city": "Mountain View"
}
],
"neighbours": [
{
"asn": 31,
"rel": "downstream",
"name": "California Institute of Technology",
"country": "US"
},
{
"asn": 49,
"rel": "downstream",
"name": "National Institute of Standards and Technology",
"country": "US"
},
{
"asn": 112,
"rel": "downstream",
"name": "AS112 Project",
"country": "US"
}
],
"…": "…"
}
{
"error": {
"status": 404,
"code": "asn_not_found",
"message": "AS4199999999 is not in the current release.",
"request_id": "6f1c2a9e-…"
}
}
一次查询最多 100 个地址
一个请求,最多 100 个地址。返回一个顺序相同的数组;失败的条目带有 error 对象。
- 请求体:JSON 数组、{"ips": [...]},或以 text/plain 每行一个地址。
- 重复地址会被去除。
参数
| 字段 | 类型 | 说明 |
|---|---|---|
| body 必填body | string[] (≤ 100) | 要查询的地址。 |
| formatquery | json | xml | yaml | csv | text | md | 响应格式。优先于 Accept 请求头。默认为 json。 |
请求
curl -X POST https://ipinfo.zip/api/batch \
-H 'Content-Type: application/json' \
-d '["8.8.8.8", "1.1.1.1", "2606:4700:4700::1111"]'
const res = await fetch('https://ipinfo.zip/api/batch', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(["8.8.8.8", "1.1.1.1", "2606:4700:4700::1111"]),
});
const records = await res.json();
for (const r of records) console.log(r.ip, r.asn?.name);
import requests
records = requests.post(
'https://ipinfo.zip/api/batch',
json=['8.8.8.8', '1.1.1.1', '2606:4700:4700::1111'],
timeout=10,
).json()
for r in records:
print(r['ip'], r.get('asn', {}).get('name'))
body := strings.NewReader(`["8.8.8.8", "1.1.1.1", "2606:4700:4700::1111"]`)
resp, err := http.Post("https://ipinfo.zip/api/batch", "application/json", body)
if err != nil {
log.Fatal(err)
}
defer resp.Body.Close()
var records []map[string]any
json.NewDecoder(resp.Body).Decode(&records)
fmt.Println(len(records), "records")
<?php
$ctx = stream_context_create(['http' => [
'method' => 'POST',
'header' => 'Content-Type: application/json',
'content' => json_encode(['8.8.8.8', '1.1.1.1', '2606:4700:4700::1111']),
]]);
$records = json_decode(file_get_contents('https://ipinfo.zip/api/batch', false, $ctx), true);
foreach ($records as $r) echo $r['ip'], ' ', $r['asn']['name'] ?? '', "\n";
响应
[
{
"ip": "8.8.8.8",
"network": "8.8.8.8/32",
"type": "IPv4",
"location": {
"country_code": "US",
"city": "Mountain View"
},
"asn": {
"asn": 15169,
"name": "Google LLC"
},
"…": "…"
},
{
"ip": "1.1.1.1",
"network": "1.1.1.1/32",
"type": "IPv4",
"location": {
"country_code": "AU",
"city": "Brisbane"
},
"asn": {
"asn": 13335,
"name": "Cloudflare, Inc."
},
"…": "…"
},
{
"ip": "2606:4700:4700::1111",
"network": "2606:4700:4700::/48",
"type": "IPv6",
"location": {
"country_code": "US",
"city": "San Francisco"
},
"asn": {
"asn": 13335,
"name": "Cloudflare, Inc."
},
"…": "…"
}
]
{
"error": {
"status": 413,
"code": "batch_too_large",
"message": "At most 100 addresses per request.",
"request_id": "6f1c2a9e-…"
}
}
搜索网络
查找 IP、AS 号,或按名称、组织或域名查找自治系统。
参数
| 字段 | 类型 | 说明 |
|---|---|---|
| q 必填query | string | 自由文本、IP 或 AS 号。 |
| formatquery | json | xml | yaml | csv | text | md | 响应格式。优先于 Accept 请求头。默认为 json。 |
请求
curl https://ipinfo.zip/api/search?q=cloudflare
const res = await fetch('https://ipinfo.zip/api/search?q=cloudflare');
const data = await res.json();
console.log(data, res.headers.get('X-RateLimit-Remaining'));
import requests
res = requests.get('https://ipinfo.zip/api/search?q=cloudflare', timeout=10)
data = res.json()
print(data, res.headers['X-RateLimit-Remaining'])
resp, err := http.Get("https://ipinfo.zip/api/search?q=cloudflare")
if err != nil {
log.Fatal(err)
}
defer resp.Body.Close()
var data map[string]any
json.NewDecoder(resp.Body).Decode(&data)
fmt.Println(data)
<?php
$data = json_decode(file_get_contents('https://ipinfo.zip/api/search?q=cloudflare'), true);
print_r($data);
响应
{
"query": "cloudflare",
"results": [
{
"kind": "asn",
"id": "AS13335",
"name": "Cloudflare, Inc.",
"country": "US",
"url": "/AS13335"
},
{
"kind": "asn",
"id": "AS14789",
"name": "Cloudflare, Inc.",
"country": "US",
"url": "/AS14789"
},
{
"kind": "asn",
"id": "AS22061",
"name": "Cloudflare, Inc.",
"country": "US",
"url": "/AS22061"
}
]
}
{
"error": {
"status": 400,
"code": "missing_query",
"message": "Pass ?q= with an IP, an ASN or a network name.",
"request_id": "6f1c2a9e-…"
}
}
数据集统计
发布日期、数量统计、各字段覆盖率,以及已发布的文件及其大小和 SHA-256 校验和。
请求
curl https://ipinfo.zip/api/stats
const res = await fetch('https://ipinfo.zip/api/stats');
const data = await res.json();
console.log(data, res.headers.get('X-RateLimit-Remaining'));
import requests
res = requests.get('https://ipinfo.zip/api/stats', timeout=10)
data = res.json()
print(data, res.headers['X-RateLimit-Remaining'])
resp, err := http.Get("https://ipinfo.zip/api/stats")
if err != nil {
log.Fatal(err)
}
defer resp.Body.Close()
var data map[string]any
json.NewDecoder(resp.Body).Decode(&data)
fmt.Println(data)
<?php
$data = json_decode(file_get_contents('https://ipinfo.zip/api/stats'), true);
print_r($data);
响应
{
"release": "2026-12-05",
"built_at": "2026-12-06T03:12:33.389Z",
"stats": {
"ranges": {
"v4": 22150733,
"v6": 4493094
},
"asns": 124021,
"…": "…"
},
"coverage": {
"country_code": {
"ranges": 26604023,
"ranges_pct": 100,
"ipv4_addresses": 3698827456,
"ipv4_pct": 100
},
"…": "…"
},
"files": {
"ATTRIBUTION.txt": {
"size": 4231,
"sha256": "91bcba53302ea7d6d597db40432a187e2929b8c00cd9846a553553190f8f0047"
},
"abuse.csv.gz": {
"size": 123225727,
"sha256": "f5ad025a28d056f670b9ebbf2216efa1349cbffcef5105d2055546ee0f7ba1a4",
"rows": 9041478
}
}
}
健康检查
已加载版本时返回 200,首次构建期间返回 503。
请求
curl https://ipinfo.zip/api/health
const res = await fetch('https://ipinfo.zip/api/health');
const data = await res.json();
console.log(data, res.headers.get('X-RateLimit-Remaining'));
import requests
res = requests.get('https://ipinfo.zip/api/health', timeout=10)
data = res.json()
print(data, res.headers['X-RateLimit-Remaining'])
resp, err := http.Get("https://ipinfo.zip/api/health")
if err != nil {
log.Fatal(err)
}
defer resp.Body.Close()
var data map[string]any
json.NewDecoder(resp.Body).Decode(&data)
fmt.Println(data)
<?php
$data = json_decode(file_get_contents('https://ipinfo.zip/api/health'), true);
print_r($data);
响应
参考
记录字段
IP 记录可能包含的所有字段。对象缺失表示没有数据;API 中的布尔字段始终存在。 点击字段即可在请求构建器中试用。
| 字段 | 类型 | 说明 |
|---|---|---|
| ip | string | 你查询的地址,已规范化(IPv6 压缩表示,IPv4 映射地址已解包)。 |
| network | string | 数据库中包含该地址的最小地址段的 CIDR。 |
| type | string | IPv4 或 IPv6。 |
| tags | string[] | 所有为 true 的 is_* 标记,以简短标签形式按固定顺序列出(如 hosting、vpn、tor)。 |
| is_bogon | boolean | 保留、私有、文档用途或未分配的地址空间,不应出现在互联网上。 |
| is_announced | boolean | 生成本周版本时,覆盖该地址的前缀在全球 BGP 路由表中可见。 |
| is_datacenter | boolean | 托管、云、主机托管(colocation)或 CDN 地址空间。 |
| is_cloud_provider | boolean | 公有云公布的地址段(AWS、Google Cloud、Azure、Oracle 等)。 |
| is_mobile | boolean | 蜂窝网络(移动运营商 geofeed、运营商标签或纯移动运营商)。 |
| is_satellite | boolean | 卫星互联网接入(如 Starlink)。 |
| is_anycast | boolean | 任播(Anycast)前缀:同一地址由多个地点提供服务。 |
| is_ixp | boolean | 互联网交换中心的对等互联局域网。 |
| is_crawler | boolean | 搜索引擎、AI 爬虫或在线监测服务公布的地址段。 |
| is_scanner | boolean | 已知的全网扫描器(研究或商业用途)。 |
| is_vpn | boolean | VPN 出口服务器,来自服务商的服务器列表和解析出的主机名。 |
| is_proxy | boolean | 代理列表中出现的开放或公共代理。 |
| is_residential_proxy | boolean | 近期被发现转发机器人或代理流量的住宅地址。 |
| is_tor | boolean | Tor 中继(无论是否为出口节点)。 |
| is_relay | boolean | 隐私中继出口(iCloud Private Relay、Cloudflare WARP 等)。 |
| is_anonymous | boolean | VPN、代理、Tor 或中继中的任意一种。 |
| is_abuser | boolean | 最近 30 天内被至少一个滥用名单或黑名单列出。 |
| is_attacker | boolean | 因攻击被列出:暴力破解、漏洞利用、扫描或僵尸网络控制。 |
| is_threat | boolean | 威胁评分不低于 50。 |
| is_drop | boolean | 位于 Spamhaus DROP 地址段或 ASN-DROP 网络中。 |
| is_mail_blocklisted | boolean | 该地址本身列在邮件黑名单上(UCEPROTECT 1 级、PSBL、blocklist.de mail)。整段网络的列入不会设置此项。 |
| is_leased | boolean | 租用的地址空间:登记在一个持有者名下,却由另一个网络宣告和使用,通常经由 IPXO 等租赁平台。 |
| usage_type | string | IP2Location 风格的代码:DCH、CDN、ISP、MOB、COM、ORG、EDU、GOV、MIL、LIB、SES 或 RSV。 |
| connection_type | string | 地址的连接方式:Cable/DSL、Cellular、Satellite 或 Corporate。 |
| user_type | string | 使用者类型:residential、business、hosting、cellular、college、government、military、consumer_privacy_network、content_delivery_network 或 search_engine_spider。 |
| rir | string | 区域互联网注册机构:ARIN、RIPE、APNIC、LACNIC 或 AFRINIC。 |
| hostname | string | 已知服务器名(仅限 VPN 或 Tor 服务器;不做 PTR 爬取)。 |
| location.country_code | string | ISO 3166-1 alpha-2 国家代码。 |
| location.country | string | 国家英文名称。 |
| location.continent | string | 两个字母的大洲代码。 |
| location.state | string | 州、地区或省份。 |
| location.city | string | 城市。 |
| location.zip | string | 邮政编码(来源提供时)。 |
| location.latitude | number | 纬度,十进制度数。 |
| location.longitude | number | 经度,十进制度数。 |
| location.accuracy | string | 根据各来源的一致程度给出的定位可信度:COUNTRY(无城市)、LOW、MEDIUM、HIGH 或 VERY_HIGH。 |
| location.accuracy_radius | number | 地址最可能所在范围的半径(公里)。 |
| location.timezone | string | IANA 时区。 |
| location.local_time | string | 当前当地时间及 UTC 偏移(由 API 添加)。 |
| location.is_eu_member | boolean | 该国是否为欧盟成员国。 |
| location.currency_code | string | 该国的 ISO 4217 货币代码。 |
| location.calling_code | string | 国际电话区号。 |
| asn.asn | integer | 宣告该地址的自治系统号。 |
| asn.name | string | AS 简称。 |
| asn.org | string | 持有该 AS 的组织。 |
| asn.domain | string | AS 运营方的主域名。 |
| asn.country | string | AS 的注册国家/地区。 |
| asn.type | string | isp、hosting、business、education、government 或 banking。 |
| asn.rir | string | AS 的注册机构。 |
| asn.registered | string | AS 号的分配日期(YYYY-MM-DD)。 |
| asn.rank | integer | 按客户锥大小的全球排名(1 = 最大)。 |
| asn.abuser_score | number | 该 AS 的地址中出现在滥用名单上的比例(0..1)。 |
| asn.abuser_level | string | 该 AS 滥用率的等级:Very Low、Low、Elevated、High 或 Very High。 |
| asn.route | string | 覆盖该地址的已宣告前缀。 |
| asn.rpki_status | string | 路由源验证结果:valid、invalid 或 unknown。 |
| company.name | string | 地址块的注册组织(注册机构 whois / RDAP)。 |
| company.domain | string | 该组织的主域名。 |
| company.type | string | isp、hosting、business、education、government 或 banking。 |
| company.network | string | 注册的地址块(起始 - 结束)。 |
| company.netname | string | 注册机构中的网络名。 |
| company.abuser_score | number | 该地址块中出现在滥用名单上的比例(0..1)。 |
| company.abuser_level | string | 该地址块滥用率的等级:Very Low、Low、Elevated、High 或 Very High。 |
| abuse.name | string | 滥用投诉联系人名称。 |
| abuse.email | string | 滥用投诉联系邮箱。 |
| abuse.phone | string | 滥用投诉联系电话。 |
| abuse.address | string | 滥用投诉联系人邮寄地址。 |
| registry.rir | string | 委派该地址块的注册机构。 |
| registry.allocated | string | 委派日期。 |
| registry.status | string | allocated 或 assigned。 |
| registry.registrant.name | string | 该 IP 地址块的注册人。 |
| routing.route | string | 已宣告的 BGP 前缀。 |
| routing.origin_asns | integer[] | 源 AS 号(前缀有多个源 AS 时为多个)。 |
| routing.rpki_status | string | 基于已发布 ROA 的路由源验证结果。 |
| routing.visibility | number | 能看到该路由的 RIPE RIS 对等方比例(0..1)。 |
| routing.first_seen | string | 首次发现该前缀被宣告的日期。 |
| routing.last_seen | string | 最后发现该前缀被宣告的日期。 |
| threat.score | integer | 0–100,根据黑名单、DROP、Tor 出口节点和滥用举报加权计算。 |
| threat.level | string | none、low、medium、high 或 critical。 |
| threat.categories | string[] | attacker、bruteforce、botnet_c2、spam、malware、compromised、malicious_network 等。 |
| abuser.lists | string[] | 当前列出该地址的黑名单。 |
| mail_blocklists | string[] | 列出该地址的邮件黑名单,包括只反映其所在网络的整段列入(UCEPROTECT 2 级)。 |
| privacy.service | string | 已知时为 VPN 或中继品牌。 |
| datacenter.datacenter | string | 托管或云服务商名称。 |
| datacenter.region | string | 云区域(如有公布)。 |
| vpn.service | string | VPN 品牌。 |
| vpn.type | string | VPN 出口的检测方式:enumerated(服务商列表)、observed、interpolated 或 whois。 |
| proxy.type | string | open、public、http、https、socks、residential 或 tunnel。 |
| tor.exit | boolean | 该 Tor 中继允许出口流量。 |
| relay.service | string | 隐私中继运营方。 |
| carrier.name | string | 移动运营商。 |
| carrier.mcc | string | 移动国家代码(MCC)。 |
| carrier.mnc | string | 移动网络代码(MNC)。 |
| crawler.name | string | 爬虫或监测服务名称。 |
| scanner.name | string | 扫描器所属组织。 |
| drop.sblid | string | DROP 条目对应的 Spamhaus SBL 编号。 |
| lease.broker | string | 注册对象中出现的租赁平台或出租方(例如 IPXO),如已知。 |
| lease.network | string | 注册记录中的租用地址块(承租方的子分配)。 |
| lease.registry_country | string | 持有者所获分配的登记国家/地区。对于租用空间,它常与地址块的实际使用地不同。 |
| lease.holder_country | string | 租用地址块自身注册对象上的国家(IPXO 写作 EU)。 |
| abuse_density.subnet24_ips | integer | 该地址所在 /24 中已宣告的地址数。 |
| abuse_density.subnet24_abusive | integer | 该 /24 中被标记为滥用的地址数(滥用、攻击、威胁、DROP 或邮件黑名单)。 |
| abuse_density.subnet24_abusive_share | number | subnet24_abusive / subnet24_ips,取值 0 到 1。 |
| abuse_density.asn_ips | integer | 源 AS 宣告的 IPv4 地址数。 |
| abuse_density.asn_abusive | integer | 源 AS 中被标记为滥用的 IPv4 地址数。 |
| abuse_density.asn_abusive_share | number | asn_abusive / asn_ips,取值 0 到 1。 |
| release | string | 应答所用数据集的发布日期(YYYY-MM-DD)。 |
| elapsed_ms | number | 服务器端查询耗时(毫秒)。 |
MCP 服务器
AI 智能体可以通过 Model Context Protocol(Streamable HTTP,无需认证)获取同样的数据。使用下方端点将其添加到任意 MCP 客户端。
| 工具 | 参数 | 说明 |
|---|---|---|
| lookup_ip | ip | 查询 IPv4 或 IPv6 地址:地理定位、ASN、公司、滥用投诉联系人、隐私(VPN、代理、Tor、中继)、托管、租赁、所在 /24 和 AS 的滥用密度、威胁评分和标签。 |
| lookup_asn | asn | 自治系统概况:持有者、注册机构联系人、带 RPKI 状态的前缀、上游/对等方/下游、滥用率、排名以及 PeeringDB 流量数据。 |
| search_networks | query | 按编号、名称、组织或域名搜索自治系统。 |
| whois_lookup | handle, ip, asn, depth | 注册机构(whois / RDAP)对象及其关联:给出句柄、AS 号或网络,获取该对象及其关联;给出 IP 或 AS,获取其周边关系图。自然人只以隐去信息的句柄出现。 |
| get_dataset_stats | — | 数据集当前版本(每周一重建):日期、记录数、各字段覆盖率和可下载文件。 |
claude mcp add --transport http ipinfo-zip https://ipinfo.zip/mcp
curl -X POST https://ipinfo.zip/mcp \
-H 'Content-Type: application/json' \
-d '{"jsonrpc":"2.0","id":1,"method":"tools/call",
"params":{"name":"lookup_ip","arguments":{"ip":"1.1.1.1"}}}'
下载
整个数据库每周一重新构建,提供 MMDB、CSV、NDJSON、压缩的 SQLite 数据库和可移植的 SQL 导出。文件、大小和校验和详见 下载。
大文件只提供压缩版本(.gz):MMDB 和 SQLite 数据库分别为 ipinfo.mmdb.gz 和 ipinfo.sqlite.gz。下载后用 gunzip 解压。
# 列出文件、大小和校验和
curl 'https://ipinfo.zip/download?format=json'
# 最新 MMDB
curl -LO https://ipinfo.zip/download/ipinfo.mmdb.gz
gunzip ipinfo.mmdb.gz
# 在本地查询
mmdbctl read 8.8.8.8 ipinfo.mmdb
面向 AI 智能体和爬虫
本站和 API 的机器可读描述,供搜索引擎和 AI 智能体使用。