Skip to main content
Thirdwatchthirdwatch
Engineering

Export OFAC Sanctions Data to CSV and Python

Export structured OFAC rows to CSV or JSON and prepare them for analysis without losing list identity.

Jul 21, 2026 · 2 min read · 252 words
See the scraper →

Official sanctions files are already downloadable, but analysts often need a smaller, consistent dataset that can be scheduled and joined with internal systems. The OFAC Sanctions Scraper performs the search and normalization before Apify exposes the result as JSON, CSV, Excel, or an API response.

Preserve the record model

Run a bounded query and export JSON when possible. JSON keeps the programs array and distinguishes null from an empty string.

import requests

url = "https://api.apify.com/v2/datasets/DATASET_ID/items"
rows = requests.get(url, params={"clean": "true"}, timeout=60).json()

by_key = {(row["list_type"], row["uid"]): row for row in rows}
print(len(by_key))

If CSV is required, check how your importer handles program arrays and quoted remarks. Remarks can contain punctuation, aliases, and long explanatory text. Let a standards-compliant CSV library parse the file rather than splitting lines or commas manually.

Build traceable tables

Keep list_type, uid, source_url, and the collection timestamp in the destination table. Create a separate child table for programs if your warehouse benefits from one program per row. Do not use the name as a primary key.

Before a scheduled load replaces a table, validate that the run succeeded, the dataset is non-empty when expected, and the count is plausible relative to the previous snapshot. Store the raw export alongside transformed tables. This makes program parsing, null handling, and later corrections auditable.

Finally, restrict access according to the sensitivity of the internal identities you join to the public records. OFAC rows are public, but vendor or customer screening results can become sensitive operational data.

Frequently asked questions

Which export format is best?

JSON preserves program arrays and nulls; CSV is convenient when your downstream system understands serialized arrays.

Can I deduplicate by name?

No. Use list type plus UID because names can repeat or change.

Related

Try it yourself

100 free credits, no credit card.

About 30 real searches. Add the MCP to Claude or Cursor in two minutes.