The /location/{ip} endpoint provides detailed geolocation and ASN (Autonomous System Number) information for a given IP address. If the {ip} URL parameter is omitted, the service defaults to the requester's IP address.
Error Handling:
If the provided IP address is invalid or if the lookup fails, the API returns a 400 or 401 error with the message: "Input string is not a valid IP address".
GET /location/{ip}
Example Response:
{
"IP": "127.0.0.1",
"Continent": "EU",
"Country": "United Kingdom",
"CountryCode": "GB",
"CountryCode3": "GBR",
"IsInEuropeanUnion": false,
"City": "London",
"PostalCode": "EC1A 1BB",
"Latitude": 51.5074,
"Longitude": -0.1278,
"TimeZone": "Europe/London",
"ASN": 12345,
"Organization": "Example ISP",
"Region": "Greater London",
"RegionCode": "GL",
"Offset": -0
}