API
Three read-only JSON endpoints. No key, no sign-up.
Rules
- All endpoints use
GETand return UTF-8 JSON unless noted. - Limit: 60 requests per minute per IP address, of which at most 30 may be lookups that trigger DNS queries. Above that you receive
429 Too Many Requestswith aRetry-Afterheader. - Invalid input returns
422with{"error": "…"}. - Responses are not cacheable (
Cache-Control: no-store). Please cache on your side if you call repeatedly. - The API is provided as is, without an uptime guarantee. For heavy or commercial use, run your own resolver and geolocation database.
Your IP address
GET https://whatsmyip.tr/api/v1/ip
GET https://whatsmyip.tr/api/v1/ip?format=text
{"ip":"203.0.113.42","version":4}
With format=text the response is the bare address followed by a newline, convenient for shell scripts: curl -s https://whatsmyip.tr/api/v1/ip?format=text. This endpoint allows cross-origin requests. To force a protocol, call https://ipv4.whatsmyip.tr/api/v1/ip, which is reachable over IPv4 only.
IP details
GET https://whatsmyip.tr/api/v1/lookup/{ip}
GET https://whatsmyip.tr/api/v1/lookup
Without an address, the caller's own address is used.
{
"ip": "8.8.8.8",
"version": 4,
"scope": "public",
"scope_description": "Public (globally routable) address",
"reverse_dns": "dns.google",
"country": "United States",
"country_code": "US",
"region": "California",
"city": "Mountain View",
"latitude": 37.4,
"longitude": -122.1,
"asn": 15169,
"org": "Google LLC"
}
Fields are null when unknown. For non-public addresses, scope is one of private, loopback, link-local, cgnat, multicast, documentation, translation, mapped or reserved, and location fields are null. Location is approximate; see data sources. Attribution: IP Geolocation by DB-IP.
DNS records
GET https://whatsmyip.tr/api/v1/dns?name=example.com&type=MX
type is one of A, AAAA, CNAME, MX, NS, TXT, PTR, CAA, SOA (default A). For PTR, name may be an IP address.
{
"name": "example.com",
"type": "MX",
"status": "ok",
"resolver": "1.1.1.1",
"queried_at": "2026-01-01T12:00:00+00:00",
"records": [
{"name": "example.com", "type": "MX", "ttl": 300, "data": "10 mail.example.com."}
]
}
status is ok, nodata (the name exists but has no such record), nxdomain, servfail, refused, timeout or error. A DNS-level failure is still an HTTP 200: the request succeeded and the status describes what DNS said.