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"])

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"},
    # ... 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; 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. 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.1.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.1.0
File Size Uploaded Provenance Actions
ofacmatch-0.1.0.tar.gz 12.7 kB With provenance Details for ofacmatch-0.1.0.tar.gz

Built distribution (wheel)

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

Total release size: 22.6 kB

Release files / ofacmatch-0.1.0.tar.gz

Download URL ofacmatch-0.1.0.tar.gz
Size 12.7 kB
Tags Source
SHA-256 checksum
How to use checksums
2bd5c8a223598443c62776c8443fb07eccbbd6064585964226b293a0f5cda46a
BLAKE2b-256 checksum
How to use checksums
3c38b6cc1ac3557f891c173519eeaa57944debbd509d74f435b43beb3fd8c22f
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 17, 2026.

Transparency log

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

Download URL ofacmatch-0.1.0-py3-none-any.whl
Size 9.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7cc52998de25663bf8ea12984d735297fc1a81dfcca2fa609c398889443238bd
BLAKE2b-256 checksum
How to use checksums
8089ab631c9600cc785df2f7dce0af4cc7851efa98979660186b33c8fc7c1a01
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 17, 2026.

Transparency log

Security for ofacmatch 0.1.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.1.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 17, 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.1.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