ip-api-io 1.0.0

Official Rust client for ip-api.io — IP geolocation, email validation, fraud detection and risk scoring API
Documentation

ip-api-io — Official Rust client for ip-api.io

crates.io docs.rs test License: MIT

The official Rust client for the ip-api.io IP intelligence platform. One client covers IP geolocation, email validation and verification (syntax, MX, SMTP deliverability), fraud detection and risk scoring, VPN/proxy/Tor detection, disposable email detection, ASN lookup, WHOIS, reverse DNS, MX records and domain age.

Async by default (reqwest + rustls), fully typed responses, optional blocking feature.

Install

cargo add ip-api-io

Quickstart

use ip_api_io::Client;

#[tokio::main]
async fn main() -> Result<(), ip_api_io::Error> {
    let client = Client::with_api_key("YOUR_API_KEY"); // free key at https://ip-api.io

    let info = client.lookup_ip("8.8.8.8").await?;
    println!("{:?}", info.location.country);          // Some("United States")
    println!("{}", info.suspicious_factors.is_vpn);   // false

    let risk = client.risk_score_ip("8.8.8.8").await?;
    println!("{} {}", risk.score, risk.risk_level);   // 0 low

    Ok(())
}

Synchronous usage with the blocking feature (cargo add ip-api-io --features blocking):

let client = ip_api_io::blocking::Client::with_api_key("YOUR_API_KEY");
let info = client.lookup_ip("8.8.8.8")?;

An API key is required — the API rejects keyless requests with 401. Sign up at ip-api.io for a free key.

Documentation

Each guide documents the methods for one capability, with runnable examples and a link to the matching ip-api.io product page:

Methods

Every method maps to one ip-api.io endpoint and its product page:

Method Endpoint Product page
lookup() / lookup_ip(ip) GET /api/v1/ip[/{ip}] IP geolocation
lookup_batch(ips) POST /api/v1/ip/batch (≤100 IPs) Bulk IP lookup
email_info(email) GET /api/v1/email/{email} Email validation
validate_email(email) GET /api/v1/email/advanced/{email} Advanced email validation
validate_email_batch(emails) POST /api/v1/email/advanced/batch (≤100) Email list cleaning
risk_score() / risk_score_ip(ip) GET /api/v1/risk-score[/{ip}] Risk score
email_risk_score(email) GET /api/v1/risk-score/email/{email} Fraud detection
ip_reputation(ip) GET /api/v1/ip-reputation/{ip} IP reputation
tor_check(ip) GET /api/v1/tor/{ip} Tor detection
asn(ip) GET /api/v1/asn/{ip} ASN lookup
whois(domain) GET /api/v1/dns/whois/{domain} WHOIS lookup
reverse_dns(ip) GET /api/v1/dns/reverse/{ip} Reverse DNS
forward_dns(hostname) GET /api/v1/dns/forward/{hostname}
mx_records(domain) GET /api/v1/dns/mx/{domain} MX record lookup
domain_age(domain) GET /api/v1/domain/age/{domain} Domain age checker
domain_age_batch(domains) POST /api/v1/domain/age/batch Domain age checker
rate_limit() GET /api/v1/ratelimit
usage_summary() GET /api/v1/usage/summary

Every method has the same signature on blocking::Client, minus .await.

Error handling

The client returns a typed Error enum and never retriesError::RateLimit's reset field tells you when your quota renews:

match client.lookup_ip("8.8.8.8").await {
    Ok(info) => println!("{info:?}"),
    Err(ip_api_io::Error::RateLimit { limit, remaining, reset, .. }) => {
        println!("limit={limit:?} remaining={remaining:?} resets_at={reset:?}");
    }
    Err(ip_api_io::Error::Authentication { .. }) => println!("invalid API key"),
    Err(other) => println!("{other}"),
}

See docs/error-handling.md for the full Error taxonomy.

Links


ip-api-io is the official client for ip-api.io. It is not affiliated with ip-api.com or ipapi.com.