If you need to look up IP address data — country, city, ISP, ASN, or timezone — you’ve probably noticed that most IP APIs require you to register, generate an API key, and manage rate limits. ipinfo.im is different: it’s completely free, requires no authentication, and is ready to use in seconds.
This guide walks you through everything you need to get started with the ipinfo.im API.
What is ipinfo.im?
ipinfo.im is a free IP intelligence API designed for developers. It accepts any IP address as input and returns structured JSON data including:
- IP address — the queried IP
- Country — ISO country code (e.g.,
US,DE,JP) - Region — state or province
- City — city name
- Organization/ISP — the internet service provider or hosting company
- ASN — Autonomous System Number
- Timezone — IANA timezone identifier (e.g.,
America/New_York) - Latitude/Longitude — approximate geographic coordinates
No credit card. No signup. No API key. Just HTTP.
Base URL
https://ipinfo.im/api/
Endpoint 1: Look Up Your Own IP
To look up the IP address of the current machine making the request, call the base endpoint with no parameters:
curl https://ipinfo.im/api/
Example response:
{
"ip": "203.0.113.45",
"country": "US",
"country_name": "United States",
"region": "California",
"city": "San Francisco",
"org": "AS7922 Comcast Cable Communications",
"timezone": "America/Los_Angeles",
"latitude": 37.7749,
"longitude": -122.4194
}
This is useful for detecting the user’s location in server-side applications, or for quick manual lookups while debugging.
Endpoint 2: Look Up a Specific IP Address
To query a specific IP address, append the ?ip= parameter:
curl "https://ipinfo.im/api/?ip=8.8.8.8"
Example response:
{
"ip": "8.8.8.8",
"country": "US",
"country_name": "United States",
"region": "California",
"city": "Mountain View",
"org": "AS15169 Google LLC",
"timezone": "America/Los_Angeles",
"latitude": 37.4056,
"longitude": -122.0775
}
This endpoint is the one you’ll use most often — pass any IPv4 or IPv6 address.
Understanding the JSON Response Fields
| Field | Type | Description |
|---|---|---|
ip | string | The queried IP address |
country | string | ISO 3166-1 alpha-2 country code |
country_name | string | Full country name in English |
region | string | State, province, or region name |
city | string | City name |
org | string | Organization/ISP name with ASN prefix |
timezone | string | IANA timezone identifier |
latitude | number | Approximate latitude |
longitude | number | Approximate longitude |
curl Examples for Common Use Cases
Look up your own IP:
curl https://ipinfo.im/api/
Look up a specific IP:
curl "https://ipinfo.im/api/?ip=1.1.1.1"
Pretty-print JSON output with jq:
curl -s "https://ipinfo.im/api/?ip=8.8.8.8" | jq .
Extract only the country field:
curl -s "https://ipinfo.im/api/?ip=8.8.8.8" | jq -r '.country'
# Output: US
Extract the ISP/org:
curl -s "https://ipinfo.im/api/?ip=8.8.8.8" | jq -r '.org'
# Output: AS15169 Google LLC
Use in a shell script:
#!/bin/bash
IP="8.8.8.8"
RESPONSE=$(curl -s "https://ipinfo.im/api/?ip=${IP}")
COUNTRY=$(echo "$RESPONSE" | jq -r '.country')
CITY=$(echo "$RESPONSE" | jq -r '.city')
echo "IP ${IP} is located in ${CITY}, ${COUNTRY}"
CORS Support
The ipinfo.im API is CORS-enabled, meaning you can call it directly from browser-side JavaScript without a proxy server:
const response = await fetch('https://ipinfo.im/api/?ip=8.8.8.8');
const data = await response.json();
console.log(data.country); // "US"
console.log(data.city); // "Mountain View"
Rate Limits
ipinfo.im is designed to be generous and accessible. For high-volume production use cases, be respectful of the service — add reasonable delays between batch requests and cache results where possible. Caching IP lookups for 24 hours is a good practice since geolocation data changes infrequently.
What to Build With It
Here are some common use cases for the ipinfo.im API:
- Content localization — Show prices in local currency, or display region-specific content
- Fraud detection — Flag logins from unexpected countries or known VPN/proxy ASNs
- Analytics enrichment — Add country and region data to your event logs
- Access control — Allow or block traffic based on country code
- Developer tools — Build IP lookup widgets, dashboards, or CLI tools
Next Steps
Now that you understand the basics:
- Python users: See our Python IP Geolocation Guide
- Node.js users: See our Node.js IP Lookup Guide
- Power users: Check the curl Cheatsheet for 10 essential commands
Ready to integrate? Head over to ipinfo.im and try the live API demo — no setup required.