Overview
ip-api provides a suite of APIs designed for retrieving geographical and network-related information from an IP address. Established in 2012, its primary offerings include an IP Geocoding API and an IP Proxy/VPN Detection API. The core function of the IP Geocoding API is to translate an IP address into physical location data, such as country, region, city, and postal code. This service also identifies the Internet Service Provider (ISP), organization name, and autonomous system number (ASN) associated with the IP address. This data can be instrumental for applications requiring geo-targeting of content, localized user experiences, or fraud prevention by verifying user locations.
The IP Proxy/VPN Detection API extends these capabilities by identifying whether an IP address belongs to a known proxy, VPN, or Tor exit node. This functionality supports use cases such as content restriction enforcement, bot detection, and enhancing security measures by flagging potentially suspicious traffic. The API is designed for ease of integration, returning data in JSON, XML, or CSV formats, which can be consumed by various programming languages and systems. Its straightforward API structure and comprehensive documentation aim to facilitate rapid development and deployment for developers.
ip-api caters to a broad spectrum of users, from individual developers working on non-commercial projects to businesses requiring IP intelligence for their operations. The free tier offers generous rate limits for non-commercial use, making it accessible for testing and small-scale applications. For commercial deployments, paid plans offer higher request limits, HTTPS encryption, and dedicated support, addressing the needs of more demanding environments. The service emphasizes data accuracy and low latency, critical factors for real-time applications such as ad serving, analytics, and cybersecurity. Compliance with data protection regulations such as GDPR is also a stated feature, addressing privacy concerns for users within relevant jurisdictions.
Key features
- IP Geocoding API: Translates an IP address into geographical data including country, region, city, latitude, longitude, and postal code. It also provides ISP, organization, and ASN details.
- IP Proxy/VPN Detection API: Identifies if an IP address is associated with a proxy, VPN, or Tor exit node, supporting fraud detection and content access control.
- Multiple Output Formats: Supports JSON, XML, and CSV data formats for flexibility in integration across different systems and programming languages, as detailed in the ip-api documentation.
- IPv4 and IPv6 Support: Handles both versions of IP addresses to ensure comprehensive coverage for modern internet infrastructure.
- Customizable Fields: Allows users to specify which data fields to retrieve, optimizing response size and processing efficiency.
- Batch Requests: Enables processing multiple IP addresses in a single request, reducing overhead for applications requiring large-scale IP lookups.
Pricing
ip-api offers a free tier for non-commercial use with specific limitations and various paid plans for commercial applications, which include higher request limits and HTTPS support. Prices are accurate as of May 28, 2026.
| Plan | Monthly Cost | Requests Per Minute | Features |
|---|---|---|---|
| Free (Non-Commercial) | $0 | 150 | HTTP only, basic IP geocoding, proxy/VPN detection |
| Developer | $15 | 300 | HTTPS, all fields, batch requests, commercial use |
| Small Business | $30 | 600 | All Developer features, higher rate limits |
| Medium Business | $60 | 1200 | All Small Business features, further increased rate limits |
| Large Business | $120 | 2400 | All Medium Business features, extensive rate limits |
For more detailed pricing information and current plan specifics, refer to the ip-api pricing page.
Common integrations
- Web Analytics Platforms: Integrate to enrich user data with geographical origin, improving segmentation and targeting.
- eCommerce Systems: Utilize for geo-targeting promotions, currency localization, and fraud detection based on IP location.
- Content Management Systems (CMS): Implement for regional content delivery or language adaptation based on visitor IP.
- Cybersecurity Tools: Incorporate into firewalls or intrusion detection systems to identify and block traffic from known VPNs/proxies or suspicious regions.
- Advertising Platforms: Enhance audience targeting by delivering ads specific to a user's location, helping advertisers reach relevant demographics, similar to how Google's Ad Manager API uses geo-targeting.
Alternatives
- MaxMind GeoIP2: Offers local and web services for IP intelligence, including geolocation and fraud prevention tools, with a focus on accuracy and enterprise features.
- IPinfo: Provides a range of IP data APIs, including geolocation, ASN details, company detection, and IP type identification.
- Abstract API IP Geolocation: A developer-focused API offering geolocation data with a free tier and various paid plans, known for ease of integration.
- APILayer IP Geolocation API: Offers IP lookup services with support for various data points and includes a free tier for basic usage.
- GeoJS: A free, client-side IP geolocation service that can be integrated directly into web pages for basic location data.
Getting started
To get started with ip-api, you can perform a simple IP lookup using their API. The following Python example demonstrates how to fetch geolocation data for a specific IP address (or the requesting IP if none is specified) and parse the JSON response. This example assumes you are using the public, non-commercial endpoint which operates over HTTP.
import requests
import json
def get_ip_geolocation(ip_address=None):
"""
Fetches geolocation data for a given IP address using ip-api.com.
If no IP address is provided, it uses the public API to determine
the requesting IP's location.
"""
base_url = "http://ip-api.com/json/"
if ip_address:
url = f"{base_url}{ip_address}"
else:
url = base_url # Uses the requesting IP by default
try:
response = requests.get(url)
response.raise_for_status() # Raise HTTPError for bad responses (4xx or 5xx)
data = response.json()
if data['status'] == 'success':
print(f"IP: {data.get('query')}")
print(f"Country: {data.get('country')} ({data.get('countryCode')})")
print(f"Region: {data.get('regionName')} ({data.get('region')})")
print(f"City: {data.get('city')}")
print(f"ZIP: {data.get('zip')}")
print(f"Latitude: {data.get('lat')}, Longitude: {data.get('lon')}")
print(f"ISP: {data.get('isp')}")
print(f"Organization: {data.get('org')}")
print(f"AS: {data.get('as')}")
else:
print(f"Error: {data.get('message', 'Unknown error')}")
except requests.exceptions.HTTPError as e:
print(f"HTTP error occurred: {e}")
except requests.exceptions.ConnectionError as e:
print(f"Connection error occurred: {e}")
except requests.exceptions.Timeout as e:
print(f"Request timed out: {e}")
except requests.exceptions.RequestException as e:
print(f"An error occurred: {e}")
except json.JSONDecodeError:
print("Failed to decode JSON response.")
# Example usage:
print("--- Geolocation for current IP ---")
get_ip_geolocation()
print("\n--- Geolocation for a specific IP (e.g., Google's public DNS) ---")
get_ip_geolocation("8.8.8.8")
This Python script uses the requests library to make an HTTP GET request to the ip-api endpoint. It then parses the JSON response to extract and print various geolocation details. Remember that for commercial applications or higher request limits, you would need to subscribe to a paid plan and potentially use an HTTPS endpoint with an API key, as outlined in the official ip-api documentation.