Skip to main content

ofacmatch (Python)

Python client for the self-hosted OfacMatch REST API: explainable OFAC SDN name screening that runs on your own server, so the names you screen never leave your network. Free and open source (Apache-2.0), with no dependencies outside the Python standard library.

Potential matches only. A score measures how alike two names are written, not whether they are the same party. A person must review every potential match. It checks the OFAC SDN list only. Not legal advice.

1. Start the API (once)

docker run -p 8080:8080 ghcr.io/krunalsolanki/ofacmatch-api

It downloads the SDN list from OFAC at start-up and refreshes it daily.

2. Install the client

pip install ofacmatch

Or straight from GitHub:

pip install "git+https://github.com/krunalsolanki/ofac-match#subdirectory=clients/python"

Screen from Python

from ofacmatch import Client

client = Client("http://localhost:8080")          # api_key="..." if the server requires one

result = client.screen("Aymen Zawahri", year_of_birth=1951)
for match in result["matches"]:
    print(match["score"], match["listedName"], match["explanation"])

Add email=, phone=, website= or crypto_address= when you have them. OFAC lists these for many entries, and they often stay the same when a party changes its name, so an entry they match is returned first even when the name doesn't match:

result = client.screen("Brand New Precision LLC", email="sales@yolimachine.com")
match = result["matches"][0]
print(match["matchedBy"])                                # identifier
print(match["identifierMatches"][0]["description"])     # Email ... has the same domain as listed Website www.yolimachine.com

A whole customer list

customers = [
    {"reference": "CUST-1001", "name": "Aymen Zawahri", "year_of_birth": 1951},
    {"reference": "CUST-1002", "name": "Emily Carter", "year_of_birth": 1985, "country": "United States"},
    {"reference": "VEND-77", "name": "New Supplier Ltd", "email": "orders@newsupplier.example"},
    # ... any number: sent 1,000 at a time
]

result = client.screen_batch(customers, min_score=85)
print(result["summary"])   # {'screened': 2, 'review': 1, 'likelyDifferentPerson': 0, 'noMatch': 1, 'errors': 0}

for row in result["results"]:
    if row["status"] in ("review", "likely_different_person"):
        best = row["matches"][0]
        print(row["reference"], best["score"], best["listedName"])

Each result keeps your reference and has a status:

  • review: a potential match; a person must review it
  • likely_different_person: every match has a birth year that differs from the one you gave, and none matched by an identifier; still check it
  • no_match: nothing at or above the minimum score
  • error: that item was invalid (row["error"] says why); the rest are still screened

With pandas: client.screen_batch(df.rename(columns={"id": "reference"}).to_dict("records")).

Other calls

client.compare("Jon Doe", "DOE, John")   # how two names score, part by part
client.entry(2676)                       # the full SDN record behind a match
client.list_info()                       # which copy of the list the server uses
client.health()                          # ready once the list is loaded

Errors raise ofacmatch.OfacMatchError with .status (HTTP status, or None if the server can't be reached) and .errors (per-field messages for invalid input).

Command line

Screen a CSV (for example an Excel sheet saved as CSV) and get a results CSV with the best match, the explanation, and empty columns for the reviewer's decision:

ofacmatch csv customers.csv results.csv
ofacmatch screen "Aymen Zawahri" --yob 1951

The input needs a header row with a Name column (or First name and Last name). Optional: ID or Reference, Year of birth or Date of birth, Country, Type, Email, Phone, Website, Crypto address. The results file has matched_by and identifier_match columns. ofacmatch screen takes --email, --phone, --website and --crypto. Use --url and --api-key (or OFACMATCH_URL and OFACMATCH_API_KEY) for a server other than http://localhost:8080.

Metadata

Release files for ofacmatch 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ofacmatch 0.2.0
File Size Uploaded Provenance Actions
ofacmatch-0.2.0.tar.gz 13.9 kB With provenance Details for ofacmatch-0.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for ofacmatch 0.2.0
File Interpreter ABI Platform Actions
ofacmatch-0.2.0-py3-none-any.whl Python 3 none any Details for ofacmatch-0.2.0-py3-none-any.whl

Total release size: 24.7 kB

Release files / ofacmatch-0.2.0.tar.gz

Download URL ofacmatch-0.2.0.tar.gz
Size 13.9 kB
Tags Source
SHA-256 checksum
How to use checksums
8caae9648f39e0d0589d5a34e5b267978b7988f5ae2b324114b5825b3b524b8d
BLAKE2b-256 checksum
How to use checksums
c71212ed1bcf178aeb3eb266917fdd46ce74f8af3b69e0e440ec2e1087f5a6bc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 24, 2026.

Transparency log

Release files / ofacmatch-0.2.0-py3-none-any.whl

Download URL ofacmatch-0.2.0-py3-none-any.whl
Size 10.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5cbbe400b3ad65d70a703279cb1f3360b6d7446ab82ec9a8efeb016d17315946
BLAKE2b-256 checksum
How to use checksums
f7e67315f2098d98f497cb9cfb54441caf4b820b27b435f78988d9d18a414674
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 24, 2026.

Transparency log

Security for ofacmatch 0.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for ofacmatch-0.2.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 24, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page