IP Lookup API
The IP Lookup API provides location information for any valid IP address. It works with both IPv4 and IPv6 addresses.
Checking API status...
/v1/iplookup GET
https://api.api-ninjas.com/v1/iplookup
Returns the location of the IP address specified. The response contains both the geographical coordinates (latitude/longitude) as well as the city and country.
Parameters
addressrequiredIP Address to query. Must be in IPv4 format
A.B.C.D(e.g.73.9.149.180) or IPv6 formatX:X:X:X:X:X:X:X(e.g.2001:0db8:85a3:0000:0000:8a2e:0370:7334).
Headers
X-Api-KeyrequiredAPI Key associated with your account.
Response Fields
addressThe IP address of the query
timezoneThe time zone related to the IP address
latpremium onlyThe latitude coordinate of the IP address location
lonpremium onlyThe longitude coordinate of the IP address location
zippremium onlyThe ZIP code of the IP address location
citypremium onlyThe city where the IP address is located
regionThe region name where the IP address is located. In the United States, this is equivalent to the state.
region_codeThe region code of the IP address location. In the United States, this is equivalent to the 2-letter state abbreviation.
countryThe name of the country where the IP address is located
country_codeThe 2-letter country code of the IP address location
is_validThe validity status of the IP address
isppremium onlyThe Internet Service Provider associated with the IP address
Sample Request Live Demo!
https://api.api-ninjas.com/v1/iplookup?address=73.9.149.180Headers
X-Api-KeyLog in or sign up to get your API KeySample Response
1
2
3
4
5
6
7
8
9
10
11
12
13
14
{
"is_valid": true,
"country": "United States",
"country_code": "US",
"region_code": "IL",
"region": "Illinois",
"city": "Chicago",
"zip": "60620",
"lat": 41.7405,
"lon": -87.6587,
"timezone": "America/Chicago",
"isp": "Comcast Cable Communications, LLC",
"address": "73.9.149.180"
}Code Examples
1
2
curl -X GET "https://api.api-ninjas.com/v1/iplookup?address=8.8.8.8" \
-H "X-Api-Key: YOUR_API_KEY"If your programming language is not listed in the Code Example above, you can still make API calls by using a HTTP request library written in your programming language and following the above documentation.