IP Geolocation API

Get accurate IP address geolocation data with country, city, timezone, currency, and ISP information. Support for both IPv4 and IPv6 addresses.

Example response (trimmed)ipbase.com
{
  "data": {
    "ip": "1.1.1.1",
    "hostname": "one.one.one.one",
    "type": "v4",
    "connection": {
      "asn": 13335,
      "organization": "Cloudflare, Inc.",
      "isp": "APNIC Research and Development"
    },
    "location": {
      "country": { "alpha2": "US", "name": "United States" },
      "region": { "alpha2": "US-CA", "name": "California" },
      "city": { "name": "Los Angeles" },
      "latitude": 34.0536,
      "longitude": -118.2455
    },
    "timezone": { "id": "America/Los_Angeles", "code": "PDT" },
    "security": { "is_vpn": false, "is_tor": false, "threat_score": 0 }
  }
}
Use cases

Use Cases

Real-world applications of IP geolocation data

01

Content Localization

Automatically display content in the user's language and currency based on their location. Improve user experience with localized pricing and regional content.

02

Fraud Prevention

Detect suspicious login attempts and transactions from unusual locations. Implement geo-blocking and access controls to protect your platform.

03

Analytics & Reporting

Understand your audience demographics with geographic analytics. Track visitor locations and generate detailed regional reports.

04

Targeted Advertising

Deliver location-specific ads and promotions. Increase conversion rates with geographically relevant marketing campaigns.

05

Compliance & Restrictions

Enforce geographic restrictions and comply with regional regulations like GDPR. Implement geo-fencing for content distribution.

06

Timezone Detection

Automatically detect user timezones for scheduling and time-based features. Display times in the user's local timezone.

Code

API Examples

Simple integration with your favorite programming language

cURLShell
curl "https://api.ipbase.com/v2/info?ip=1.1.1.1" \
  -H "apikey: YOUR_API_KEY"
JavaScriptNode.js
const response = await fetch(
  'https://api.ipbase.com/v2/info?ip=1.1.1.1',
  { headers: { apikey: 'YOUR_API_KEY' } }
);
const { data } = await response.json();
console.log(data.location.country.name);
Pythonv3+
import requests

response = requests.get(
    'https://api.ipbase.com/v2/info',
    params={'ip': '1.1.1.1'},
    headers={'apikey': 'YOUR_API_KEY'}
)
data = response.json()
print(data['data']['location']['country']['name'])
PHP7.4+
$response = file_get_contents(
    'https://api.ipbase.com/v2/info?apikey=YOUR_API_KEY&ip=1.1.1.1'
);
$data = json_decode($response, true);
echo $data['data']['location']['country']['name'];
Integrations

Available Integrations

Use IPBase with your favorite tools and platforms

API Marketplaces

Automation & Integration Platforms

Zapier Coming soon Make Coming soon n8n Coming soon Pipedream Coming soon

MCP server for AI agents

https://api.ipbase.com/mcpStreamable HTTP ยท API key in the apikey headerSetup guide

Ready to Get Started?

Start your free trial today. No credit card required.

Start For Free