API Directory › 🌍 Geo & Location › ip-api
No authHTTPS

ip-api API

Free IP geolocation — country, city, ISP and coordinates from an IP address.

Auth
No auth needed
HTTPS
Yes
CORS
No
Open ip-api docs ↗

What it does

ip-api.com resolves an IP address (or your own) to country, region, city, latitude/longitude, timezone, ISP, organisation and AS number. It also has a batch endpoint for up to 100 IPs in one call.

Base URL

http://ip-api.com/json

Authentication

The free tier needs no key but is HTTP only and non-commercial. HTTPS, commercial use and higher limits require a paid key used against https://pro.ip-api.com with ?key=.

Code examples

curl
curl -s "http://ip-api.com/json/8.8.8.8?fields=status,country,city,lat,lon,isp,query"
Python (batch)
import requests

r = requests.post("http://ip-api.com/batch",
    json=["8.8.8.8", "1.1.1.1"],
    params={"fields": "query,country,city,isp"}, timeout=10)
for row in r.json():
    print(row["query"], row["country"], row["isp"])

Rate limits & quotas

Free: 45 requests/minute per IP. When you approach it the response adds X-Rl (remaining) and X-Ttl (seconds to reset) headers; go over and you are HTTP 429 and can be temporarily banned. Use ?fields= to request only the fields you need — it does not change the rate limit but keeps responses small.

Key response fields

statussuccess or fail (with a message)
country / countryCodeName and ISO code
city / regionNameCity and state/region
lat / lonApproximate coordinates (city-level)
isp / org / asNetwork operator and AS number

Common errors

status: failReserved/invalid IP, or the IP is not in the database.
429Over 45/min — honour X-Ttl before retrying.
(HTTPS refused)The free endpoint is HTTP only; upgrade for TLS.

When to use it (and alternatives)

Great for quick, free, server-side geolocation in analytics and fraud checks — but only for non-commercial projects over HTTP. For HTTPS and commercial use, compare ipinfo or ipgeolocation.io. If you only need the country code, country.is is simpler.

FAQ

Can I use ip-api.com in a commercial product?

Not on the free tier — its terms restrict it to non-commercial use over HTTP. A paid key removes that restriction and enables HTTPS.

Why is the city wrong?

IP geolocation is approximate. City-level accuracy is typically 50–80% for fixed-line connections and much worse for mobile carriers and VPNs. Treat it as a hint, not a fact.

How do I look up many IPs efficiently?

POST a JSON array of up to 100 IPs to http://ip-api.com/batch. It counts as one request against the rate limit.

New to APIs?

Short guides for working with this API — and any other.

🛠️ Handy LarzOS tools

Free tools to help you work with this API.

IP LookupDNS Lookup

Related Geo & Location APIs

← Back

More Geo & Location APIs · All 196 APIs