IP Geolocation API
Country, city, timezone, and ISP for any IPv4 or IPv6 address.
Convert an IP address to a location with one GET request. This IP to geolocation API returns country, region, city, coordinates, timezone with local time, and the ISP and ASN operating the address — as predictable JSON, with proxy and VPN flags in the same response. Free tier available, no card required.
What Is an IP Geolocation API?
An IP geolocation API takes an IP address and returns where that address is registered and who operates it — country, region, city, coordinates, timezone, and the ISP behind it. You send an address, you get a location back.
IP to Country & City
Country, country code, region, city, postal code, and latitude/longitude for any IPv4 or IPv6 address. Country resolution is reliable enough to gate content on; city resolution is a strong hint rather than a certainty.
Timezone & Local Time
The IANA timezone name plus the computed local time, Unix offset, and a daylight-saving flag. Useful for scheduling notifications, stamping events in a user's own time, and detecting mismatches between claimed and observed timezone.
ISP & ASN Owner
The internet service provider and the autonomous system number that announces the address. This is what separates a residential broadband customer from a cloud instance, and it arrives in the same response as the location.
Inferred, Not GPS
IP geolocation is an inference drawn from registry allocations, ISP-published data, network routing, and latency measurement — not a device GPS reading. It tells you where the network says an address lives, which is usually but not always where the user is.
The data behind any IP geolocation service is assembled rather than measured directly. Regional Internet Registries record which organization holds each block of addresses, ISPs publish sub-allocations describing how they have distributed those blocks geographically, BGP routing shows which network currently announces a prefix, and active latency measurement narrows a range down to a metropolitan area. Providers combine these signals and resolve the disagreements between them. For a full walkthrough of each of those inputs, see our guide to how IP geolocation works.
Every Field the IP Geolocation API Returns
One call to GET /api/v1/ip/{ip} returns all of the following. Nothing is
behind a second request or a higher tier.
Top level
| Field | Type | Example | Notes |
|---|---|---|---|
ip |
string | 203.0.113.195 |
The address that was analyzed. To look up the address you are calling from, see find your own IP address. |
isp |
string | null | Deutsche Telekom AG |
Internet service provider, derived from the ASN organization. |
asn |
string | null | AS3320 |
Autonomous system announcing the address. For network detail, see ASN lookup. |
location
| Field | Type | Example | Notes |
|---|---|---|---|
country |
string | null | United States |
Full country name. The most reliable field in the response. |
country_code |
string | null | US |
ISO 3166-1 alpha-2 code. |
city |
string | null | San Francisco |
City or municipality. Accuracy varies with population density. |
latitude |
number | null | 37.7749 |
Decimal degrees. An area centroid, not a precise position. |
longitude |
number | null | -122.4194 |
Decimal degrees. |
zip |
string | null | 94105 |
Postal or ZIP code for the estimated location. |
timezone |
string | null | America/Los_Angeles |
IANA timezone identifier. |
local_time |
string | null | 2023-06-21T14:30:00-07:00 |
Current local time at the location, ISO 8601. |
local_time_unix |
integer | null | 1687385400 |
Same instant as a Unix timestamp. |
is_daylight_savings |
boolean | null | true |
Whether the location currently observes DST. |
suspicious_factors
Returned on every geolocation lookup, not as a separate paid call — because a location is only meaningful once you know whether the address is anonymizing it.
| Field | Type | Meaning |
|---|---|---|
is_vpn | boolean | Address belongs to a commercial VPN endpoint. |
is_proxy | boolean | Address is operating as a proxy server. |
is_tor_node | boolean | Address is part of the Tor network. |
is_datacenter | boolean | Address originates from a datacenter or cloud host. |
is_spam | boolean | Address is associated with spam activity. |
is_crawler | boolean | Address is a known crawler, scraper, or bot. |
is_threat | boolean | Address is flagged on an active threat feed. |
IP Geolocation Accuracy: What to Expect
Accuracy falls off as the geography gets finer. These are the figures we publish for our own data, and they are typical of IP geolocation generally.
| Level | Accuracy | Safe to use for |
|---|---|---|
| Country | 99.8% | Content licensing, currency and language defaults, compliance gating. |
| Region / state | 95% | Tax and jurisdiction hints, regional routing, coarse analytics. |
| City | 85–95% | Localized content and pricing, store locators, fraud signals. Varies with population density. |
| Coordinates | ~50 km median radius | Distance bands and map centring — not proximity claims. |
City-level misses cluster in predictable places: carrier-grade NAT and mobile networks, where thousands of subscribers share an egress point; corporate WANs that route branch traffic out of a single head office; and VPN or cloud addresses, where the honest answer is the provider's location. Our full breakdown of IP geolocation accuracy covers each case and how to detect it.
What Developers Build With an IP Geolocation API
Six patterns that account for most production traffic against this endpoint.
Localization
Set currency, language, and date format from the visitor's country on first paint, before any account exists. The country field is accurate enough to do this without a fallback prompt.
Fraud & Geo-Velocity
Compare the location of a signup against the billing address, or flag an account that appears in two distant cities within minutes. Because VPN and proxy flags arrive in the same response, you can tell a real move from a masked one.
Geo-Restriction & Licensing
Enforce content licensing and regulatory boundaries by country, and detect the anonymizers used to bypass them. Country-level accuracy is the reason this is the one geolocation decision safe to make automatically.
Ad & Campaign Targeting
Segment campaigns by country, region, or city, and attribute conversions to a geography without asking the user for anything. Filter datacenter traffic out of your spend using the same payload.
Latency Routing
Pick the nearest region or CDN edge from the request's coordinates. The ~50 km median radius is well within tolerance for choosing between datacenters that are hundreds of kilometres apart.
Analytics Enrichment
Attach country, city, timezone, and ISP to events at ingest so your warehouse can slice by geography later. Storing the ASN alongside lets you separate human traffic from cloud and bot traffic after the fact.
Two of these lean on the security flags as much as the location. If fraud scoring is the primary goal rather than a side benefit, our fraud detection API combines these signals into a single risk score, and the guide to geo-restricted content covers the trade-offs of blocking by country.
IP Geolocation API — Endpoint & Code Examples
One GET request returns location, timezone, ISP, ASN, and the proxy/VPN flags together. Predictable JSON, versioned, no parsing quirks.
GET /api/v1/ip/{ip}?api_key={key}
curl "https://ip-api.io/api/v1/ip/78.55.53.58?api_key=YOUR_API_KEY"
{
"ip": "78.55.53.58",
"isp": "Telefonica Germany",
"asn": "AS6805",
"location": {
"country": "Germany",
"country_code": "DE",
"city": "Berlin",
"latitude": 52.5042,
"longitude": 13.4395,
"zip": "10997",
"timezone": "Europe/Berlin",
"local_time": "2026-08-17T15:18:51+02:00",
"local_time_unix": 1786972731,
"is_daylight_savings": true
},
"suspicious_factors": {
"is_vpn": false,
"is_proxy": false,
"is_tor_node": false,
"is_datacenter": false,
"is_spam": false,
"is_crawler": false,
"is_threat": false
}
}
GET /api/v1/ip/{ip}?api_key={key}
const res = await fetch(
"https://ip-api.io/api/v1/ip/78.55.53.58?api_key=YOUR_API_KEY"
);
const data = await res.json();
console.log(data.location.city); // Berlin
console.log(data.location.timezone); // Europe/Berlin
{
"ip": "78.55.53.58",
"isp": "Telefonica Germany",
"asn": "AS6805",
"location": {
"country": "Germany",
"country_code": "DE",
"city": "Berlin",
"latitude": 52.5042,
"longitude": 13.4395,
"zip": "10997",
"timezone": "Europe/Berlin",
"local_time": "2026-08-17T15:18:51+02:00",
"local_time_unix": 1786972731,
"is_daylight_savings": true
},
"suspicious_factors": {
"is_vpn": false,
"is_proxy": false,
"is_tor_node": false,
"is_datacenter": false,
"is_spam": false,
"is_crawler": false,
"is_threat": false
}
}
GET /api/v1/ip/{ip}?api_key={key}
import requests
res = requests.get(
"https://ip-api.io/api/v1/ip/78.55.53.58",
params={"api_key": "YOUR_API_KEY"}
)
loc = res.json()["location"]
print(loc["city"], loc["country"]) # Berlin Germany
{
"ip": "78.55.53.58",
"isp": "Telefonica Germany",
"asn": "AS6805",
"location": {
"country": "Germany",
"country_code": "DE",
"city": "Berlin",
"latitude": 52.5042,
"longitude": 13.4395,
"zip": "10997",
"timezone": "Europe/Berlin",
"local_time": "2026-08-17T15:18:51+02:00",
"local_time_unix": 1786972731,
"is_daylight_savings": true
},
"suspicious_factors": {
"is_vpn": false,
"is_proxy": false,
"is_tor_node": false,
"is_datacenter": false,
"is_spam": false,
"is_crawler": false,
"is_threat": false
}
}
GET /api/v1/ip/{ip}?api_key={key}
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,
"https://ip-api.io/api/v1/ip/78.55.53.58?api_key=YOUR_API_KEY");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$data = json_decode(curl_exec($ch));
echo $data->location->city; // Berlin
{
"ip": "78.55.53.58",
"isp": "Telefonica Germany",
"asn": "AS6805",
"location": {
"country": "Germany",
"country_code": "DE",
"city": "Berlin",
"latitude": 52.5042,
"longitude": 13.4395,
"zip": "10997",
"timezone": "Europe/Berlin",
"local_time": "2026-08-17T15:18:51+02:00",
"local_time_unix": 1786972731,
"is_daylight_savings": true
},
"suspicious_factors": {
"is_vpn": false,
"is_proxy": false,
"is_tor_node": false,
"is_datacenter": false,
"is_spam": false,
"is_crawler": false,
"is_threat": false
}
}
GET /api/v1/ip/{ip}?api_key={key}
require 'net/http'
require 'json'
uri = URI('https://ip-api.io/api/v1/ip/78.55.53.58')
uri.query = URI.encode_www_form(api_key: 'YOUR_API_KEY')
res = Net::HTTP.start(uri.hostname, use_ssl: true) { |h| h.get(uri) }
loc = JSON.parse(res.body)['location']
puts "#{loc['city']}, #{loc['country']}" # Berlin, Germany
{
"ip": "78.55.53.58",
"isp": "Telefonica Germany",
"asn": "AS6805",
"location": {
"country": "Germany",
"country_code": "DE",
"city": "Berlin",
"latitude": 52.5042,
"longitude": 13.4395,
"zip": "10997",
"timezone": "Europe/Berlin",
"local_time": "2026-08-17T15:18:51+02:00",
"local_time_unix": 1786972731,
"is_daylight_savings": true
},
"suspicious_factors": {
"is_vpn": false,
"is_proxy": false,
"is_tor_node": false,
"is_datacenter": false,
"is_spam": false,
"is_crawler": false,
"is_threat": false
}
}
Choosing the Best IP Geolocation API
Most providers return the same shape of data, so the differences that matter are in the details below. These are the five things worth checking before you commit, whichever provider you pick.
Published accuracy figures
A provider that will not state its city-level accuracy is asking you to take it on trust. Look for per-level numbers, not a single marketing percentage, and treat any claim of street-level precision from an IP alone as a red flag.
Anonymizer flags in the same call
A location is only as good as your confidence that it is not a VPN exit. If proxy, VPN, Tor, and datacenter detection cost a second request or a higher tier, your per-lookup price is really double what the pricing page says.
Latency and uptime commitments
Geolocation usually sits in a request path that a user is waiting on, so a slow lookup is a slow page. Check the published response time and whether there is an actual SLA rather than a status page.
Rate limits and what the free tier really allows
Compare monthly quotas, per-second limits, and what happens when you exceed them — a hard block and a queued retry are very different failure modes. Check whether the free tier includes the security flags or only bare location.
GDPR and data-handling posture
In the EU an IP address is personal data, so how a provider logs and retains the addresses you send matters for your own compliance position. Ask what is stored, for how long, and where it is processed.
Is There a Free IP Geolocation API?
Yes. You can query this endpoint on the free tier with an API key and no card, which is enough to build and test an integration end to end. The paid plans raise the monthly request quota rather than unlocking fields — location, timezone, ISP, ASN, and the security flags are all in the free response, so nothing about your integration changes when you upgrade.
If you are actively comparing vendors rather than evaluating us in isolation, we keep a side-by-side breakdown where you can compare IP geolocation API providers on coverage, pricing, and limits.
IP Geolocation API FAQs
Common questions about resolving IP addresses to locations.
What is an IP geolocation API?
An IP geolocation API is an HTTP endpoint that takes an IP address and returns the
geographic and network information associated with it — country, region, city,
coordinates, postal code, timezone, and the ISP and autonomous system that operate the
address. You send GET /api/v1/ip/8.8.8.8 and get a JSON object back, which
means you can localize or risk-score a request without asking the user for anything.
How accurate is IP geolocation?
Accuracy depends on how fine a geography you need. Ours is 99.8% at country level, 95% at region or state level, and 85–95% at city level, with coordinates carrying a median accuracy radius of about 50 km. Country-level data is dependable enough to make automated decisions on; city-level data should be treated as a strong signal rather than a fact.
How do I convert an IP address to a location?
Call GET https://ip-api.io/api/v1/ip/{ip}?api_key=YOUR_API_KEY and read the
location object from the response. There is nothing to install, and the same
endpoint accepts IPv4 and IPv6. You can also paste an address into the tool at the top of
this page to see the exact payload before you write any code.
Is there a free IP geolocation API?
Yes. Sign up for an API key and you can query this endpoint on the free tier with no card required. Paid plans increase the monthly request quota rather than unlocking fields, so the free response contains the same location, timezone, ISP, ASN, and security flags as a paid one.
Does the IP geolocation API support IPv6?
Yes, through the same endpoint and with the same response shape — pass an IPv6
address such as 2606:4700:4700::1111 where you would pass an IPv4 one. No
separate parameter or endpoint is needed. IPv6 allocations are often more precise than
IPv4 because they are newer and less heavily re-assigned.
Can IP geolocation find a street address?
No, and no provider can. IP geolocation resolves to a city or metropolitan area, not a building or household. The coordinates in the response are the centroid of an estimated area, which is why they often land on a city centre rather than anywhere meaningful. Any service claiming street-level accuracy from an IP address alone is overstating what the underlying data supports.
Why does the API sometimes return the wrong city?
Usually because the address genuinely does not sit where the user does. Mobile carriers
and carrier-grade NAT route many subscribers through one egress point, corporate WANs send
branch traffic out through a head office, and VPN or cloud addresses resolve to the
provider's location. Check is_vpn, is_proxy, and
is_datacenter in the same response: if one is true, the location is the
intermediary's, not the user's.
Is IP geolocation GDPR compliant?
IP addresses are treated as personal data under GDPR, so looking one up is processing that needs a lawful basis — commonly legitimate interest for fraud prevention and security, or consent for personalization and analytics. Using an API rather than a local database does not change your obligations, so document your basis and your retention period for the addresses you send.
Simple, transparent pricing
Plans raise your request quota. Every field is included on every plan.
Turn any IP address into a location
Country, city, timezone, ISP, and anonymizer flags in one call. Free tier, no card needed.