Call the API by sending HTTP GET requests to
http://[32 random alphanumeric characters].edns.ip-api.com/json

Alternatively, for automatic redirection (slower)
http://edns.ip-api.com/json

Please make sure to make the request from the client's browser. Sending this request from your own server will return the DNS info for that server, which is probably not useful.


Example

GET
http://edns.ip-api.com/json
example response
{
    "dns": {
        "ip": "74.125.73.83",
        "geo": "United States - Google"
    },
    "edns": {
        "ip": "91.198.174.0",
        "geo": "Netherlands - Wikimedia Foundation"
    }
}

dns contains the IP address and Geolocation (country, ISP) of the DNS server the client used.
edns contains the IP address and Geolocation (country, ISP) of the client. If the DNS server did not send the client subnet, the edns field will be be absent.

Results are cached for 60 seconds from the time of the DNS query. If the requested result (domain) expired, the user will be redirected to a new, randomly generated domain.

We are whitelisted for edns-client-subnet with Google Public DNS and OpenDNS.


Testing the API

Test via Google Public DNS:

API_HOST=$(</dev/urandom tr -dc a-z0-9|head -c32).edns.ip-api.com; API_IP=$(dig $API_HOST +short @8.8.8.8); curl -H "Host: $API_HOST" http://$API_IP/json

Test via OpenDNS:

API_HOST=$(</dev/urandom tr -dc a-z0-9|head -c32).edns.ip-api.com; API_IP=$(dig $API_HOST +short @208.67.222.222); curl -H "Host: $API_HOST" http://$API_IP/json

Callback (JSONP)

By default there is no callback function called, but you can supply your own with the GET parameter callback

Example: http://edns.ip-api.com/json/?callback={callback}

Usage limits

We do not allow commercial use of this endpoint. Please see our pro service for SSL access, unlimited queries and commercial support.