Overview

Use the ipwhois.io IP lookup API to quickly and simply integrate IP geolocation into your script or website. Save yourself the hassle of setting up local GeoIP libraries and having to remember to regularly update the data.


Geolocation API

Data formats

JSON

XML

Newline

JSON endpoint


You can call the API by sending HTTP GET requests to http://free.ipwhois.io/json/{IP}

{IP} can be an IPv4 or IPv6 address, or none to use the current IP address.


Example

You can edit this query and experiment with the options

GET
Actual response
{
  "ip": "8.8.4.4",
  "success": true,
  "type": "IPv4",
  "continent": "North America",
  "continent_code": "NA",
  "country": "United States",
  "country_code": "US",
  "country_flag": "https://cdn.ipwhois.io/flags/us.svg",
  "country_capital": "Washington",
  "country_phone": "+1",
  "country_neighbours": "CA,MX,CU",
  "region": "Virginia",
  "city": "Ashburn",
  "latitude": 39.0437567,
  "longitude": -77.4874416,
  "asn": "AS15169",
  "org": "Level 3 Communications",
  "isp": "Level 3 Communications",
  "timezone": "America/New_York",
  "timezone_name": "Eastern Standard Time",
  "timezone_dstOffset": 0,
  "timezone_gmtOffset": -18000,
  "timezone_gmt": "GMT -5:00",
  "currency": "US Dollar",
  "currency_code": "USD",
  "currency_symbol": "$",
  "currency_rates": 1,
  "currency_plural": "US dollars"
}

Returned data

The API can return the following fields and values

name description example type
ip IP used for the query 8.8.4.4 string
success true or false true bool
message included only when success is false
Can be one of the following: invalid IP address, you've hit the monthly limit
invalid query string
type IP address type (IPv4 or IPv6) IPv4 string
continent Continent name North America string
continent_code Two-letter continent code NA string
country Country name United States string
country_code Two-letter country code US string
country_capital The capital of country Washington string
country_phone Country Phone Code +1 string
country_neighbours Neighboring countries CA,MX,CU string
region Region/state Virginia string
city City Ashburn string
latitude Latitude 39.0437567 float
longitude Longitude -77.4874416 float
as AS number AS15169 string
org Organization name Level 3 Communications string
isp ISP name Level 3 Communications string
timezone City timezone America/New_York string
timezone_name Full time zone name Eastern Standard Time string
timezone_dstOffset The offset for daylight-savings time in seconds. 0 integer
timezone_gmtOffset The offset from UTC (in seconds) for the given location. -18000 integer
timezone_gmt Timezone GMT. GMT -5:00 string
currency Country currency name. US Dollar string
currency_code Country currency code. USD string
currency_symbol Country currency symbol. $ string
currency_rates The current exchange rate against the US dollar. 1 float
currency_plural Currency plural. US dollars string

Localization

Localized city, region, country and continent can be requested by setting the GET parameter lang to one of the following:

lang (ISO 639) description
en English (default)
de Deutsch (German)
es Español (Spanish)
pt-BR Español - Argentina (Spanish)
fr Français (French)
ja 日本語 (Japanese)
zh-CN 中国 (Chinese)
ru Русский (Russian)

Usage limits

Our API is free for up to 10,000 requests per month (IP and REFERER identification). See our pricing details if you need more.

We do not allow commercial use of this endpoint. Please see our pro service for SSL access, unlimited queries and commercial support.