GET/api/v2/ip
IP lookup API
Who an IPv4 or IPv6 address belongs to: its network, prefix, registry, reverse DNS name, location and connection type.
- 60 calls a minute per IP
- Same engine as the IP Lookup tool
{
"query": {
"ip": "8.8.8.8"
},
"ip": "8.8.8.8",
"version": 4,
"special": null,
"hostname": "dns.google",
"network": {
"asn": 15169,
"name": "Google",
"organization": "Google LLC",
"handle": "GOOGLE",
"prefix": "8.8.8.0/24",
"registry": "arin",
"allocated": "2023-12-28",
"country": "US",
"otherOrigins": [],
"brand": {
"name": "Google",
"website": "google.com"
},
"kind": "hosting",
"service": null,
"users": null
},
"location": {
"country": "US",
"countryName": "United States",
"region": "California",
"city": "Mountain View",
"latitude": 37.422,
"longitude": -122.085,
"source": "dbip",
"attribution": "IP Geolocation by DB-IP (https://db-ip.com), CC BY 4.0"
},
"connection": {
"type": "hosting",
"tor": false,
"relay": null
},
"tookMs": 1678
}How it works
Describes any address from free, open sources: Team Cymru's IP-to-ASN service for the announcing network, its prefix, registry and allocation date (every origin when several networks announce it); the PTR record; DB-IP City Lite for the location (CC BY 4.0: show location.attribution where you display it); the Tor Project's exit list; and our network table (brand, kind, APNIC's user estimate) to tell a home ISP from a mobile carrier, a data centre or a relay.
A special-purpose address (private, CGNAT, loopback, link-local, documentation, multicast, reserved) is answered at once as a 200 with special filled in and everything else null: there is nothing on the internet to look up. Blocks IANA marks as public (6to4, NAT64, AS112) are looked up normally and still carry special.
Locations are where DB-IP places the address, not where a person is: an anycast, mobile or hosting address can be far from its users. A source that fails leaves its fields null and adds a warning; no paid geolocation service is ever called.
Query parameters
ipstringrequiredAn IPv4 or IPv6 address. IPv6 may be written in any form, with brackets;::ffff:8.8.8.8means8.8.8.8.
Response fields
200 with this JSON object, plus tookMs, and incomplete with warnings when a source failed. Fields marked optional appear only when they apply.
queryobjectalwaysWhat was looked up, normalised (lower case, no trailing dot, IDNs as Punycode).ipstringalwaysThe address, written the usual way (IPv6 compressed and lower case; an IPv4-mapped address as its IPv4 address).
ipstringalwaysThe address looked up.versionintegeralways4 or 6.one of
4,6specialobject or nullalwaysThe special-purpose block the address is in (IANA's IPv4 and IPv6 Special-Purpose Address Registries), or null for an ordinary address.Show 5 fields
kindstringalwaysprivate(RFC 1918, RFC 4193),cgnat(RFC 6598),loopback,link-local,documentation,multicastorreserved: never on the public internet, so nothing else was looked up.special-purpose: an IANA block that is on the public internet (6to4, Teredo, NAT64's well-known prefix, AS112), looked up normally.one of
"private","cgnat","loopback","link-local","documentation","multicast","reserved","special-purpose"blockstringalwaysThe block, e.g.10.0.0.0/8.namestring or nullalwaysIANA's name for the block, e.g.Private-Use.rfcstring or nullalwaysThe RFC that defines it, e.g.RFC 1918.globallyReachableboolean or nullalwaysIANA's "Globally Reachable" column; null where IANA leaves it open.
hostnamestring or nullalwaysThe reverse DNS (PTR) name, or null when there is none.networkobject or nullalwaysThe network that announces the address (Team Cymru), or null when no network announces it (or Team Cymru didn't answer: seewarnings).Show 13 fields
asnintegeralwaysThe AS number.namestringalwaysThe network's name as people read it ("Google", "Comcast Cable Communications").organizationstring or nullalwaysThe AS's registered holder, as Team Cymru has it ("Google LLC").handlestring or nullalwaysThe AS's registered handle ("GOOGLE").prefixstring or nullalwaysThe most specific announced prefix holding the address.registrystring or nullalwaysThe regional registry:arin,ripencc,apnic,lacnicorafrinic.allocatedstring or nullalwaysWhen the registry handed out the address block (YYYY-MM-DD).countrystring or nullalwaysThe country the block is registered in (not where the address is used).otherOriginsarray of integersalwaysOther AS numbers announcing a prefix with this address (multi-origin), usually empty.brandobject or nullalwaysThe brand people know ("Xfinity" for Comcast's AS7922), where our brand table has the network.Show 2 fields
namestringalwaysThe brand.websitestring or nullalwaysThe brand's website domain.
kindstring or nullalwaysWhat kind of network it is:isp(home broadband),mobile,relay(Apple iCloud Private Relay, Cloudflare WARP),hosting(cloud, hosting, VPN exits, CDNs),satellite,other. From APNIC's user counts, a hand-checked brand table and name rules.one of
"isp","mobile","relay","hosting","satellite","other",nullservicestring or nullalwaysThe brand table's service:fixed(home broadband),mobile,bothorsatellite.one of
"fixed","mobile","both","satellite",nullusersobject or nullalwaysAPNIC Labs' estimate of the people online through the network in its main country, or null (not counted, or a hosting or relay network, whose "users" are VPN and relay users).Show 5 fields
countrystringalwaysISO 3166-1 alpha-2 country code.estimateintegeralwaysEstimated users there.sharenumberalwaysPercent of the country's users.rankintegeralwaysRank among the networks APNIC lists there (1 = largest).countryUsersinteger or nullalwaysThe country's estimated internet users.
locationobject or nullalwaysWhere DB-IP City Lite places the address, or null when it has no location for it.Show 8 fields
countrystring or nullalwaysISO 3166-1 alpha-2 country code.countryNamestring or nullalwaysThe country's English name.regionstring or nullalwaysRegion or state.citystring or nullalwaysCity.latitudenumber or nullalwaysLatitude of the city.longitudenumber or nullalwaysLongitude of the city.sourcestringalwaysAlwaysdbip.attributionstringalwaysThe credit DB-IP's licence (CC BY 4.0) asks for wherever its data is shown.
connectionobjectalwaysWhat kind of connection the address is.typestring or nullalwaysOne type for the address, most specific first:tor(the Tor Project's exit list),relay,hosting,mobile,satellite,residential(a home ISP),business; null when unknown.one of
"tor","relay","hosting","mobile","satellite","residential","business",nulltorboolean or nullalwaysWhether the address is a Tor exit right now (the Tor Project's own list, kept 30 minutes); null for IPv6 (the list has none) or when the list couldn't be read.relaystring or nullalwaysA network that carries other people's traffic on purpose:icloud(Akamai's AS36183, iCloud Private Relay),cloudflare(AS13335: WARP, but also any Cloudflare server),fastly(AS54113).one of
"icloud","cloudflare","fastly",null
Errors
503unavailableTeam Cymru, reverse DNS and the location data all failed at once.
Plus the errors every endpoint can return: 400 for a missing or unreadable parameter, 429 past the limit, 503 when every source failed.
Code samples
curl "https://dnsrobot.net/api/v2/ip?ip=8.8.8.8"const params = new URLSearchParams({ ip: "8.8.8.8" });
const res = await fetch(`https://dnsrobot.net/api/v2/ip?${params}`);
const data = await res.json();
if (!res.ok) throw new Error(data.error.message);
console.log(data.network);import requests
r = requests.get(
"https://dnsrobot.net/api/v2/ip",
params={"ip": "8.8.8.8"},
timeout=30,
)
data = r.json()
if not r.ok:
raise RuntimeError(data["error"]["message"])
print(data["network"])package main
import (
"encoding/json"
"fmt"
"net/http"
"net/url"
)
func main() {
q := url.Values{"ip": {"8.8.8.8"}}
res, err := http.Get("https://dnsrobot.net/api/v2/ip?" + q.Encode())
if err != nil {
panic(err)
}
defer res.Body.Close()
var data map[string]any
if err := json.NewDecoder(res.Body).Decode(&data); err != nil {
panic(err)
}
if res.StatusCode != http.StatusOK {
panic(data["error"])
}
fmt.Println(data["network"])
}<?php
$query = http_build_query(["ip" => "8.8.8.8"]);
$context = stream_context_create(["http" => ["ignore_errors" => true, "timeout" => 30]]);
$data = json_decode(file_get_contents("https://dnsrobot.net/api/v2/ip?" . $query, false, $context), true);
if (isset($data["error"])) {
throw new RuntimeException($data["error"]["message"]);
}
print_r($data["network"]);require "net/http"
require "json"
uri = URI("https://dnsrobot.net/api/v2/ip")
uri.query = URI.encode_www_form(ip: "8.8.8.8")
data = JSON.parse(Net::HTTP.get(uri))
raise data["error"]["message"] if data["error"]
puts data["network"]// Cargo.toml: reqwest = { version = "0.13", features = ["blocking", "json"] }, serde_json = "1"
fn main() -> Result<(), Box<dyn std::error::Error>> {
let res = reqwest::blocking::get("https://dnsrobot.net/api/v2/ip?ip=8.8.8.8")?;
let ok = res.status().is_success();
let data: serde_json::Value = res.json()?;
if !ok {
return Err(data["error"]["message"].to_string().into());
}
println!("{}", data["network"]);
Ok(())
}using System.Text.Json;
using var http = new HttpClient();
var res = await http.GetAsync("https://dnsrobot.net/api/v2/ip?ip=8.8.8.8");
var data = JsonDocument.Parse(await res.Content.ReadAsStringAsync()).RootElement;
if (!res.IsSuccessStatusCode)
throw new Exception(data.GetProperty("error").GetProperty("message").GetString());
Console.WriteLine(data.GetProperty("network"));Google Public DNS
GET /api/v2/ip?ip=8.8.8.8{
"query": {
"ip": "8.8.8.8"
},
"ip": "8.8.8.8",
"version": 4,
"special": null,
"hostname": "dns.google",
"network": {
"asn": 15169,
"name": "Google",
"organization": "Google LLC",
"handle": "GOOGLE",
"prefix": "8.8.8.0/24",
"registry": "arin",
"allocated": "2023-12-28",
"country": "US",
"otherOrigins": [],
"brand": {
"name": "Google",
"website": "google.com"
},
"kind": "hosting",
"service": null,
"users": null
},
"location": {
"country": "US",
"countryName": "United States",
"region": "California",
"city": "Mountain View",
"latitude": 37.422,
"longitude": -122.085,
"source": "dbip",
"attribution": "IP Geolocation by DB-IP (https://db-ip.com), CC BY 4.0"
},
"connection": {
"type": "hosting",
"tor": false,
"relay": null
},
"tookMs": 1678
}Cloudflare's resolver over IPv6
GET /api/v2/ip?ip=2606%3A4700%3A4700%3A%3A1111{
"query": {
"ip": "2606:4700:4700::1111"
},
"ip": "2606:4700:4700::1111",
"version": 6,
"special": null,
"hostname": "one.one.one.one",
"network": {
"asn": 13335,
"name": "Cloudflare",
"organization": "Cloudflare, Inc.",
"handle": "CLOUDFLARENET",
"prefix": "2606:4700:4700::/48",
"registry": "arin",
"allocated": "2011-11-01",
"country": "US",
"otherOrigins": [],
"brand": {
"name": "Cloudflare",
"website": "cloudflare.com"
},
"kind": "hosting",
"service": null,
"users": null
},
"location": {
"country": "CA",
"countryName": "Canada",
"region": "Quebec",
"city": "Montreal",
"latitude": 45.502,
"longitude": -73.567,
"source": "dbip",
"attribution": "IP Geolocation by DB-IP (https://db-ip.com), CC BY 4.0"
},
"connection": {
"type": "hosting",
"tor": null,
"relay": "cloudflare"
},
"tookMs": 355
}A private address
GET /api/v2/ip?ip=192.168.1.1{
"query": {
"ip": "192.168.1.1"
},
"ip": "192.168.1.1",
"version": 4,
"special": {
"kind": "private",
"block": "192.168.0.0/16",
"name": "Private-Use",
"rfc": "RFC 1918",
"globallyReachable": false
},
"hostname": null,
"network": null,
"location": null,
"connection": {
"type": null,
"tor": null,
"relay": null
},
"tookMs": 0
}