When to use this API
When you need to know where an IP address is — city, region, country, coordinates, timezone, postal code, or the network operator behind it. IPinfo has a trick most geolocation APIs lack: append a field name to the URL and get back plain text instead of JSON. That's useful when you need one value and don't want to parse a full response object. The free, unauthenticated tier covers geolocation and network data; ASN details, company, carrier, and abuse lookups require a paid token.
Looking up a specific IP's location and network
"Where is 8.8.8.8 located, and who runs it?" Use /{ip}/json for the full picture — city, region, country, coordinates, postal code, timezone, hostname, and the AS/org line, all in one response. 8.8.8.8 is a familiar IP, but it's the right example here because it surfaces a field most IPs don't have.
curl "https://ipinfo.io/8.8.8.8/json" | head -c 10000
{
"ip": "8.8.8.8",
"hostname": "dns.google",
"city": "Mountain View",
"region": "California",
"country": "US",
"loc": "37.4056,-122.0775",
"org": "AS15169 Google LLC",
"postal": "94043",
"timezone": "America/Los_Angeles",
"anycast": true,
"readme": "https://ipinfo.io/missingauth"
}
The anycast field appears only when IPinfo detects that the IP is advertised from multiple locations worldwide. For 8.8.8.8 — Google's public DNS resolver — that's true: the same IP responds from dozens of data centers, and the geolocation shown (Mountain View) is the one nearest to the server making the request. Most geolocation APIs don't surface this distinction; they return a single location as if it were the only one. The readme field is IPinfo's signal that more data is available behind a token — it's not a documentation link.
8.8.8.8 is Google's public DNS resolver, geolocated to Mountain View, California, US. It's an anycast address, meaning the same IP is served from dozens of locations worldwide — the location shown is the one nearest the requesting server. It's operated by AS15169 (Google LLC).
Fetching a single field in plain text
"What timezone is this IP in?" Append a field name to the path and get back that one value as a bare string — no JSON, no parsing. The available suffixes are /city, /region, /country, /loc, /org, /postal, /timezone, and /hostname.
curl "https://ipinfo.io/8.8.8.8/timezone"
America/Los_Angeles
The response is plain text, not JSON — by design. If you need only the timezone, there's no reason to parse a full JSON object and extract one field. The /country endpoint is particularly handy for localization: a single US or DE string is faster to act on than a JSON parse plus field access. One subtlety: /loc returns coordinates as lat,lng (comma-separated), not as a JSON object with separate latitude and longitude fields. If you need them split, call /json and split the loc field yourself.
That IP is in the America/Los_Angeles timezone.
Detecting your own IP and connection type
"What's my current IP and where is it?" Call /json with no IP address — IPinfo geolocates the requesting IP automatically. The hostname and org fields together are a cheap way to tell whether a connection is residential, mobile, or data-center.
curl "https://ipinfo.io/json" | head -c 10000
{
"ip": "178.198.44.186",
"hostname": "186.44.198.178.dynamic.cust.swisscom.net",
"city": "Bern",
"region": "Bern",
"country": "CH",
"loc": "46.9481,7.4474",
"org": "AS3303 Swisscom (Switzerland) Ltd",
"postal": "3000",
"timezone": "Europe/Zurich",
"readme": "https://ipinfo.io/missingauth"
}
The hostname field is a reverse-DNS entry, and it's a quick signal for connection type. The dynamic.cust.swisscom.net pattern tells you this is a consumer broadband line on Swisscom, not a hosted server. Compare that to dns.google from the previous example — clearly a Google anycast service. The org field reinforces this: AS3303 Swisscom (Switzerland) Ltd versus AS15169 Google LLC. When you need to distinguish bot traffic from residential without a token, the hostname + org combination is the cheapest signal available.
Your current IP is 178.198.44.186, located in Bern, Switzerland (CH). It's a Swisscom residential dynamic connection on AS3303.
Pitfalls
/{ip}/georeturns the same shape as/{ip}/json, not a subset. Despite the name suggesting "geolocation only," the actual response includeshostnameandorg— it's functionally identical to the full response, just missing theanycastfield. Don't expect a trimmed payload.- The
locfield is a single"lat,lng"string, not a JSON object with separate latitude and longitude. If you need them as distinct values, split on the comma. - The
readmefield on every free-tier response is a sales prompt (https://ipinfo.io/missingauth), not a documentation link. Ignore it unless you want to upgrade. - Plain-text suffix endpoints (
/city,/country, etc.) return bare strings, not JSON. If your parser expectsContent-Type: application/json, these will fail — they'retext/plain.
One-line summary for the user
I can look up any IP address on ipinfo.io and get its city, region, country, coordinates, timezone, and network operator in a single unauthenticated GET — and I can fetch just one field as plain text by appending the field name to the URL.