Free IP geolocation API

Get your IP address, or the location, network and VPN status of any IP, as JSON. No sign-up and no API key.

Endpoints

RequestAnswer
GET https://iptrustcheck.com/ipYour IP address as plain text, nothing else. Handy in scripts.
GET https://iptrustcheck.com/jsonJSON about your own IP address.
GET https://iptrustcheck.com/json/8.8.8.8JSON about any IPv4 or IPv6 address.
?lang=frCountry, region and city names in another language when we have them (de, es, fr, pt, ru…).
?prettyIndented JSON, easier to read.

Example answer

{
  "ip": "8.8.8.8",
  "version": 4,
  "scope": "public",
  "country": "United States",
  "country_code": "US",
  "region": "California",
  "city": "Mountain View",
  "latitude": 37.422,
  "longitude": -122.085,
  "asn": 15169,
  "org": "Google LLC",
  "registered_country": "United States",
  "registered_country_code": "US",
  "rir": "ARIN",
  "anycast": true,
  "type": "hosting",
  "vpn": false,
  "tor": false,
  "hosting": true,
  "risk": "medium",
  "details": "https://iptrustcheck.com/ip-lookup/?ip=8.8.8.8",
  "attribution": "IP geolocation by DB-IP.com (CC BY 4.0)"
}

Code examples

Command line (curl)

curl https://iptrustcheck.com/ip
curl https://iptrustcheck.com/json/1.1.1.1

JavaScript (browser or Node.js 18+)

const r = await fetch("https://iptrustcheck.com/json");
const ip = await r.json();
console.log(ip.ip, ip.country_code, ip.vpn);

Python

import requests

ip = requests.get("https://iptrustcheck.com/json/8.8.8.8", timeout=10).json()
print(ip["country"], ip["org"], ip["type"])

PHP

$ip = json_decode(file_get_contents("https://iptrustcheck.com/json/8.8.8.8"), true);
echo $ip["country"] . " – " . $ip["org"];

What the fields mean

FieldMeaning
scopepublic, private (LAN) or reserved. Only public addresses have a location.
country_codeTwo-letter ISO code of the country where the address is used.
registered_country_code, rirCountry where the block is registered, and the regional registry (ARIN, RIPE NCC, APNIC, LACNIC, AFRINIC). It can differ from the country of use.
asn, orgNetwork (autonomous system) and its owner, usually the internet provider or hosting company.
anycasttrue when the same address is served from many places (public DNS, CDNs). The location is then only one of them.
typeisp (home or mobile), hosting (data center), vpn, tor, or private / reserved.
risklow, medium or high: a simple summary of the type for sign-up or fraud checks.

Limits and fair use

Attribution

The API is free for personal and commercial use. Location data comes from DB-IP under the CC BY 4.0 license, so if you show the location to your users, add a small credit such as "IP data by IP Trust Check and DB-IP". A link to IP Trust Check is appreciated and keeps the service free.

Frequently asked questions

Do I need an API key?

No. There is no sign-up and no key. Just call the URL.

Is the IP API free for commercial use?

Yes, within the fair-use limits. Please credit DB-IP for location data, as its license asks.

Can I get my IPv6 address?

Yes. Call https://iptrustcheck.com/ip from a connection with IPv6. You get the address your request came from, IPv4 or IPv6.

Why is the location of my IP wrong?

IP location comes from databases, not GPS. Providers often register addresses in a big city or another region. See the explanation on the home page.

More free tools