Java guide

Use FindIP with Java

Use Java's built-in HTTP client to retrieve location, network, and IP intelligence fields.

Endpoint

Authenticated IP lookup

GET https://api.findip.net/{ip}/?token={token}
HTTP clientPrefer java.net.http.HttpClient for modern Java apps.
Risk modelintelligence.flags exposes booleans for VPN, proxy, Tor, hosting, and malicious signals.

Java example

Uses org.json for concise JSON access.

import java.net.URI;
import java.net.URLEncoder;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.nio.charset.StandardCharsets;
import org.json.JSONObject;

public class FindIPExample {
    public static void main(String[] args) throws Exception {
        String ip = "8.8.8.8";
        String token = "YOUR_API_KEY";
        String url = "https://api.findip.net/" + ip + "/?token=" +
            URLEncoder.encode(token, StandardCharsets.UTF_8) + "&returnIp=true";

        HttpClient client = HttpClient.newHttpClient();
        HttpRequest request = HttpRequest.newBuilder()
            .uri(URI.create(url))
            .header("Accept", "application/json")
            .GET()
            .build();

        HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
        if (response.statusCode() < 200 || response.statusCode() >= 300) {
            throw new RuntimeException("FindIP request failed: " + response.statusCode());
        }

        JSONObject data = new JSONObject(response.body());
        JSONObject intelligence = data.getJSONObject("intelligence");

        System.out.println("City: " + data.getJSONObject("city").getJSONObject("names").optString("en"));
        System.out.println("Country: " + data.getJSONObject("country").getJSONObject("names").optString("en"));
        System.out.println("ISP: " + data.getJSONObject("traits").optString("isp"));
        System.out.println("ASN: " + data.getJSONObject("traits").optInt("autonomous_system_number"));
        System.out.println("Verdict: " + intelligence.getJSONObject("summary").getString("verdict"));
        System.out.println("Risk: " + intelligence.getJSONObject("risk").getInt("score") + " " +
            intelligence.getJSONObject("risk").getString("level"));
        System.out.println("VPN: " + intelligence.getJSONObject("flags").getBoolean("is_vpn"));
        System.out.println("Proxy: " + intelligence.getJSONObject("flags").getBoolean("is_proxy"));
        System.out.println("Tor: " + intelligence.getJSONObject("flags").getBoolean("is_tor"));
    }
}