Fetch only. This package fetches and parses the list. It does not screen names and it stores nothing. List data alone is not a clearance decision.

US Treasury OFAC lists from the Sanctions List Service (SLS):

  • ofac-sdn: the Specially Designated Nationals and Blocked Persons List (SDN), about 19,000 entries;
  • ofac-cons: the Consolidated (non-SDN) list (SSI, FSE, NS-PLC, NS-MBS, CAPTA, NS-CMIC), a few hundred entries.

Format used: the legacy CSV files (SDN.CSV + ALT.CSV + ADD.CSV + SDN_COMMENTS.CSV, and the CONS_* equivalents). Each file fits Hot's default 16 MiB response cap (SDN.CSV is about 5.8 MB). They carry the id, name, type, programs, aliases and addresses as columns; dates of birth and nationalities are parsed from the Remarks column (DOB 10 Dec 1948; alt. DOB 1950; nationality Iran; ...). SDN.XML (29 MB) and the Advanced XML (128 MB) exceed the default cap.

Versioning: SLS's file listing (POST /api/PublicationPreview/SdnList and .../ConsolidatedList) gives each file's SHA-256 and publication date. current-version reads it without downloading a list, and fetch skips the download when you pass the version you already hold.

Example

out ::ofac/fetch("ofac-sdn")
out.version
first(out.entries).name

Values

CSV_FIELD

CSV_FIELD: Str "(?:\"((?:[^\"]|\"\")*)\"|([^,\\r\\n]*))"

LISTS

LISTS: Map {
  ofac-sdn: {
    list: "OFAC SDN List",
    manifest: "/api/PublicationPreview/SdnList",
    primary: "SDN.CSV",
    alt: "ALT.CSV",
    add: "ADD.CSV",
    comments: "SDN_COMMENTS.CSV"
  },
  ofac-cons: {
    list: "OFAC Consolidated (non-SDN) List",
    manifest: "/api/PublicationPreview/ConsolidatedList",
    primary: "CONS_PRIM.CSV",
    alt: "CONS_ALT.CSV",
    add: "CONS_ADD.CSV",
    comments: "CONS_COMMENTS.CSV"
  }
}

MONTHS

MONTHS: Map {
  jan: "01",
  feb: "02",
  mar: "03",
  apr: "04",
  may: "05",
  jun: "06",
  jul: "07",
  aug: "08",
  sep: "09",
  oct: "10",
  nov: "11",
  dec: "12"
}

SLS_BASE

SLS_BASE: Str "https://sanctionslistservice.ofac.treas.gov"

SOURCES

SOURCES: Vec [
  "ofac-sdn",
  "ofac-cons"
]

Functions

clean-list

fn (values: Vec): Vec<Str>

Trim strings, drop blanks and duplicates, keep the first-seen order.

Example

::ofac/clean-list([" a ", "b", "a", "  ", null])  // ["a", "b"]

current-version

fn (source: Str): Str?

The list's current version from the SLS file listing, without downloading the list: one small POST. Compare it with the version you hold to skip a download. Null when the listing has no entry for the primary file, an Err when the listing can't be read.

Example

::ofac/current-version("ofac-sdn")  // "5f240bed79d504e7"

detail-url

fn (ent-num: Str): Str

The OFAC Sanctions List Search page for an entry.

Example

::ofac/detail-url("306")
// "https://sanctionssearch.ofac.treas.gov/Details.aspx?id=306"

export-url

fn (file: Str): Str

The SLS download URL for an export file name (it redirects to a signed S3 URL).

Example

::ofac/export-url("SDN.CSV")
// "https://sanctionslistservice.ofac.treas.gov/api/PublicationPreview/exports/SDN.CSV"

fetch

fn (source: Str): Map
fn (source: Str, known-version: Str?): Map

Download and parse one OFAC list. Returns {source, version, entries, unchanged, published}. known-version is the version you already hold: when the file listing shows the same version, nothing is downloaded, unchanged is true and entries is null.

A file that fails to download is an Err, as is a list that parses to no records. All four files of a list are always published, so a partial list, such as one without its aliases, never comes back.

Example

out ::ofac/fetch("ofac-sdn")
again ::ofac/fetch("ofac-sdn", out.version)
again.unchanged

iso-date

fn (raw: Str?): Str?

Normalize one published date of birth to ISO 8601, or null when it has no year. Accepts 1948-12-10, 10 Dec 1948, Dec 1948, 1948, circa 1948, 10/12/1948 and dd/mm/1948 (day first), and ranges such as 1959 to 1962 or 01 Jan 1960 to 31 Dec 1962 (1959/1962, 1960/1962).

Example

::ofac/iso-date("10 Dec 1948")  // "1948-12-10"
::ofac/iso-date("dd/mm/1963")   // "1963"
::ofac/iso-date("1959 to 1962") // "1959/1962"

manifest

fn (source: Str): Map

The SLS file listing for "ofac-sdn" or "ofac-cons": a Map from file name to {size, last-updated, sha256}.

Example

files ::ofac/manifest("ofac-sdn")

// One Map per published file, keyed by file name
get(files, "SDN.CSV").sha256
get(files, "SDN.CSV").last-updated

other-names

fn (aliases: Vec, name: Str): Vec<Str>

Cleaned aliases without the primary name, ignoring case.

Example

::ofac/other-names(["acme", " Acme Two ", ""], "ACME")  // ["Acme Two"]

parse

