Python SDK · Feature

Fraud Detection & Risk Scoring in Python

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 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 line — and still drill into the contributing factors when you need to explain a decision.

Prerequisites

1

Score an IP with risk_score

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 os
from ipapi_io import IpApiClient

client = IpApiClient(api_key=os.environ["IP_API_IO_KEY"])

risk = client.risk_score("185.220.101.1")

print(risk["score"])                                    # 88
print(risk["risk_level"])                               # "high"
print(risk["factors"]["ip_factors"]["is_tor_node"])     # True
print(risk["factors"]["ip_factors"]["is_datacenter"])   # True

if risk["score"] >= 75:
    pass  # 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.

risk = client.email_risk_score("user@mailinator.com")

print(risk["score"], risk["risk_level"])                  # 90 "high"
print(risk["factors"]["email_factors"]["is_disposable"])  # True
3

Raw signals with ip_reputation

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

reputation = client.ip_reputation("185.220.101.1")
print(reputation)
Reference

Response reference

RiskScore (from risk_score / email_risk_score)

FieldTypeDescription
scoreintRisk score, 0 (safe) – 100 (high risk)
risk_levelstrBucketed level, e.g. "low", "medium", "high"
ipstr | NoneScored IP (when applicable)
emailstr | NoneScored email (when applicable)
factorsdictip_factors and/or email_factors

ip_factors: is_proxy, is_vpn, is_tor_node, is_spam, is_datacenter, risk_contribution. email_factors: is_disposable, is_valid_syntax, risk_contribution.

FAQ

Frequently asked questions

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

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

Can I score an email address too?

Yes. client.email_risk_score(email) 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 and ip_reputation?

risk_score 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 plain dict — 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. score >= 75). Tune the cutoffs to your own fraud tolerance and false-positive budget.

Start building with the ip-api.io Python SDK

Install ip-api-io, drop in your free API key, and ship in minutes — one zero-dependency 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 package is open source. Open an issue or pull request on GitHub and we'll take a look.

Open on GitHub