Prerequisites
- A Java 17+ project with
io.ip-api:ipapiadded - A free ip-api.io API key
Score an IP with riskScore
Returns a score() (0–100) and a human riskLevel(), plus the
factors() that drove it. Use riskScore() for the caller's IP.
IpApiClient client = IpApiClient.builder()
.apiKey(System.getenv("IP_API_IO_KEY"))
.build();
RiskScore risk = client.riskScore("185.220.101.1");
System.out.println(risk.score()); // 88.0
System.out.println(risk.riskLevel()); // "high"
if (risk.factors().ip() != null) {
var ip = risk.factors().ip();
System.out.println(ip.isTorNode() + " " + ip.isDatacenter());
}
if (risk.score() >= 75) {
// block, or send to manual review / step-up auth
} Score an email with emailRiskScore
Same 0–100 scale, driven by email signals (disposable provider, invalid syntax). Use it to grade leads or gate sign-ups by address quality.
RiskScore risk = client.emailRiskScore("user@mailinator.com");
System.out.println(risk.score() + " " + risk.riskLevel()); // 90.0 high
if (risk.factors().email() != null) {
System.out.println(risk.factors().email().isDisposable()); // true
} Raw signals with ipReputation
Returns the underlying reputation data for an IP — use it when you want the source signals rather than a computed score.
var reputation = client.ipReputation("185.220.101.1");
System.out.println(reputation);