收集免费IP地址查询API接口合集

名片

墨觉 已认证

求:

供:

已完成:

进行中:

联系方式

私信或下方留言

热度

  • 置顶到期:
  • 帖子有效期:
  • 预计价格:暂无
  • 状态: 进行中 已完成

 

概述

在许多情况下,我们需要查询当前服务器或设备所处的公网 IP 地址信息。通过 API 接口进行查看或二次开发,不仅高效,还能满足不同的需求。本文档将收集多个免费的 IP 地址查询 API 接口,帮助开发者快速获取所需信息。

 

接口列表

浏览器访问或在命令行界面使用 curl 直接请求即可。

以下是一些常用的免费 IP 地址查询 API 接口,供开发者参考和使用。

 

国内 IP 查询接口

太平洋电脑网

不支持跨域访问

https://whois.pconline.com.cn/ipJson.jsp?json=true

接口返回格式为:

{"ip":"223.70.0.2","pro":"北京市","proCode":"110000","city":"北京市","cityCode":"110000","region":"","regionCode":"0","addr":" 北京市 移动 ","regionNames":"","err":""}
咪咕

不支持跨域访问

https://effic.migufun.com:8443/user/queryProvince

接口返回格式为:

{"returnCode":"000000","message":"请求成功","resultData":{"ip":"222.0.0.1","ipCountry":"中国","provinceId":"100","ipProvince":"北京","cityId":"10","ipCity":"北京","ipOperator":"电信 / 联通 / 移动","ipGPS":"39.93157,116.41005"},"serverTime":1728099789323}
 
百度云盘

不支持跨域访问,只能查询 IP

https://d.pcs.baidu.com/rest/2.0/pcs/file?method=locateupload

接口返回内容为:

{"bak_server":["c.pcs.baidu.com"],"client_ip":"12.25.15.3","error_code":0,"error_msg":"","expire":60,"host":"c.pcs.baidu.com","newno":"","quic_server":["https://panup.pcs.baidu.com"],"request_id":6459122064932601200,"server":["bdbl-cm01.pcs.baidu.com","c.pcs.baidu.com","c2.pcs.baidu.com"],"server_time":1728100504,"sl":0}
 
淘宝

指定 IP 后才能访问,不允许跨域。

https://ip.taobao.com/outGetIpInfo?accessKey=alibaba-inc&ip=114.114.114.114

接口返回为:

{"data":{"area":"","country":" 中国 ","isp_id":"xx","queryIp":"114.114.114.114","city":" 南京 ","ip":"114.114.114.114","isp":"XX","county":"","region_id":"320000","area_id":"","county_id":null,"region":" 江苏 ","country_id":"CN","city_id":"320100"},"msg":"query success","code":0}
 
美团

指定 IP 后才能访问,不允许跨域链接。

https://apimobile.meituan.com/locate/v2/ip/loc?client_source=yourAppKey&rgeo=true&ip=1.1.11.1
接口返回:

