Powered by cdn.api1.in — Auto & Manual IP Detection
Automatically detects visitor's IP and location on page load
Lookup any IP address with a simple function call
Get country, city, coordinates, ISP, timezone and more
Just 3KB minified with zero dependencies
99.9% uptime with rate limiting and caching
HTTPS encryption and API key authentication
Waiting for input...
Add this script to your HTML (replace with your app_key):
<script src="https://cdn.api1.in/iptoaddress/sdk.js?app_key=YOUR_APP_KEY" defer></script>
defer attribute to load the script without blocking page rendering.
Auto-detect visitor's location:
// Auto-detect current visitor's location
IPtoAddressSDK.getLocation()
.then(data => {
console.log('Location data:', data);
// Example: { ip: '123.45.67.89', country: 'United States', ... }
})
.catch(error => {
console.error('Error:', error.message);
});
Lookup specific IP address:
// Manual IP lookup
IPtoAddressSDK.getLocation('8.8.8.8')
.then(data => console.log(data))
.catch(error => console.error(error));
| Method | Description | Parameters | Returns |
|---|---|---|---|
getLocation() |
Auto-detects visitor's IP and location | None | Promise<LocationData> |
getLocation(ip) |
Looks up location for specific IP | ip: String (IPv4 address) |
Promise<LocationData> |
version |
Current SDK version | None | String |
| Field | Type | Description |
|---|---|---|
ip |
String | The IP address that was queried |
country |
String | Country name |
countryCode |
String | 2-letter country code (ISO 3166-1 alpha-2) |
region |
String | Region/state name |
city |
String | City name |
latitude |
Number | Decimal latitude |
longitude |
Number | Decimal longitude |
timezone |
String | IANA timezone (e.g. "America/New_York") |
isp |
String | Internet Service Provider name |
asn |
String | Autonomous System Number |
organization |
String | Organization name |
Call our API endpoints directly using the app_key query parameter:
GET https://api1.in/ip-services/v1/api/location/where-i-am?app_key=YOUR_APP_KEY
fetch('https://api1.in/ip-services/v1/api/location/where-i-am?app_key=f4d303b37ba344678ec22a29b2a5d267')
.then(response => response.json())
.then(data => console.log(data))
.catch(error => console.error('Error:', error));
GET https://api1.in/ip-services/v1/api/location?ip=8.8.8.8&app_key=YOUR_APP_KEY
fetch('https://api1.in/ip-services/v1/api/location?ip=8.8.8.8&app_key=f4d303b37ba344678ec22a29b2a5d267')
.then(response => response.json())
.then(data => console.log(data))
.catch(error => console.error('Error:', error));
app_key in client-side code for production applications{
"ip": "8.8.8.8",
"country": "United States",
"countryCode": "US",
"region": "California",
"city": "Mountain View",
"latitude": 37.4056,
"longitude": -122.0775,
"timezone": "America/Los_Angeles",
"isp": "Google LLC",
"asn": "AS15169",
"organization": "Google"
}
| Status | Description | Example Response |
|---|---|---|
| 400 | Invalid IP format | {"error": "Invalid IP address"} |
| 401 | Invalid/missing app_key | {"error": "Unauthorized"} |
| 429 | Rate limit exceeded | {"error": "Too many requests"} |
defer to avoid render blocking.catch()Accuracy varies by IP and region. Typically:
Yes, the free tier allows 1,000 requests/day. Contact us for higher limits.
Yes! The SDK works in web views, or you can call the API directly from native code.
Our database is updated weekly with the latest IP allocations and locations.