TK
Menu

AI Workflow Automation

KYC Document Review with AI Extraction and Human Decision (n8n + Claude)

Reads identity documents and proofs of address from photos, HEIC, scans, PDFs and Word files; handles password-protected files without the password touching the workflow; Claude reads, code checks passport MRZ check digits, expiry, age and cross-document matches, and a person decides. 48 of 48 fields read exactly, about $0.05 per application.

Problem

Onboarding teams receive identity documents as blurry phone photos, sideways scans, iPhone HEIC files, password-protected bank statements and the occasional wrong file. Manual checking is slow and inconsistent; an AI that decides on its own is unauditable. And identity documents are among the most sensitive data a company holds.

Approach

I built the workflow in n8n with a Python intake service, on one design rule: code decides what a file is and whether the facts hold up; the AI reads; a person decides.

  • Intake in code, before any AI call: the real file type from its bytes (a text file renamed .pdf is caught), password protection, macro-enabled Word files, photos turned upright from EXIF, PDF pages rendered, and image quality scored where the page has content. Bad files stop here with a message the customer can act on.
  • Password-protected files: detected as needs_password. The reviewer types the customer's password into a form that goes straight to the intake service, never through n8n; it's used once, never stored or logged, and attempts are limited. No automatic guessing.
  • Claude Opus (vision) classifies each readable document and reads 15 fields (as printed, normalised, with confidence), with structured outputs.
  • Checks in code: passport MRZ check digits (ICAO 9303), MRZ against the printed page, expiry, minimum age, ID number format, proof-of-address age, and name, date of birth and address against the application. PDFs edited with image tools are flagged.
  • A person decides on a review page showing the document images beside the fields and every check. Nothing is approved automatically, and the workflow keeps no execution data.

An edited passport caught by the MRZ check digits

Result

Tested with 12 specimen applications (fictional people from "Utopia", the ICAO specimen state) on 2026-11-16: 15 of 15 quality gates passed.

  • 48 of 48 fields read exactly and 16 of 16 document types correct, from passport and ID photos, a photo saved sideways, an iPhone HEIC, a scanned statement and digital PDFs.
  • Every planted problem caught: a blurred photo and a renamed file (stopped with no AI call), an expired passport, a passport with an edited date of birth (check digits), a bill in someone else's name, a five-month-old bill, a café receipt as proof of address, an applicant under 18, and a statement saved with Photoshop.
  • Password flow: a wrong password refused and counted; the right one opened, read and re-checked the statement. The test password appears nowhere in the KYC database or n8n's execution history.
  • About $0.05 per application.

Testing found four real problems: the extraction schema exceeded the API's limit on nullable fields; a failed AI call was stored in a way that told the customer they had uploaded the wrong document; sharp scans on white paper were rejected because blank paper scored as "glare"; and unlocking a file deadlocked the service and n8n. All four are fixed and covered by tests.

A password-protected statement after the reviewer unlocked it

What this shows

Document AI built for a regulated process: deterministic file handling and fraud checks, an AI that reads but doesn't decide, careful handling of passwords and personal data, a human in the loop, and an evaluation that measures field accuracy, problem detection, privacy and cost.