Endpoints
| Request | Answer |
|---|---|
GET https://iptrustcheck.com/ip | Your IP address as plain text, nothing else. Handy in scripts. |
GET https://iptrustcheck.com/json | JSON about your own IP address. |
GET https://iptrustcheck.com/json/8.8.8.8 | JSON about any IPv4 or IPv6 address. |
?lang=fr | Country, region and city names in another language when we have them (de, es, fr, pt, ru…). |
?pretty | Indented 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
| Field | Meaning |
|---|---|
scope | public, private (LAN) or reserved. Only public addresses have a location. |
country_code | Two-letter ISO code of the country where the address is used. |
registered_country_code, rir | Country where the block is registered, and the regional registry (ARIN, RIPE NCC, APNIC, LACNIC, AFRINIC). It can differ from the country of use. |
asn, org | Network (autonomous system) and its owner, usually the internet provider or hosting company. |
anycast | true when the same address is served from many places (public DNS, CDNs). The location is then only one of them. |
type | isp (home or mobile), hosting (data center), vpn, tor, or private / reserved. |
risk | low, medium or high: a simple summary of the type for sign-up or fraud checks. |
Limits and fair use
- Your own IP (
/ip,/json): no fixed limit, please do not call it more than needed. - Other IPs (
/json/…): up to 30 lookups per minute per IP address. Above that you get HTTP 429 with aRetry-Afterheader. - HTTPS only. CORS is open, so you can call it from a web page.
- Results are best estimates: city locations are approximate and VPN detection is never 100%.
- Need many lookups? Cache answers on your side; IP data changes slowly.
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.