ip-api
通过 IP 地址或域名查找位置
- 认证方式
- No auth
- HTTPS
- No
- CORS
- Unknown
- 分类
- 地理编码
- 文档 / URL
- https://ip-api.com/docs
简介
ip-api.com 把 IP 地址解析为位置数据——国家、地区、城市、坐标、时区、ISP 和 ASN——一次免密钥 GET 搞定。是最受欢迎的免费 IP 地理位置 API 之一(无数教程在使用)。
注:免费层仅支持 HTTP(实测可用——
http://ip-api.com/json/8.8.8.8正常);HTTPS 和更高配额需要付费密钥。
快速开始
查询 IP(免费端点,实测可用):
curl "http://ip-api.com/json/8.8.8.8"
{
"status": "success",
"country": "United States",
"countryCode": "US",
"region": "CA",
"city": "Mountain View",
"lat": 37.4056,
"lon": -122.0775,
"timezone": "America/Los_Angeles",
"isp": "Google LLC",
"as": "AS15169 Google LLC",
"query": "8.8.8.8"
}
查询自己的 IP(省略地址):
curl "http://ip-api.com/json/"
批量(最多 100 个 IP):
curl "http://ip-api.com/batch" \
-H "Content-Type: application/json" \
-d '["8.8.8.8", "1.1.1.1"]'
认证方式
- 免费层:无密钥(仅 HTTP,每 IP 45 次请求/分钟)。
- 付费层:HTTPS、更高配额、无每分钟限制。
速率限制与注意事项
- 免费:每 IP 45 次请求/分钟——轻量使用够用;请积极缓存。
- 字段含
status、countryCode、region、city、lat/lon、timezone、isp、as、org。 - 批量端点每次最多 100 个 IP(仍限 45 次/分钟)。
fields参数精简响应:?fields=country,city,lat,lon。
常见问题
ip-api 免费吗? 是的——免费层(仅 HTTP,45 次/分钟);HTTPS 需要付费密钥。
为什么只有 HTTP? 免费层不含 HTTPS——公开地理位置没问题,只是别传敏感数据。
批量最多多少个 IP? 每次请求最多 100 个。
地理编码 分类更多
| API | Auth | HTTPS | CORS | |
|---|---|---|---|---|
| Actinia Grass GIS Actinia is an open source REST API for geographical data that uses GRASS GIS | API Key | Yes | Unknown | ↗ |
| administrative-divisons-db Get all administrative divisions of a country | No auth | Yes | Yes | ↗ |
| adresse.data.gouv.fr Address database of France, geocoding and reverse | No auth | Yes | Unknown | ↗ |
| Airtel IP IP Geolocation API. Collecting data from multiple sources | No auth | Yes | Unknown | ↗ |
| Apiip Get location information by IP address | API Key | Yes | Yes | ↗ |