Quick Start
ipdata provides a simple HTTP-based API that allows you to look up the location, ownership and threat profile of any IP address.
View your API key in the examples
Click "Log In" at the top right corner to enable showing your API key in the code examples.
The simplest call you can make would be a parameter-less GET call to the API endpoint at https://api.ipdata.co. This will return the location of the device making the API request.
curl "https://api.ipdata.co?api-key=<<apiKey>>"
https api.ipdata.co api-key==<<apiKey>>
ipdata
To lookup a specific IP Address, pass the IP address as a path parameter.
curl "https://api.ipdata.co/8.8.8.8?api-key=<<apiKey>>"
https api.ipdata.co/8.8.8.8 api-key==<<apiKey>>
ipdata 8.8.8.8
We also offer a dedicated EU endpoint https://eu-api.ipdata.co to ensure that the end user data you send us stays in the EU. This has the same functionality as our standard endpoint but routes the request through our EU servers (Paris, Ireland and Frankfurt) only.
curl "https://eu-api.ipdata.co?api-key=<<apiKey>>"
https eu-api.ipdata.co api-key==<<apiKey>>
import ipdata
ipdata.api_key = "<YOUR API KEY>"
ipdata.endpoint = "https://eu-api.ipdata.co"
response = ipdata.lookup('69.78.70.144')
print(response)
More Examples
var request = new XMLHttpRequest();
request.open('GET', 'https://api.ipdata.co/?api-key=<<apiKey>>');
request.setRequestHeader('Accept', 'application/json');
request.onreadystatechange = function () {
if (this.readyState === 4) {
console.log(this.responseText);
}
};
request.send();
import ipdata
ipdata.api_key = "<<apiKey>>"
response = ipdata.lookup('69.78.70.144')
print(response)
import IPData from 'ipdata';
const ipdata = new IPData('<<apiKey>>');
const ip = '1.1.1.1';
ipdata.lookup(ip)
.then(function(data) {
console.log(data)
});
use Ipdata\ApiClient\Ipdata;
use Symfony\Component\HttpClient\Psr18Client;
use Nyholm\Psr7\Factory\Psr17Factory;
$httpClient = new Psr18Client();
$psr17Factory = new Psr17Factory();
$ipdata = new Ipdata('<<apiKey>>', $httpClient, $psr17Factory);
$data = $ipdata->lookup('69.78.70.144');
echo json_encode($data, JSON_PRETTY_PRINT);
require 'uri'
require 'net/http'
url = URI("https://api.ipdata.co/?api-key=<<apiKey>>")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
package main
import (
"github.com/ipdata/go"
"log"
"fmt"
)
func main() {
ipd, _ := ipdata.NewClient("<<apiKey>>")
data, err := ipd.Lookup("8.8.8.8")
if err != nil {
log.Fatalf("%v", err)
}
fmt.Printf("%s (%s)\n", data.IP, data.ASN)
}
var client = new IpDataClient("<<apiKey>>");
// Get IP data from IP
var ipInfo = await client.Lookup("8.8.8.8");
Console.WriteLine($"Country name for {ipInfo.Ip} is {ipInfo.CountryName}");
import io.ipdata.client.Ipdata;
URL url = new URL("https://api.ipdata.co");
IpdataService ipdataService = Ipdata.builder().url(url)
.key("<<apiKey>>").get();
IpdataModel model = ipdataService.ipdata("1.1.1.1");
System.out.println(jsonSerialize(model));
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "https://api.ipdata.co/?api-key=<<apiKey>>")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
use std::error::Error;
fn main() -> Result<(), Box<dyn Error>> {
let resp = reqwest::blocking::get("https://api.ipdata.co/ip?api-key=<<apiKey>>")?.text()?;
println!("{:#?}", resp);
Ok(())
}
// Import the required library
import fetch from 'node-fetch';
const getIPData = async () => {
// The URL of the API
const url = 'https://api.ipdata.co?api-key=<<apiKey>>';
try {
// Make the GET request
const response = await fetch(url);
// Check if the request was successful
if (!response.ok) {
throw new Error('HTTP error ' + response.status);
}
// Parse the JSON from the response
const data = await response.json();
// Log the data
console.log(data);
} catch (error) {
// Log any errors
console.log(error);
}
};
getIPData();
Updated 4 months ago