ipbase.com provides a reliable & scalable IP geolocation API for software developers. It uses a database of IP addresses associated with cities and other relevant information like time zone, latitude, and longitude.
Try the demo and convince yourself of the data quality of the API. By default, it shows data of your own IP address.
We provide a great price-value ratio. Our free plan provides you with 150 free monthly requests to help you get started. 100% free - no strings attached.
We have optimized the API for speed and reliability. The API leverages a strong infrastructure and is served right from the edge.
The API supports JSON as the output format. Simply specify the desired format as part of the request url, and the response will be formatted accordingly.
{
"ip":, "0.0.0.0",
"country_code": "US",
"country_name": "United States",
"region_code": "0",
"region_name": "0",
"city": "Vienna",
"zip_code": "1010",
"time_zone": "Europe/Vienna",
"latitude": 48.1936,
"longitude": 16.3726,
"metro_code": 0
}
You can integrate our IP geolocation API into any application written in any programming language. The following code examples show how to use the IP lookup API with the most common programming languages:
// own IP address
curl "https://api.ipbase.com/v2/info?apikey=YOUR-APIKEY"
// specific IP address
curl "https://api.ipbase.com/v2/info?ip=8.8.8.8?apikey=YOUR-APIKEY"
// own IP address
$url = "https://api.ipbase.com/v2/info?apikey=YOUR-APIKEY";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($ch, CURLOPT_HEADER, FALSE);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
$response = curl_exec($ch);
curl_close($ch);
print_r($response);
// specific IP address
$url = "https://api.ipbase.com/v2/info?ip=8.8.8.8?apikey=YOUR-APIKEY";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($ch, CURLOPT_HEADER, FALSE);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
$response = curl_exec($ch);
curl_close($ch);
print_r($response);
// own IP address
const request = require('request-promise');
request('https://api.ipbase.com/v2/info?apikey=YOUR-APIKEY')
.then(response => {
console.log(response)
})
.catch(error => {
console.log(error)
})
// specific IP address
const request = require('request-promise');
request('https://api.ipbase.com/v2/info?ip=8.8.8.8?apikey='YOUR-APIKEY')
.then(response => {
console.log(response)
})
.catch(error => {
console.log(error)
})
// own IP address
try {
String apikey = 'YOUR-APIKEY';
String url = "https://api.ipbase.com/v2/info?apikey=" + apikey;
URL urlForGetRequest = new URL(url);
String readLine = null;
HttpURLConnection conection = (HttpURLConnection) urlForGetRequest.openConnection();
conection.setRequestMethod("GET");
int responseCode = conection.getResponseCode();
if (responseCode == HttpURLConnection.HTTP_OK) {
BufferedReader in = new BufferedReader(new InputStreamReader(conection.getInputStream()));
StringBuffer response = new StringBuffer();
while ((readLine = in.readLine()) != null) {
response.append(readLine);
}
in.close();
System.out.println(response.toString());
} else {
throw new Exception("Error in API Call");
}
} catch (Exception ex) {
ex.printStackTrace();
}
// specific IP address
try {
String apikey = "YOUR-APIKEY";
String url = "https://api.ipbase.com/v2/info?ip=8.8.8.8?apikey=" + apikey;
URL urlForGetRequest = new URL(url);
String readLine = null;
HttpURLConnection conection = (HttpURLConnection) urlForGetRequest.openConnection();
conection.setRequestMethod("GET");
int responseCode = conection.getResponseCode();
if (responseCode == HttpURLConnection.HTTP_OK) {
BufferedReader in = new BufferedReader(new InputStreamReader(conection.getInputStream()));
StringBuffer response = new StringBuffer();
while ((readLine = in.readLine()) != null) {
response.append(readLine);
}
in.close();
System.out.println(response.toString());
} else {
throw new Exception("Error in API Call");
}
} catch (Exception ex) {
ex.printStackTrace();
}
Query Parameter Name | Type | Required / Optional | Description |
---|---|---|---|
apikey
|
string | required | Authentication parameter |
ip
|
string | optional | Default: requesters IP |
language
|
string | optional | ie. 'de' |
ipbase.com is a JSON-based IP lookup REST API that enables developers to retrieve data about an IP Address.
Our IP geolocation API provides you with a generous request volume. Our free plan provides you with 150 free requests to help you get started!
ipbase.com offers real-time data for all your IP requests.