Rust SDK · Feature

Fraud Detection & Risk Scoring in Rust

Collapse every signal — geolocation, proxy/VPN/Tor flags, datacenter hosting, disposable email, syntax — into a single 0–100 risk score you can act on at sign-up, checkout, or login. Or pull the raw ip_reputation record when you want to build your own rules.

Trusted by thousands of businesses
Fast JSON API responses
Real-time validation
Simple integration, SDKs & examples
What it does

One score from every signal

Individual flags are powerful, but acting on each one is fiddly. risk_score_ip weighs geolocation, anonymizer flags, datacenter hosting, and email quality into a single number with a bucketed level, so you can make a block / review / allow decision in one comparison — and still drill into the contributing factors when you need to explain a decision.

Prerequisites

1

Score an IP with risk_score_ip

Returns a score (0–100) and a human risk_level, plus the factors that drove it. Use risk_score() for the caller's IP.

let client = Client::new(std::env::var("IP_API_IO_KEY")?);

let risk = client.risk_score_ip("185.220.101.1").await?;

println!("{}", risk.score);      // 88.0
println!("{}", risk.risk_level); // "high"
if let Some(ip) = &risk.factors.ip {
    println!("{} {}", ip.is_tor_node, ip.is_datacenter);
}

if risk.score >= 75.0 {
    // block, or send to manual review / step-up auth
}
2

Score an email with email_risk_score

Same 0–100 scale, driven by email signals (disposable provider, invalid syntax). Use it to grade leads or gate sign-ups by address quality.

let risk = client.email_risk_score("user@mailinator.com").await?;

println!("{} {}", risk.score, risk.risk_level); // 90.0 high
if let Some(email) = &risk.factors.email {
    println!("{}", email.is_disposable); // true
}
3

Raw signals with ip_reputation

Returns the underlying reputation data for an IP as a serde_json::Value — use it when you want the source signals rather than a computed score.

let reputation = client.ip_reputation("185.220.101.1").await?;
println!("{reputation:#?}");
Reference

Response reference

RiskScore (from risk_score_ip / email_risk_score)

FieldTypeDescription
scoref64Risk score, 0 (safe) – 100 (high risk)
risk_levelStringBucketed level, e.g. "low", "medium", "high"
ipOption<String>Scored IP (when applicable)
emailOption<String>Scored email (when applicable)
factorsRiskScoreFactorsip and/or email (Option)

factors.ip: is_proxy, is_vpn, is_tor_node, is_spam, is_datacenter, risk_contribution. factors.email: is_disposable, is_valid_syntax, risk_contribution.

FAQ

Frequently asked questions

How do I score an IP for fraud risk in Rust?

Call client.risk_score_ip(ip).await?. It returns a score from 0 (safe) to 100 (high risk), a human risk_level, and the factors that drove it. Use risk_score() to score the caller's own IP.

Can I score an email address too?

Yes. client.email_risk_score(email).await? returns the same 0–100 scale driven by email signals such as disposable provider and invalid syntax — use it to grade leads or gate sign-ups by address quality.

What's the difference between risk_score_ip and ip_reputation?

risk_score_ip gives you a computed 0–100 score and bucketed level you can act on directly. ip_reputation(ip) returns the underlying reputation record as a serde_json::Value — use it when you want the source signals to build your own rules.

What threshold should I block at?

A common pattern is to allow low scores, send medium scores to step-up verification, and block or manually review high scores (e.g. risk.score >= 75.0). Tune the cutoffs to your own fraud tolerance and false-positive budget.

Start building with the ip-api.io Rust SDK

Run cargo add ip-api-io, drop in your free API key, and ship in minutes — one async client for geolocation, fraud detection, and email validation.

Need support?

Explore how IP-API.io can enhance your security, provide robust bot protection, and improve IP geolocation accuracy for your applications.

Contact Support

Found a bug in the SDK?

The ip-api-io crate is open source. Open an issue or pull request on GitHub and we'll take a look.

Open on GitHub