fn (source: Str, primary: Str, alt: Str, add: Str, comments: Str): Vec<Entry>

Build Entry records from the four OFAC CSV texts (pure). source is "ofac-sdn" or "ofac-cons"; alt, add and comments may be "".

SDN.CSV columns: ent_num, SDN_Name, SDN_Type, Program, Title, Call_Sign, Vess_type, Tonnage, GRT, Vess_flag, Vess_owner, Remarks. ALT.CSV: ent_num, alt_num, alt_type, alt_name, alt_remarks. ADD.CSV: ent_num, add_num, address, city/state/postal, country, add_remarks. SDN_COMMENTS.CSV: ent_num, remarks continued.

Example

primary "306,\"BANCO NACIONAL DE CUBA\",-0- ,\"CUBA\",-0- ,-0- ,-0- ,-0- ,-0- ,-0- ,-0- ,\"a.k.a. 'BNC'.\""
alt "306,220,\"aka\",\"NATIONAL BANK OF CUBA\",-0-"
entries ::ofac/parse("ofac-sdn", primary, alt, "", "")
first(entries).name  // "BANCO NACIONAL DE CUBA"
first(entries).kind  // "entity"
first(entries).aliases  // ["NATIONAL BANK OF CUBA"]

parse-csv

fn (text: Str, n: Int): Vec<Vec>

Parse an OFAC legacy CSV file into rows of n values each. OFAC's null marker -0- and blanks become null. The trailing 0x1A end marker and blank lines are ignored.

Example

::ofac/parse-csv("36,\"AEROCARIBBEAN AIRLINES\",-0- \r\n", 3)
// [["36", "AEROCARIBBEAN AIRLINES", null]]

parse-manifest

fn (files: Any): Map

Turn the SLS listing JSON (a Vec of {fileName, size, lastUpdated, hashCodes}, where hashCodes is itself a JSON string) into {file-name: {size, last-updated, sha256}}. Exposed for testing.

Example

files [{fileName: "SDN.CSV", size: 5750799, lastUpdated: "2026-10-28T00:00:00", hashCodes: "{\"SHA-256\":\"5f240bed\"}"}]
get(::ofac/parse-manifest(files), "SDN.CSV").sha256  // "5f240bed"
get(::ofac/parse-manifest(files), "SDN.CSV").size  // 5750799

parse-remarks

fn (remarks: Str?): Map

Pull dates of birth and nationalities out of an OFAC Remarks value: DOB / alt. DOB items (ISO-normalized), and nationality / citizen items, as published.

Example

::ofac/parse-remarks("DOB 19 Jun 1951; POB Giza, Egypt; nationality Egypt.")
// {dobs: ["1951-06-19"], nationalities: ["Egypt"]}

require-entries

fn (entries: Vec): Vec

The parsed records, or an Err when there are none: a changed file format can parse to nothing, and an empty list must not pass for a list with nobody on it.

Example

::ofac/require-entries(["an entry"])  // ["an entry"]
is-err(::ofac/require-entries([]))  // true

row-pattern

fn (n: Int): Str

A multi-line regex matching one CSV row of n fields at the start of a line (quoted fields may contain commas and doubled quotes).

Example

::hot::regex/is-match("36,\"AEROCARIBBEAN AIRLINES\"", ::ofac/row-pattern(2))  // true

version

fn (source: Str, files: Map): Str?

A version string for a list from its SLS manifest: the SHA-256 of the primary CSV (first 16 hex digits), or its lastUpdated when no hash is listed. Null when the manifest has no entry for the file.

Example

files {"SDN.CSV": {size: 5750799, last-updated: "2026-10-28T00:00:00", sha256: "5f240bed79d504e7a5aa"}}
::ofac/version("ofac-sdn", files)  // "5f240bed79d504e7"
::ofac/version("ofac-cons", files)  // null

Types

Entry

Entry type {
    source: Str,
    list: Str,
    id: Str,
    kind: EntryKind,
    name: Str,
    title: Str?,
    aliases: Vec<Str>,
    dobs: Vec<Str>,
    nationalities: Vec<Str>,
    programs: Vec<Str>,
    addresses: Vec<Str>,
    call-sign: Str?,
    vessel-type: Str?,
    tonnage: Str?,
    grt: Str?,
    vessel-flag: Str?,
    vessel-owner: Str?,
    remarks: Str?,
    url: Str
}

One OFAC list entry, as the legacy CSV files publish it.

Fields

  • source — "ofac-sdn" or "ofac-cons"
  • list — the list's name, e.g. "OFAC SDN List"
  • id — OFAC's ent_num
  • kind — an EntryKind
  • name — the name as published, e.g. "AL ZAWAHIRI, Dr. Ayman"
  • title — the title column
  • aliases — the alternate names from ALT.CSV
  • dobs — dates of birth from the Remarks column, as ISO 8601: YYYY-MM-DD, YYYY-MM, YYYY, or a range YYYY/YYYY
  • nationalities — nationality and citizen items from the Remarks column, as published
  • programs — OFAC program tags
  • addresses — one line per ADD.CSV row
  • call-sign, vessel-type, tonnage, grt, vessel-flag, vessel-owner — the vessel columns
  • remarks — the Remarks column, continued from the comments file
  • url — the entry's OFAC Sanctions List Search page

EntryKind

EntryKind type "individual" | "entity" | "vessel" | "aircraft"

What a listed party is. OFAC's SDN_Type column says individual, vessel or aircraft, and leaves it empty for an entity.