{"data":{"lng":113.424824,"fromwhere":"mars-mt","ip":"1.1.11.1","rgeo":{"country":"中国","province":"广东省","adcode":"440115","city":"广州","district":"南沙区"},"lat":22.856135
 
腾讯地图

不支持跨域,可以指定 IP 查询。

以下为收集腾讯地图的接口:

https://h5gw.map.qq.com/ws/location/v1/ip?key=2J4BZ-PBHH2-VYGU4-CODCH-C4EA2-W4BAU&apptag=h5loc_ip_loc&output=json https://apis.map.qq.com/ws/location/v1/ip?key=ACEBZ-FDXWP-WFRDV-VGS5Q-S2Q5K-HQBNA https://apis.map.qq.com/ws/location/v1/ip?key=RMJBZ-2IP64-CSNUJ-DLU7O-O3DF7-MMB5E https://apis.map.qq.com/ws/location/v1/ip?key=4RYBZ-4TRHF-GDOJU-NS5TO-3PIX7-LRF5F https://apis.map.qq.com/ws/location/v1/ip?key=N7XBZ-NX764-OFOUH-D5LJY-KZ3QK-6WFNX https://apis.map.qq.com/ws/location/v1/ip?key=3JLBZ-I2OWJ-3AAFI-KDLGM-UMDPO-Q6BRM https://apis.map.qq.com/ws/location/v1/ip?key=EIMBZ-RBNH4-NZQUG-X7RKQ-3SPPH-YSFCX https://apis.map.qq.com/ws/location/v1/ip?key=IDHBZ-7F2KM-SFY6S-6OQYE-6VWRE-WVB5N https://apis.map.qq.com/ws/location/v1/ip?key=GWSBZ-HTTWJ-QJIF2-KLHLC-X3WKV-ZZFV6 https://apis.map.qq.com/ws/location/v1/ip?key=T3EBZ-TJ7LI-YRBG2-5ZLUR-KD3OS-U6BJO https://apis.map.qq.com/ws/location/v1/ip?key=PTMBZ-GCQLW-SC2RG-R2FNI-HWPNQ-4PBQM https://apis.map.qq.com/ws/location/v1/ip?key=PTMBZ-GCQLW-SC2RG-R2FNI-HWPNQ-4PBQM https://apis.map.qq.com/ws/location/v1/ip?key=EP7BZ-JAOKQ-NIV55-GPNDX-CBPOQ-PHB7E https://apis.map.qq.com/ws/location/v1/ip?key=OIVBZ-MQZ6X-V2T4C-TLTXF-2X755-6CBAZ

接口返回格式为:

{"status":0,"message":"Success","request_id":"","result":{"ip":"1.1.1.1","location":{"lat":-35.2667,"lng":149.1333},"ad_info":{"nation":" 澳大利亚 ","province":"","city":"","district":"","adcode":-1,"nation_code":36}
 
百度地图

不支持跨域,可以指定 IP 查询。

以下为收集百度地图的接口:

https://api.map.baidu.com/location/ip?ak=M4eExM3AxIcxOdnFGciErtK3&coor=bd09ll https://api.map.baidu.com/location/ip?ak=NRjNKoTLotrpA6bH4hUanMUbTyID1upT&coor=bd09ll https://api.map.baidu.com/location/ip?ak=edUWu66ddGavrmj9a6vcsa75&coor=bd09ll https://api.map.baidu.com/location/ip?ak=Gwb8qTDLXEYRQeeeFoSeBBvtL4CjG0oL&coor=bd09ll https://api.map.baidu.com/location/ip?ak=LC742jDXOpX0YK7zCujnaYYBUiifRHBT&coor=bd09ll https://api.map.baidu.com/location/ip?ak=wVg1oglV4BDE2DHW1EBSNuPrtfHZ4hXD&coor=bd09ll https://api.map.baidu.com/location/ip?ak=UsRSw3nTcduUNpdN1I59kZwD2ZxB5QKf&coor=bd09ll https://api.map.baidu.com/location/ip?ak=s5mH7GofLFW9ET9Et86hKxoRZWOgBuYG&coor=bd09ll https://api.map.baidu.com/location/ip?ak=NRjNKoTLotrpA6bH4hUanMUbTyID1upT&coor=bd09ll https://api.map.baidu.com/location/ip?ak=UwHxw3gMu9G3zxjC5Ug5SQhoZnSCSIei&coor=bd09ll

接口返回格式为:

{"address":"CN| 广东省 | 广州市 |None|None|98|98","content":{"address":"广东省广州市","address_detail":{"adcode":"440100","city":"广州市","city_code":257,"district":"","province":" 广东省 ","street":"","street_number":""},"point":{"x":"113.27143134","y":"23.13533631","status":0}
 
腾讯视频

只能查看访问者 IP 信息,不支持跨域。

https://disp-qryapi.3g.qq.com/v1/dispatch

{"code":0,"unitResults":{},"ipInfo":"中国 #北京市# 中国移动#","extra":{"ip":"120.211.1.13"
 
网易邮箱大师

只能查看访问者 IP 信息,不支持跨域。

https://dashi.163.com/fgw/mailsrv-ipdetail/detail
以下为查询接口返回:

{"code":200,"desc":"DONE","success":"false","result":{"country":"中国","province":"北京市","provinceEn":"Beijing","city":"北京市","org":"UNKNOWN","isp":"移动","latitude":"39.6527901184","longitude":"116.425194597","timezone":"Asia/Shanghai","countryCode":"CN","continentCode":"AS","provinceCode":"11","continent":"亚洲","county":"UNKNOWN","ispId":"10086","ip":"120.211.11.11","zone":"gz"
 
高德地图

单 key 每日有频率限制,支持跨域访问,支持指定 IP 查询信息。

以下为收集高德地图的接口:

https://restapi.amap.com/v3/ip?key=ba5f9b69f0541123a4dbe142da230b4d https://restapi.amap.com/v3/ip?key=ec8838f3bf4614c5627c4266b36cc813 https://restapi.amap.com/v3/ip?key=0a2a27ba5e33705826293c630a22d445 https://restapi.amap.com/v3/ip?key=407cd13370e3e36bcb96759e9b08d958 https://restapi.amap.com/v3/ip?key=0113a13c88697dcea6a445584d535837 https://restapi.amap.com/v3/ip?key=7cf01841d11f9e10ccc014b9d4ac0ee2 https://restapi.amap.com/v3/ip?key=521d56615aad7c53f930a5db86214cfd https://restapi.amap.com/v3/ip?key=b9fe1600bd434cee8375f822b3e0da15 https://restapi.amap.com/v3/ip?key=2acf0a74a75c1ded782ebbf9f3ded364 https://restapi.amap.com/v3/ip?key=4f3e4eee3efe05aa8593e438df8aed22 https://restapi.amap.com/v3/ip?key=016ad9192e40fc6d1054a83a21400429 https://restapi.amap.com/v3/ip?key=7adc97f7624ef1865767693e1b183478 https://restapi.amap.com/v3/ip?key=67953f7ce7d657144d5f3b12f84310ed

接口返回格式为:

{"status":"1","info":"OK","infocode":"10000","province":"江苏省","city":"南京市","adcode":"320100","rectangle":"118.4253323,31.80452471;119.050169,32.39401346"}
 
百度

指定 IP 后才能访问,不允许跨域链接。

https://opendata.baidu.com/api.php?co=&resource_id=6006&oe=utf8&query=1.1.1.1

百度查询接口返回格式为:

{"status":"0","t":"","set_cache_time":"","data":[{"ExtendedLocation":"","OriginQuery":"1.1.1.1","SchemaVer":"","appinfo":"","disp_type":0,"fetchkey":"1.1.1.1","location":" 澳大利亚 ","origip":"1.1.1.1","origipquery":"1.1.1.1","resourceid":"6006","role_id":0,"schemaID":"","shareImage":1,"showLikeShare":1,"showlamp":"1","strategyData":{},"titlecont":"IP 地址查询","tplt":"ip"}]}
 
360 地图

不允许直接访问,必须添加 Referer 来源,只能查本机。

curl -H 'Referer: https://map.360.cn/' 'https://api.map.so.com/local?apikey=3a141df397801104f2bf&ad=1'

接口返回格式为:

{"consume":1,"stored_consume":0,"rgeo_consume":1,"status":1,"result":{"location":[39.13035583,117.19542694],"radius":20000,"coor_type":"GCJ02","country":"中国","country_code":"CN","province":"天津市","city":"天津市","mcity":"天津市","district":"和平区","township":"四面钟","village":"百货大楼社区","street":"兴安路","street_number":"","area":" 和平路 ","aoi":"","aoi_type":"","aoi_typecode":0,"scenic":"","building":"","addr_desc":" 天津市和平区和平路兴安路化工商厦附近 ","adcode":120101,"short_addr":" 兴安路 ","addr":" 天津, 天津, 和平区, 兴安路,,120101","cip":"111.31.3.12","type":4
 
中国气象局

只支持查询当前地域信息

https://weather.cma.cn/api/now/
接口返回内容:

{"msg":"success","code":0,"data":{"location":{"id":"54511","name":"北京","path":"中国, 北京, 北京","longitude":116.47,"latitude":39.81,"timezone":8},"now":{"precipitation":0.0,"temperature":20.5,"pressure":1018.0,"humidity":46.0,"windDirection":"东南风","windDirectionDegree":122.0,"windSpeed":1.4,"windScale":"微风"},"alarm":[],"lastUpdate":"2024/10/05 11:45"
 
中央气象台

不支持跨域,不支持 https,只能查询 IP 地域信息。

http://www.nmc.cn/rest/position
接口返回内容:

{"code":"Wqsps","province":"北京市","city":"北京","url":"/publish/forecast/ABJ/beijing.html"}
 
央视网

不支持跨域,只能查询 IP 和地域缩写。

https://ip.apps.cntv.cn/whereis?client=json

{"isp_code":"3","city_code":"","province_code":"BJ","country_code":"CN","ip":"120.5.0.3"}
 
美图设计室

不支持跨域

https://webapi.designkit.com/common/ip_location
接口返回内容:

{"reqid":"8b4b1ff0-72d5-4c1a-ae41-ae2fc0b598fa","code":0,"data":{"112.57.65.28":{"area_code":"86","city":"天津","city_id":0,"continent":"亚洲","continent_code":"AP","country_id":100000,"isp":"移动","latitude":39.082634,"longitude":117.194292,"nation":"中国","nation_code":"CN","province":"天津","province_id":120000,"subdivision_1_iso_code":"*","subdivision_1_name":"天津","subdivision_2_iso_code":"*","subdivision_2_name":"天津","time_zone":"UTC+8"}
 
12306

不支持跨域,支持查询本机 IP

https://exservice.12306.cn/excater/bonree/grip
接口返回内容:

{"di":"111.31.3.4"}
 
其他

其他的就不多做说明了

 

国外 IP 信息查询接口

 
Hsselite

不支持跨域

https://www.hsselite.com/ipinfo

接口返回为:

{"asn":14061,"aso":"DIGITALOCEAN-ASN","city":"Santa Clara","continent_code":"NA","country_code":"US","country_name":"United States","dma_code":807,"ip":"165.232.134.28","is_hotspotshield_connected":false,"isp":"Digital Ocean","latitude":37.3931,"longitude":-121.962,"organization":"Digital Ocean","postal_code":"95054","region":"CA"}
 
IPIP

https://v6r.ipip.net/

接口返回为:

223.72.23.2
 
jsonip

http://jsonip.com

接口返回:

{"ip":"165.232.154.24"}
 
httpbin

http://httpbin.org/ip

接口返回:

{"origin": "165.232.134.28" }
 
ipify

已被 reset 拦截,不建议使用。

https://api.ipify.org/
接口返回:165.232.132.28

 

正文完
0 条回复 A文章作者 M管理员
😊 表情
  • 贴吧
  • 泡泡
  • 黄脸
    暂无讨论,说说你的看法吧
个人中心
购物车
优惠劵
今日签到
有新私信 私信列表
搜索