The API takes the ip adress of the addr
query parameter or, if unset, the client ip and looks up the country for this ip adress and returns it.
Everybody can use the service without any guarantees given or responsibility taken by iplocator.io
Data
The service is currently just supporting countries in ISO2 format. No longitude/latitude, city or anything else (yet). The service uses data from OpenGeoFeed and performs an update every 24 hours.
Endpoints / Parameters
The only endpoint currently supported is https://api.iplocator.io/ip
.
Parameter | |
---|---|
addr | IPv4 or IPv6 adress. If unset the client ip is used. |
Usage
Browser / nodejs
fetch('https://api.iplocator.io/ip')
.then(r => r.json())
.then(data => console.log(data))
bash
curl "https://api.iplocator.io/ip"
Powershell
$Response = Invoke-WebRequest -Uri "https://api.iplocator.io/ip"
Write-Host $Response.Content
Limitations
Rate limits
The service currently allows one request per second and will return 429
status if the quota is reached.