IP Geolocation API

Free JSON API for IP address lookup and geolocation. Get location, ISP details, VPN detection, and more with simple HTTP requests. No registration required.

✨ 1000 free requests/day
🚀 No API key required
🌍 IPv4 & IPv6 support

Quick Start

Try it now - no registration needed:

curl https://whatismyip.io/api/ipinfo

This will return information about your current IP address in JSON format.

API Response Format

Example Response:

{
  "ip": "8.8.8.8",
  "type": "ipv4",
  "location": {
    "country": "United States",
    "country_code": "US",
    "region": "California",
    "region_code": "CA",
    "city": "Mountain View",
    "latitude": 37.4056,
    "longitude": -122.0775,
    "timezone": "America/Los_Angeles",
    "zip": "94043"
  },
  "network": {
    "isp": "Google LLC",
    "organization": "Google Public DNS",
    "asn": 15169,
    "domain": "google.com"
  },
  "security": {
    "is_vpn": false,
    "is_proxy": false,
    "is_tor": false,
    "is_hosting": true,
    "threat_level": "low"
  }
}

API Endpoints

GET/api/ipinfo

Get comprehensive information about an IP address including location, ISP, and security details.

Parameters:

  • ip (optional) - IP address to lookup. If omitted, returns info for your IP.
  • format (optional) - Response format: json (default), xml, csv

Examples:

GET /api/ipinfo

GET /api/ipinfo?ip=8.8.8.8

GET /api/ipinfo?ip=2001:4860:4860::8888&format=json

GET/api/dns-lookup

Query DNS records for any domain including A, AAAA, MX, TXT, NS, CNAME, and SOA records.

Parameters:

  • domain (required) - Domain name to query
  • type (optional) - Record type: A, AAAA, MX, TXT, NS, CNAME, SOA, ALL

Examples:

GET /api/dns-lookup?domain=example.com&type=A

GET /api/dns-lookup?domain=google.com&type=MX

GET/api/smtp-test

Test SMTP server connectivity, authentication, and configuration for email deliverability.

Parameters:

  • host (required) - SMTP server hostname
  • port (optional) - SMTP port (default: 25)
  • tls (optional) - Test TLS support (true/false)

Examples:

GET /api/smtp-test?host=smtp.gmail.com&port=587&tls=true

GET/api/asn-lookup

Get Autonomous System Number (ASN) information for IP addresses including organization and network details.

Parameters:

  • ip (required) - IP address to lookup

Examples:

GET /api/asn-lookup?ip=8.8.8.8

GET/api/email-tests

Comprehensive email deliverability testing including MX records, SPF validation, and SMTP connectivity.

Parameters:

  • domain (required) - Domain to test

Examples:

GET /api/email-tests?domain=example.com

POST/api/bulk

Process multiple IP addresses in a single request. Pro Plan Required

Request Body:

{
  "ips": ["8.8.8.8", "1.1.1.1", "208.67.222.222"],
  "fields": ["location", "security", "network"]
}

Parameters:

  • ips (required) - Array of IP addresses (max 100)
  • fields (optional) - Specific data fields to return

Authentication & API Keys

Getting Started

Our API offers a generous free tier that requires no authentication. For higher limits and premium features, you'll need an API key which can be obtained through our router login system.

Free Tier (No Authentication)

  • • 1,000 requests per day
  • • Rate limit: 10 requests per minute
  • • Basic IP geolocation data
  • • No API key required

Authenticated Requests

  • • Higher rate limits (up to 1000/min)
  • • Premium data fields (threat intelligence, ISP details)
  • • Bulk processing capabilities
  • • Priority support

How to Get an API Key

1

Access Router Login

Navigate to any of our router login pages (192-168-1-1, etc.) to create a free account.

2

Create Account

Sign up with email or use social login options. Verify your email address.

3

Generate API Key

Go to API settings in your dashboard to generate your personal API key.

Using Your API Key

Include your API key in requests using the X-API-Key header:

cURL Example:

curl -H "X-API-Key: your_api_key_here" https://whatismyip.io/api/ipinfo

JavaScript Example:

const response = await fetch('https://whatismyip.io/api/ipinfo', {
  headers: {
    'X-API-Key': 'your_api_key_here'
  }
});
const data = await response.json();

Python Example:

import requests

headers = {'X-API-Key': 'your_api_key_here'}
response = requests.get('https://whatismyip.io/api/ipinfo', headers=headers)
data = response.json()

Rate Limiting

Rate Limit Tiers

PlanDaily LimitPer MinuteBurst Limit
Free (No Key)1,0001020
Starter ($10/mo)10,00050100
Pro ($50/mo)100,0005001000
EnterpriseCustomCustomCustom

Rate Limit Headers

Every API response includes headers to help you track your usage:

X-RateLimit-Limit: 1000
X-RateLimit-Remaining: 999
X-RateLimit-Reset: 1640995200
X-RateLimit-RetryAfter: 60
  • X-RateLimit-Limit: Total requests allowed in current window
  • X-RateLimit-Remaining: Requests remaining in current window
  • X-RateLimit-Reset: Unix timestamp when limit resets
  • X-RateLimit-RetryAfter: Seconds to wait before next request (when rate limited)

Handling Rate Limits

