By SanctionsAI team · Updated 2026-08-09

Check OFAC sanctions in Python

Screen any crypto wallet against the OFAC SDN list using Python and the SanctionsAI API.

Quick start

import requests

def check_sanctions(wallet):
    resp = requests.get(
        "https://sanctionsai.dev/sanctions",
        params={"wallet": wallet}, timeout=5
    )
    data = resp.json()
    return data.get("blocked", False), data.get("matches", [])

blocked, matches = check_sanctions("0x098B716B8Aaf21512996dC57EB0615e2383E2f96")
print(f"Blocked: {blocked}, Matches: {matches}")

With error handling and retry

import requests, time, logging

def check_safe(wallet, retries=3):
    for attempt in range(retries):
        try:
            resp = requests.get("https://sanctionsai.dev/sanctions",
                params={"wallet": wallet}, timeout=5)
            resp.raise_for_status()
            return resp.json()
        except requests.RequestException:
            if attempt < retries - 1:
                time.sleep(2 ** attempt)
    raise Exception("Screening failed")
Tip: Always log the screening result with a timestamp for your audit trail.

Screen your agent's next payment

Check any wallet, name, or entity against OFAC, EU, UN sanctions lists in real time.

Free wallet checker

Frequently Asked Questions

Is the SanctionsAI API free?
Yes. Free tier: 5 checks/day by IP, no API key. Dev: $19/mo for 10,000 checks. Team: $99/mo for 100,000.
How fast is the API?
Sub-200ms for wallet and name checks. Suitable for real-time payment flows.
Can I use this in production?
Yes. Production-grade with 99.9% uptime. Use Dev or Team plan for production volume.
What happens if the API is down?
Fail safe: block the transaction and log the error. Never proceed without a clean screening result.

← Back to examples · SanctionsAI