Geolocation Active

IP to Country API

Convert any IPv4 or IPv6 address to country information instantly. Powered by MaxMind GeoLite2 database with automatic daily updates. Perfect for geolocation, analytics, and access control.

https://ip-to-country.localapi.ro
< 50ms Response Time
1/sec Rate Limit
None Auth Required
Free Pricing

Quick Start

Request
curl "https://ip-to-country.localapi.ro/lookup?ip=8.8.8.8"
Request
import requests

response = requests.get(
    "https://ip-to-country.localapi.ro/lookup",
    params={"ip": "8.8.8.8"}
)

data = response.json()
print(f"Country: {data['country']['name']}")
print(f"Code: {data['country']['iso_code']}")
Request
const response = await fetch(
  "https://ip-to-country.localapi.ro/lookup?ip=8.8.8.8"
);

const data = await response.json();
console.log(`Country: ${data.country.name}`);
console.log(`Code: ${data.country.iso_code}`);

Response

200 OK application/json
{
  "ip": "8.8.8.8",
  "country": {
    "name": "United States",
    "iso_code": "US"
  }
}

Available Endpoints

GET /lookup

Look up country information for an IP address.

Parameters

Parameter Type Required Description
ip string Yes IPv4 or IPv6 address
GET /health

Check service health and availability status.

Error Codes

Code Description
400 Invalid IP address format
404 IP address not found in database
429 Rate limit exceeded
500 Internal server error