The API base path ishttp://ip-api.com/json/{query}
{query}
可以是单个 IPv4/IPv6 地址或域名。如果您不提供查询,则将使用当前 IP 地址。
fields | response fields optional(fields=status,message,query,country,city) |
lang | response language optional |
callback | wrap inside (JSONP) optional |
e.g:http://ip-api.com/json/24.48.0.1?fields=61439&lang=zh-CN
response
{
"query": "24.48.0.1",
"status": "success",
"country": "加拿大",
"countryCode": "CA",
"region": "QC",
"regionName": "Quebec",
"city": "蒙特利尔",
"zip": "H1K",
"lat": 45.6085,
"lon": -73.5493,
"timezone": "America/Toronto",
"isp": "Le Groupe Videotron Ltee",
"org": "Videotron Ltee",
"as": "AS5769 Videotron Telecom Ltee"
}
status | success or fail | success | string | |
message | included only when status is fail Can be one of the following: private range, reserved range, invalid query | invalid query | string | |
continent | Continent name | North America | string | |
continentCode | Two-letter continent code | NA | string | |
country | Country name | United States | string | |
countryCode | Two-letter country code ISO 3166-1 alpha-2 | US | string | |
region | Region/state short code (FIPS or ISO) | CA or 10 | string | |
regionName | Region/state | California | string | |
city | City | Mountain View | string | |
district | District (subdivision of city) | Old Farm District | string | |
zip | Zip code | 94043 | string | |
lat | Latitude | 37.4192 | float | |
lon | Longitude | -122.0574 | float | |
timezone | Timezone (tz) | America/Los_Angeles | string | |
offset | Timezone UTC DST offset in seconds | -25200 | int | |
currency | National currency | USD | string | |
isp | ISP name | string | ||
org | Organization name | string | ||
as | AS number and organization, separated by space (RIR). Empty for IP blocks not being announced in BGP tables. | AS15169 Google Inc. | string | |
asname | AS name (RIR). Empty for IP blocks not being announced in BGP tables. | string | ||
reverse | Reverse DNS of the IP (can delay response) | wi-in-f94.1e100.net | string | |
mobile | Mobile (cellular) connection | true | bool | |
proxy | Proxy, VPN or Tor exit address | true | bool | |
hosting | Hosting, colocated or data center | true | bool | |
query | IP used for the query | 173.194.67.94 | string |
http://ip-api.com/json/{query}?fields=status,message,country,countryCode,region,regionName,city,zip,lat,lon,timezone,isp,org,as,query
Localization
Localized city, regionName and country can be requested by setting the GET parameter lang
to one of the following:
enDEMO | English (default) |
deDEMO | Deutsch (German) |
esDEMO | Español (Spanish) |
pt-BRDEMO | Português - Brasil (Portuguese) |
frDEMO | Français (French) |
jaDEMO | 日本語 (Japanese) |
zh-CNDEMO | 中国 (Chinese) |
ruDEMO | Русский (Russian) |
Usage limits
This endpoint is limited to 45 requests per minute from an IP address.
If you go over the limit your requests will be throttled (HTTP 429
) until your rate limit window is reset. If you constantly go over the limit your IP address will be banned for 1 hour.
The returned HTTP header X-Rl
contains the number of requests remaining in the current rate limit window. X-Ttl
contains the seconds until the limit is reset.
Your implementation should always check the value of the X-Rl
header, and if its is 0 you must not send any more requests for the duration of X-Ttl
in seconds.