Screen a customer against OFAC, UN and EU sanctions lists in 10 lines of Python
If you onboard customers, pay suppliers or run a marketplace, you probably need to check names against sanctions lists. Doing it by hand means downloading the OFAC SDN list, the UN Security Council list and the EU consol
If you onboard customers, pay suppliers or run a marketplace, you probably need to check names against sanctions lists. Doing it by hand means downloading the OFAC SDN list, the UN Security Council list and the EU consolidated list, parsing three formats and writing your own fuzzy matching.
Here is a shorter way: one HTTP call that checks all three lists and returns a 0-100 match score.
The call
import os, requests
HOST = "sanctions-screening-api4.p.rapidapi.com"
headers = {"x-rapidapi-host": HOST, "x-rapidapi-key": os.environ["RAPIDAPI_KEY"]}
r = requests.get(f"https://{HOST}/search",
headers=headers, params={"name": "Vladimir Putin", "limit": 3}, timeout=30)
for m in r.json()["matches"]:
print(m["name"], m["matchScore"], m["matchType"], m["source"])
Running it against the live API prints something like Vladimir Vladimirovich PUTIN 100 exact OFAC SDN (US Treasury), plus the matching EU list entry. A name with no match, like "Jane Smith", returns no hits.
Screen a list in one request
requests.post(f"https://{HOST}/batch", headers=headers,
json={"names": ["Vladimir Putin", "Jane Smith"], "limit": 3}, timeout=30)
Batch takes up to 20 names per request.
Things worth knowing
- Matching is fuzzy and alias-aware, so spelling variants still score high.
- Each response includes the last update date of each list and the official source.
- A match is a lead for a human to review, not a legal decision.
Try it
- Free plan (100 requests a month): https://rapidapi.com/ahmedsaidmorsy206/api/sanctions-screening-api4
- Runnable Python and JavaScript examples plus a Postman collection: https://github.com/kyb-api-toolkit/sanctions-screening-api-examples
Put your key in the RAPIDAPI_KEY environment variable and run python example.py.
Originally published by Dev.to Security. Aggregated on AIWithGhost for educational purposes β full credit and traffic to the original publisher.