ipinfo API
IP address details — geolocation, ASN, company and privacy data.
What it does
ipinfo.io returns IP geolocation plus network context: city, region, country, coordinates, postal code, timezone, and the ASN / organisation. Paid add-ons cover privacy detection (VPN/proxy/hosting), company and carrier data.
Base URL
Authentication
Sign up for a free access token and pass it as ?token=YOUR_TOKEN or Authorization: Bearer YOUR_TOKEN. Unauthenticated requests are allowed but very limited. A separate free ‘Lite’ plan offers unlimited country/ASN lookups.
Code examples
curl -s "https://ipinfo.io/8.8.8.8/json?token=$IPINFO_TOKEN"
import requests
r = requests.get("https://ipinfo.io/json",
params={"token": TOKEN}, timeout=10)
d = r.json()
lat, lon = d["loc"].split(",")
print(d["city"], d["country"], lat, lon, d.get("org"))Rate limits & quotas
Free plan: about 50,000 requests/month with the full geolocation response. Exceed it and you get HTTP 429. The Lite plan (country + ASN only) is unlimited. There is a bulk/batch endpoint for looking up many IPs at once on paid plans.
Key response fields
| ip | The IP that was looked up |
| city / region / country | Location (country is an ISO code) |
| loc | "lat,lon" string — split on the comma |
| org | "AS15169 Google LLC" — ASN plus name |
| postal / timezone | ZIP/postcode and IANA timezone |
Common errors
| 429 | Monthly free quota exhausted — upgrade or wait for reset. |
| 401 / 403 | Missing or invalid token on a paid-only field or endpoint. |
| bogon: true | The IP is private/reserved — not publicly routable. |
When to use it (and alternatives)
A good default for commercial-friendly IP geolocation with clean data and generous free volume. ip-api is free-r but non-commercial and HTTP-only; ipgeolocation.io bundles timezone and currency detail.
FAQ
Is ipinfo free for commercial use?
Yes — unlike some competitors, the free tier can be used commercially within its monthly request cap. Read the current terms for redistribution limits.
How do I get just the country cheaply?
Use the free Lite plan or append /country to the path (https://ipinfo.io/8.8.8.8/country) for a plain two-letter code.
What is a 'bogon'?
A bogon IP is one from a private, reserved or unallocated range (10.x, 192.168.x, 127.x, etc.). ipinfo flags these with "bogon": true instead of returning a fake location.
New to APIs?
Short guides for working with this API — and any other.