What is my IP API and IP whois API
Free, no key and no signup. Get your own IP as plain text, or a JSON record for any IP address or hostname with location, network owner, whois and reverse DNS. Same data as the IP lookup tool.
What is my IP
Plain text, one line, nothing else. Handy in scripts and CI.
$ curl https://api.dnswiz.app/v1/tools/ip?format=text 84.115.220.1
IP lookup and whois
Leave the address off for your own, or add an IPv4 address, an IPv6 address or a hostname.
curl https://api.dnswiz.app/v1/tools/ip curl https://api.dnswiz.app/v1/tools/ip/8.8.8.8 curl https://api.dnswiz.app/v1/tools/ip/2606:4700::1111 curl https://api.dnswiz.app/v1/tools/ip/example.com
{
"ip": "8.8.8.8",
"version": 4,
"ptr": "dns.google",
"public": true,
"location": {
"continent_code": "NA", "continent": "North America",
"country_code": "US", "country": "United States", "in_eu": false,
"region": "California", "city": "Mountain View",
"latitude": 37.422, "longitude": -122.085
},
"asn": {
"number": 15169, "organization": "Google LLC", "network": "8.8.8.0/24"
},
"whois": {
"registry": "ARIN", "name": "GOGL", "organization": "Google LLC",
"range": "8.8.8.0 - 8.8.8.255", "abuse_email": "network-abuse@google.com",
"registered": "2023-12-28"
}
}Fields
| Field | Meaning |
|---|---|
| ip | The address described. For a hostname, its first address, IPv4 preferred. |
| version | 4 or 6. |
| hostname | The hostname you asked about, when you asked about one. |
| ptr | Reverse DNS name, when the owner publishes one. |
| public | false for private and reserved ranges. Those get no location, network or whois. |
| location | continent, country, country_code, in_eu, region, city, latitude, longitude. |
| asn | number, organization and network: the routed block and who announces it. |
| whois | registry, name, organization, range, country, abuse_email, registered. Read live from the regional registry over RDAP; left out when the registry does not answer in time. |
Fields with no value are left out rather than sent empty.
Examples
JavaScript, in the browser or Node. CORS is open.
const res = await fetch('https://api.dnswiz.app/v1/tools/ip/8.8.8.8');
const ip = await res.json();
console.log(ip.location.country, ip.asn.organization, ip.whois?.abuse_email);Python
import requests
ip = requests.get("https://api.dnswiz.app/v1/tools/ip", timeout=10).json()
print(ip["ip"], ip["location"]["country"])Go
resp, err := http.Get("https://api.dnswiz.app/v1/tools/ip?format=text")
if err != nil {
log.Fatal(err)
}
defer resp.Body.Close()
ip, _ := io.ReadAll(resp.Body)
fmt.Print(string(ip))Limits and errors
10 requests a minute per IP. Past that you get 429; wait and retry. A query that is neither an address nor a hostname gets 400, and a hostname with no public address gets 422. Errors use the same problem+json shape as the rest of the dnswiz API.
Lookups are not stored. Location and network data: IP Geolocation by DB-IP, CC BY 4.0. Whois comes from the regional internet registries.