NewConnect Claude, Gemini, ChatGPT, and other AI agents to API Ninjas via our MCP server →

IP Lookup API

The IP Lookup API provides location information for any valid IP address. It works with both IPv4 and IPv6 addresses.

Online
(4.6)

From 3,906 users

1,700+

Applications using this API

API Status

Online - All Systems Operational

API Response Times

Average
P50
P75
P90
P95
307ms342ms349ms725ms1054ms

Didn't find what you were looking for? Suggest an improvement

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

  • address  required

    IP Address to query. Must be in IPv4 format A.B.C.D(e.g. 73.9.149.180) or IPv6 format X:X:X:X:X:X:X:X(e.g. 2001:0db8:85a3:0000:0000:8a2e:0370:7334).

Headers

  • X-Api-Key  required

    API Key associated with your account.

Response Fields

A JSON object with the following fields or an error if the request is unsuccessful.

  • address

    The IP address of the query

  • timezone

    The time zone related to the IP address

  • lat

    The latitude coordinate of the IP address location

  • lon

    The longitude coordinate of the IP address location

  • zip  Premium only

    The ZIP code of the IP address location

  • city  Premium only

    The city where the IP address is located

  • region

    The region name where the IP address is located. In the United States, this is equivalent to the state.

  • region_code

    The region code of the IP address location. In the United States, this is equivalent to the 2-letter state abbreviation.

  • country

    The name of the country where the IP address is located

  • country_code

    The 2-letter country code of the IP address location

  • is_valid

    The validity status of the IP address

  • isp  Premium only

    The Internet Service Provider associated with the IP address

  • is_datacenter  Premium only

    Whether the IP belongs to a known cloud or datacenter provider (e.g. AWS, GCP, Azure, Oracle, DigitalOcean).

  • is_hosting  Premium only

    Whether the IP's network (ASN) is a known hosting/datacenter provider.

  • is_tor  Premium only

    Whether the IP is a known Tor exit node.

  • is_vpn  Premium only

    Whether the IP is associated with a known commercial VPN provider.

  • is_icloud_relay  Premium only

    Whether the IP is an Apple iCloud Private Relay egress node.

  • is_bogon  Premium only

    Whether the IP is a bogon (unallocated or reserved address that should not appear on the public internet).

  • is_abuser  Premium only

    Whether the IP appears on multiple public abuse/threat blocklists.

  • threat_level  Premium only

    Overall risk level derived from blocklist activity: one of low, medium, or high.

  • asn  Premium only

    The Autonomous System Number that announces the IP (e.g. AS15169).

  • asn_name  Premium only

    The name of the organization that operates the ASN.

  • route  Premium only

    The network route (CIDR prefix) the IP belongs to.

  • abuse_email  Premium only

    The registered abuse-contact email for the IP's network, when available.

  • is_eu  Premium only

    Whether the IP's country is an EU member state. null when the country could not be determined.

  • is_eea  Premium only

    Whether the IP's country is in the European Economic Area (the EU plus Iceland, Liechtenstein and Norway).

  • languages  Premium only

    Comma-separated BCP-47 language tags commonly used in the country, for locale defaults.

  • urbanisation  Premium only

    Degree of urbanisation at the IP's coordinates, from URBAN_CENTRE through VERY_LOW_DENSITY_RURAL to WATER.

Live Demo

Live demo · no API key required
Query parameters
address

Get a free API key to get started — no credit card required.

Headers
X-Api-KeyLog in or sign up to get your API key
GET
https://api.api-ninjas.com/v1/iplookup?address=73.9.149.180
Sample response
{
"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",
"is_datacenter": false,
"is_hosting": false,
"is_tor": false,
"is_vpn": false,
"is_icloud_relay": false,
"is_bogon": false,
"is_abuser": false,
"threat_level": "low",
"asn": "AS7922",
"asn_name": "COMCAST-7922",
"route": "73.8.0.0/13",
"abuse_email": "abuse@comcast.net"
}

Code Examples

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.

Frequently Asked Questions

  • Yes, but you must have a premium subscription. Commercial use of the IP Lookup API is not permitted on the free tier. See our pricing page to choose a plan that fits your needs.
  • Sign up for a free account to instantly get your API key, then pass it in the X-Api-Key header on every request. The documentation above includes ready-to-run examples in cURL, Python, JavaScript, Node.js, and more.
  • Your API requests will simply be denied once you hit your monthly quota — you will never be charged more than the plan you signed up for. To increase your quota, you can upgrade your plan any time on our pricing page.
  • The API responds with a standard HTTP status code and a JSON error message describing the problem. See our error codes reference for the full list of codes and how to resolve each one, or contact support if you need help.
  • Yes. The address parameter accepts both IPv4 format (e.g. 73.9.149.180) and IPv6 format (e.g. 2001:0db8:85a3:0000:0000:8a2e:0370:7334). If you need to resolve a hostname or domain instead of an IP, see the DNS Lookup API.
  • The lat, lon, zip, city, and isp fields are premium-only, while fields like country, country_code, region, region_code, timezone, and is_valid are available on all plans. See pricing for details on premium access.
  • A successful lookup returns lat and lon fields containing the geographic coordinates of the IP address location (these are premium-only fields). To convert those coordinates back into a human-readable address, pass them to the Reverse Geocoding endpoint.
  • The region field is the region name where the IP is located, and region_code is its code; in the United States these correspond to the state name and its 2-letter state abbreviation respectively. To geolocate a place name or address instead of an IP, use the Geocoding API.