Get Intelligence on an IP Address with Java

It’s never a bad idea to boost your application’s threat profile, and you can easily do so by incorporating our IP Intelligence API. It can keep you ahead of the curve on suspicious IPs, providing key info including whether a given IP is a known threat, known bot, or Tor exit node. Additionally, it lets you know where that IP address is located geographically, including details about the country code, region code, zip code, and much more.

Take advantage of this API in just a few steps by following the instructions included below for Java.

To start, let’s install the Maven SDK by first adding a reference to the repository in pom.xml:


And then adding one to the dependency:


Once that’s done, it’s time to add the import classes and call the IP validation function. You’ll need a Cloudmersive API key for this step, which you can obtain easily by registering a free account on our website (Home — Cloudmersive APIs).

// Import classes:
//import com.cloudmersive.client.invoker.ApiClient;
//import com.cloudmersive.client.invoker.ApiException;
//import com.cloudmersive.client.invoker.Configuration;
//import com.cloudmersive.client.invoker.auth.*;
//import com.cloudmersive.client.IpAddressApi;
ApiClient defaultClient = Configuration.getDefaultApiClient();// Configure API key authorization: Apikey
ApiKeyAuth Apikey = (ApiKeyAuth) defaultClient.getAuthentication("Apikey");
Apikey.setApiKey("YOUR API KEY");
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
IpAddressApi apiInstance = new IpAddressApi();
String value = "value_example"; // String | IP address to process, e.g. \"\". The input is a string so be sure to enclose it in double-quotes.
try {
IPIntelligenceResponse result = apiInstance.iPAddressIpIntelligence(value);
} catch (ApiException e) {
System.err.println("Exception when calling IpAddressApi#iPAddressIpIntelligence");

That’s it — you’re all done, simple as can be.



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store