A free API for IP geolocation and network information.
Provides detailed information for IP addresses, hostnames, and ASNs.
GET /api/v2/ip/:ip_or_hostname
Example Requests:
/api/v2/ip/8.8.8.8
/api/v2/ip/google.com
Successful Response (200 OK):
{
"ip": "8.8.8.8",
"country_code": "US",
"country": "United States of America",
"country_flag": "🇺🇸",
"continent": "North America",
"as_number": 15169,
"as_description": "GOOGLE",
"error": null
}
Not Found Response (404 Not Found):
{
"ip": "127.0.0.1",
"country_code": null,
"country": null,
"country_flag": null,
"continent": null,
"as_number": null,
"as_description": null,
"error": "IP address not found in database."
}
GET /api/v2/asn/:as_number
Example Request:
/api/v2/asn/15169
Successful Response (200 OK):
{
"as_number": 15169,
"as_description": "GOOGLE",
"cidrs": [
{
"cidr": "8.8.8.0/24",
"country_code": "US",
"country": "United States of America",
"continent": "North America"
},
{
"cidr": "8.8.4.0/24",
"country_code": "US",
"country": "United States of America",
"continent": "North America"
}
],
"error": null
}
Not Found Response (404 Not Found):
{
"as_number": 999999,
"as_description": null,
"cidrs": [],
"error": "AS number not found or has no associated CIDRs in the database."
}
A set of simple endpoints that provide a single piece of information (e.g., country name, ASN, continent) as plain text for a given IP address or hostname.
GET /api/v1/country/:ip_or_hostname
Example Requests:
/api/v1/country/8.8.8.8
/api/v1/country/google.com
Successful Response (200 OK):
United States of America
GET /api/v1/asn/:ip_or_hostname
Example Requests:
/api/v1/asn/8.8.8.8
/api/v1/asn/google.com
Successful Response (200 OK):
15169
GET /api/v1/continent/:ip_or_hostname
Example Requests:
/api/v1/continent/8.8.8.8
/api/v1/continent/google.com
Successful Response (200 OK):
North America
This service uses IP geolocation data from iptoasn.com.
If you find this service useful, please consider supporting its development and maintenance.
Buy me a coffee