All Integrations

Fidro + Django Integration

Fraud prevention for Django applications. Follow this guide to add email validation and IP intelligence in minutes.

Overview

To integrate Fidro with Django, use the requests library to send a POST request to the Fidro API with the user's email and IP address. Fidro returns email validation, disposable domain detection, IP geolocation, VPN detection, and a fraud risk score in a single JSON response. You can add Fidro as a Django view, middleware, or utility function — no proprietary SDK or Django package is required.

Fidro is a fraud detection API that combines email validation, IP intelligence, geolocation analysis, and Stripe chargeback prevention in a single API call. It returns a risk score with a clear recommendation — allow, review, or block — so you can stop fraud without building your own scoring logic.

1. Install Dependencies

pip install requests

You will also need a Fidro API key. Sign up for free to get one.

2. Email Validation

Send a POST request to Fidro's /v1/validate endpoint with the user's email address and optional IP. Fidro validates the email, checks for disposable domains, analyzes the IP for VPN/proxy/Tor usage, and returns a risk score with a clear recommendation — allow, review, or block.

# fidro/client.py
import os
import requests

FIDRO_API_KEY = os.environ["FIDRO_API_KEY"]

def validate_email(email: str, ip: str) -> dict:
    response = requests.post(
        "https://api.fidro.io/v1/validate",
        headers={
            "Authorization": f"Bearer {FIDRO_API_KEY}",
            "Content-Type": "application/json",
        },
        json={"email": email, "ip": ip},
    )
    response.raise_for_status()
    return response.json()

# ----- Django view example -----
# views.py
from django.http import JsonResponse
from django.views.decorators.http import require_POST
from fidro.client import validate_email

@require_POST
def signup_view(request):
    import json
    body = json.loads(request.body)
    email = body.get("email")
    ip = request.META.get("HTTP_X_FORWARDED_FOR", request.META.get("REMOTE_ADDR"))

    result = validate_email(email, ip)
    data = result["data"]

    if data["recommendation"] == "refund":
        return JsonResponse({"error": "Signup blocked due to fraud risk"}, status=403)

    # Continue with signup logic...
    return JsonResponse({"risk_score": data["risk_score"]})

# ----- Django middleware example -----
# middleware.py
from fidro.client import validate_email

class FidroFraudMiddleware:
    def __init__(self, get_response):
        self.get_response = get_response

    def __call__(self, request):
        response = self.get_response(request)
        return response

    def process_view(self, request, view_func, view_args, view_kwargs):
        if request.method == "POST" and hasattr(request, "body"):
            import json
            try:
                body = json.loads(request.body)
                email = body.get("email")
                if email:
                    ip = request.META.get("HTTP_X_FORWARDED_FOR", request.META.get("REMOTE_ADDR"))
                    result = validate_email(email, ip)
                    request.fidro_result = result["data"]
            except (json.JSONDecodeError, Exception):
                pass
        return None

3. IP Lookup

Send a POST request to Fidro's /v1/ip-lookup endpoint with an IP address. Fidro returns geolocation data (country, city, ISP), VPN and proxy detection, Tor exit node identification, and threat intelligence — all in a single API call.

# fidro/client.py
import os
import requests

FIDRO_API_KEY = os.environ["FIDRO_API_KEY"]

def lookup_ip(ip: str) -> dict:
    response = requests.post(
        "https://api.fidro.io/v1/ip-lookup",
        headers={
            "Authorization": f"Bearer {FIDRO_API_KEY}",
            "Content-Type": "application/json",
        },
        json={"ip": ip},
    )
    response.raise_for_status()
    return response.json()

# ----- Django view example -----
# views.py
from django.http import JsonResponse
from fidro.client import lookup_ip

def check_ip_view(request):
    ip = request.META.get("HTTP_X_FORWARDED_FOR", request.META.get("REMOTE_ADDR"))
    result = lookup_ip(ip)
    data = result["data"]

    return JsonResponse({
        "country": data["country"],
        "is_vpn": data["is_vpn"],
    })

Next steps

Explore the full API reference, try the free email checker, or see how Fidro compares to other solutions.

Frequently Asked Questions

How do I add fraud detection to Django?
You can add fraud detection to Django by calling Fidro's REST API with a POST request containing the user's email and IP address. Fidro returns a risk score and a clear recommendation — allow, review, or block. The entire integration takes about 5 minutes, and you can add it as a view, middleware, or reusable utility function.
Does Fidro have a Django SDK?
Fidro doesn't require an SDK or a Django-specific package. It's a standard REST API that works with Python's requests library or httpx. Just send a POST request from your Django view or middleware and parse the JSON response.
Is Fidro free to use with Django?
Yes, Fidro offers a free plan with 1,000 validations per month, no credit card required. It works with any Django application and can be integrated as a view, middleware, or custom management command.

Start catching bad signups in the next 5 minutes

Create your account, grab your API key, and send your first request. Free plan with 200 validations/month. No credit card. Cancel anytime.

Get Started Free