Prerequisites
- A .NET 6+ project with
IpApiIoadded - A free ip-api.io API key
Score an IP with RiskScoreAsync
Returns a Score (0–100) and a human RiskLevel, plus the
Factors that drove it. Use RiskScoreAsync() for the caller's IP.
var client = new IpApiClient(Environment.GetEnvironmentVariable("IP_API_IO_KEY")!);
var risk = await client.RiskScoreAsync("185.220.101.1");
Console.WriteLine(risk.Score); // 88
Console.WriteLine(risk.RiskLevel); // "high"
if (risk.Factors.Ip is { } ip)
Console.WriteLine($"{ip.IsTorNode} {ip.IsDatacenter}");
if (risk.Score >= 75)
{
// block, or send to manual review / step-up auth
} Score an email with EmailRiskScoreAsync
Same 0–100 scale, driven by email signals (disposable provider, invalid syntax). Use it to grade leads or gate sign-ups by address quality.
var risk = await client.EmailRiskScoreAsync("user@mailinator.com");
Console.WriteLine($"{risk.Score} {risk.RiskLevel}"); // 90 high
if (risk.Factors.Email is { } email)
Console.WriteLine(email.IsDisposable); // True Raw signals with IpReputationAsync
Returns the underlying reputation data for an IP — use it when you want the source signals rather than a computed score.
var reputation = await client.IpReputationAsync("185.220.101.1");
Console.WriteLine(reputation);