BYTETOOLS

IPinfo API

Look up city, region, country, coordinates and ASN for any IP address. The /json endpoint works with no token. Real captured response and the field traps explained.

No API key requiredCORS enabledHTTPSFree tier

Endpoint tested and returned HTTP 200 on 2026-08-21

What is the IPinfo API?

IPinfo returns geolocation and network data for an IP address. `GET https://ipinfo.io/json` gives you the caller's own IP with city, region, country, approximate coordinates, ASN and organisation, and works without a token at a limited request volume.

IPinfo is the IP data provider that most developers meet first, largely because the tokenless `ipinfo.io/json` call has been quietly working in tutorials for a decade. The free anonymous tier is genuinely usable for a personal dashboard or a one-off diagnosis, and the paid tiers exist for volume rather than for unlocking basic fields.

Two fields will bite you if you map them straight into a database. `loc` is a single string of `"lat,lng"`, not a pair of numbers, so it needs splitting and casting before any distance maths. `org` glues the ASN to the organisation name in one string, as in `AS17557 Pakistan Telecommunication Company Limited`, so extracting a clean ASN means splitting on the first space. A `readme` field appears in anonymous responses; its presence is a reliable signal that you are on the tokenless path.

Quick facts

Base URL
https://ipinfo.io
Authentication
The `/json` endpoint answers without a token at a limited daily volume. A free registered token raises the allowance and unlocks extra fields, but nothing here requires one.
Rate limit
Anonymous use is capped by IP; sustained polling will start returning 429. Cache per address rather than per request.
Pricing
Free anonymous tier, free registered tier with a higher cap, then paid plans for volume and for privacy-detection data.
CORS
Enabled — callable directly from browser JavaScript
Official docs
Read the docs

How to use the IPinfo API

Every request below was executed against the live API on 2026-08-21, and the response shown is the real body it returned — not an illustration.

1. Look up the caller's own IP address

GET https://ipinfo.io/json

curl
curl 'https://ipinfo.io/json'
JavaScript (fetch)
const res = await fetch("https://ipinfo.io/json");
if (!res.ok) throw new Error(`Request failed: ${res.status}`);
const data = await res.json();
console.log(data);
Python (requests)
import requests

res = requests.get("https://ipinfo.io/json", timeout=20)
res.raise_for_status()
print(res.json())
Response — HTTP 200
{
  "ip": "182.185.184.9",
  "city": "Lahore",
  "region": "Punjab",
  "country": "PK",
  "loc": "31.5580,74.3507",
  "org": "AS17557 Pakistan Telecommunication Company Limited",
  "postal": "54000",
  "timezone": "Asia/Karachi",
  "readme": "https://ipinfo.io/missingauth"
}

Parameters

ParameterTypeRequiredDescription
{ip}pathOptionalAny IPv4 or IPv6 address to look up, e.g. `/8.8.8.8/json`. Omit it to look up the caller. 8.8.8.8
{field}pathOptionalRequest one field as a bare value, e.g. `/8.8.8.8/country` returns `US` with no JSON or quotes. country
tokenstringOptionalOptional API token appended as a query parameter to lift the anonymous cap.

Response fields

ipstring
The address that was looked up, echoed back. Use it to confirm the API resolved the caller you expected.
city / region / countrystring
Locality, first-level subdivision and ISO 3166-1 alpha-2 country code. `country` is a two-letter code, not a name.
locstring
Latitude and longitude in one comma-separated string, such as `"31.5580,74.3507"`. Split and cast before doing arithmetic.
orgstring
ASN and organisation name concatenated, for example `"AS17557 Pakistan Telecommunication Company Limited"`. Split on the first space to separate them.
postal / timezonestring
Postal code and IANA timezone. Postal code is missing for some countries, so treat it as optional.
readmestring
Present only on anonymous responses; a link explaining the tokenless limits. Its presence tells you which tier answered.

What you can build with the IPinfo API

  • Show visitors a localised currency, language or timezone default on first load
  • Detect the country of an incoming request for compliance or content licensing
  • Enrich server logs with ASN and organisation for abuse investigations
  • Diagnose whether a user is behind a VPN, datacentre or residential connection
  • Build a simple 'where am I' diagnostic page for a support team

Common errors and how to fix them

429

The anonymous request allowance for your IP is exhausted.

Fix: Cache results per address, and register a free token if you need a higher ceiling.

`bogon: true` in the response

You looked up a private, reserved or loopback address.

Fix: Filter RFC 1918 and other reserved ranges client-side before spending a request on them.

Missing city or postal

Geolocation confidence varies; some addresses resolve only to a country.

Fix: Always code for absent fields rather than assuming the full object shape.

IPinfo API — frequently asked questions

Can I use the IPinfo API without an API key?

Yes. `https://ipinfo.io/json` answers anonymously with the core geolocation and ASN fields, subject to a per-IP daily cap. A free token raises that cap.

How accurate is IP geolocation?

Country level is highly reliable. City level is an estimate derived from network registration and routing data, and it can be badly wrong for mobile networks and VPNs. Never use it for anything safety-critical.

Why is loc a string instead of two numbers?

It is a historical format choice kept for backwards compatibility. Split on the comma and cast each half to a float before doing any distance calculation.

How do I extract just the ASN?

Take the substring of `org` up to the first space, which yields `AS17557`. The remainder is the organisation name, which is free text and can change.

Tools that pair with this API

IPinfo is an independent third-party service and is not affiliated with ByteTools or ByteVancer. Details on this page were verified on 2026-08-21; always check the official documentation before relying on this API in production, as terms and limits can change.