Prerequisites
- Node.js 18+ with
ip-api-ioinstalled - A free ip-api.io API key
Score an IP with riskScore
Returns a score (0–100) and a human risk_level, plus the factors that drove it. Omit the argument to score the caller's own IP.
import { IpApiClient } from "ip-api-io";
const client = new IpApiClient({ apiKey: process.env.IP_API_IO_KEY });
const risk = await client.riskScore("185.220.101.1");
console.log(risk.score); // 88
console.log(risk.risk_level); // "high"
console.log(risk.factors.ip_factors?.is_tor_node); // true
console.log(risk.factors.ip_factors?.is_datacenter); // true
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.
const risk = await client.emailRiskScore("user@mailinator.com");
console.log(risk.score, risk.risk_level); // 90 "high"
console.log(risk.factors.email_factors?.is_disposable); // true Pull raw signals with ipReputation
Returns the underlying reputation data for an IP as a plain object — use it when you want the source signals rather than a computed score.
const reputation = await client.ipReputation("185.220.101.1");
console.log(reputation);