Prerequisites
- Python 3.8+ with
ip-api-ioinstalled - A free ip-api.io API key
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 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 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)