The IP2ASN API call retrieves ASN & Subnet info about an IP address (IPv4 and IPv6).
API request
https://freeapi.dnslytics.net/v1/ip2asn/<ip>
Parameters:
ip
IPv4 or IPv6 address, for example 8.8.8.8 or 2001:4860:4860::8888
API response
A JSON object with the following fields:
ip
Requested IP address.
announced
IP announced in global routing table (true or false).
cidr
Announced Prefix.
asn
AS Number.
shortname
AS Description.
country
AS Country Registration.
URL
$ curl https://freeapi.dnslytics.net/v1/ip2asn/8.8.8.8
Output
{
"ip": "8.8.8.8",
"announced": true,
"cidr": "8.8.8.0/24",
"asn": 15169,
"shortname": "Google LLC",
"country": "US"
}
URL
$ curl https://freeapi.dnslytics.net/v1/ip2asn/192.168.1.1
Output
{
"ip": "192.168.1.1",
"announced": false
}