When you exceed rate limits, the API returns HTTP 429 with retry information:

HTTP/1.1 429 Too Many Requests X-RateLimit-RetryAfter: 60 { "error": "Rate limit exceeded", "message": "Too many requests. Please try again in 60 seconds.", "code": 429 }

Best Practices:

  • • Monitor rate limit headers in responses
  • • Implement exponential backoff for retries
  • • Cache responses when appropriate
  • • Use bulk endpoints for multiple lookups
  • • Consider upgrading to higher tier for more capacity

Code Examples

cURL

# Get your own IP info
curl https://whatismyip.io/api/ipinfo

# Get specific IP info
curl https://whatismyip.io/api/ipinfo?ip=8.8.8.8

# With API key (for higher limits)
curl -H "X-API-Key: your_api_key" https://whatismyip.io/api/ipinfo

JavaScript

// Fetch API
const response = await fetch('https://whatismyip.io/api/ipinfo');
const data = await response.json();
console.log(data);

// With specific IP
const response = await fetch('https://whatismyip.io/api/ipinfo?ip=8.8.8.8');
const data = await response.json();
console.log(data.location.city);

Python

import requests

# Get IP info
response = requests.get('https://whatismyip.io/api/ipinfo')
data = response.json()
print(f"Your IP: {data['ip']}")
print(f"Location: {data['location']['city']}, {data['location']['country']}")

# With specific IP
response = requests.get('https://whatismyip.io/api/ipinfo?ip=8.8.8.8')
data = response.json()
print(data)

PHP

<?php
// Get IP info
$response = file_get_contents('https://whatismyip.io/api/ipinfo');
$data = json_decode($response, true);

echo "Your IP: " . $data['ip'] . "\n";
echo "Location: " . $data['location']['city'] . ", " . $data['location']['country'] . "\n";

// With cURL for more control
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://whatismyip.io/api/ipinfo?ip=8.8.8.8');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('X-API-Key: your_api_key'));
$result = curl_exec($ch);
curl_close($ch);
?>

Node.js

const axios = require('axios');

// Using axios
async function getIPInfo(ip = '') {
  try {
    const url = ip ? 
      `https://whatismyip.io/api/ipinfo?ip=${ip}` : 
      'https://whatismyip.io/api/ipinfo';
    
    const response = await axios.get(url, {
      headers: { 'X-API-Key': 'your_api_key' }
    });
    
    return response.data;
  } catch (error) {
    console.error('Error:', error.message);
  }
}

getIPInfo('8.8.8.8').then(data => console.log(data));

Go

package main

import (
    "encoding/json"
    "fmt"
    "io"
    "net/http"
)

func main() {
    resp, err := http.Get("https://whatismyip.io/api/ipinfo")
    if err != nil {
        panic(err)
    }
    defer resp.Body.Close()
    
    body, err := io.ReadAll(resp.Body)
    if err != nil {
        panic(err)
    }
    
    var data map[string]interface{}
    json.Unmarshal(body, &data)
    fmt.Printf("IP: %s\n", data["ip"])
}

Common Use Cases

Web Applications

Content Localization

Auto-detect user location for language/currency selection

Geographic Restrictions

Block or allow access based on country/region

Fraud Prevention

Detect suspicious locations and proxy usage

Analytics & Security

Visitor Analytics

Track geographic distribution of website visitors

Security Monitoring

Identify VPNs, proxies, and suspicious traffic

Log Analysis

Enrich server logs with geographic information

Simple, Transparent Pricing

Free

$0

per month

  • 1,000 requests/day
  • No API key required
  • Basic geolocation
  • Community support
Most Popular

Starter

$10

per month

  • 10,000 requests/month
  • Enhanced accuracy
  • VPN/Proxy detection
  • Email support

Pro

$50

per month

  • 100,000 requests/month
  • Bulk API access
  • Threat intelligence
  • Priority support

Frequently Asked Questions

Is the API really free?

Yes! We offer 1000 free requests per day without requiring an API key. For higher limits and additional features, paid plans are available starting at $10/month.

Do I need an API key?

Not required for the free tier (1000 requests/day). API keys are needed for higher rate limits, premium features, and commercial usage.

What data does the API return?

The API returns IP address, geolocation (country, region, city, coordinates), ISP details, timezone, VPN/proxy detection, threat analysis, and network information in JSON format.

Are there rate limits?

Free tier: 1000 requests/day. Starter plan: 10,000/month. Pro plan: 100,000/month. Enterprise: custom limits. Rate limits reset at midnight UTC.

Can I use it for commercial projects?

The free tier is for personal use and evaluation. Commercial usage requires a paid plan. Check our pricing page for details.

How accurate is the geolocation data?

Country-level: 99%+ accuracy. City-level: 75-85% accuracy for most regions. Accuracy varies by location and IP type. Rural and mobile IPs may be less precise.

Does the API support IPv6?

Yes, our API fully supports both IPv4 and IPv6 addresses. Simply pass the IPv6 address in the ip parameter.

Can I get bulk IP lookups?

Yes, enterprise plans support batch API endpoints for processing multiple IPs in a single request. Contact us for bulk pricing.

Ready to Get Started?

Start using our IP geolocation API today. No registration required for the free tier.