{"slug": "how-to-automate-income-verification-from-pay-stubs-w-2s-and-bank-statements", "title": "How to Automate Income Verification From Pay Stubs, W-2s, and Bank Statements", "summary": "Aman Mishra, writing for Unsiloed AI, described a four-step pipeline that uses the Unsiloed extraction API to pull key figures from pay stubs, W-2s, and bank statements with confidence scores and page coordinates, then compares them in Python to flag only the discrepancies for human review. The walkthrough follows one applicant's file of five documents that each pass a page-by-page read but fail a cross-document check, illustrating how mismatches surface only when figures are compared across documents.", "body_md": "*By Aman Mishra. Originally published on [Unsiloed AI](https://www.unsiloed.ai/blog/automated-income-verification).*\n\nA lender or landlord who wants to know what someone earns usually gets three kinds of paperwork. A pay stub covers one pay period. A W-2 covers last year. A bank statement shows what actually arrived in the account. Each one tells part of the story, and the useful question is whether the parts agree. Answering that by hand means reading figures off five or six pages and doing arithmetic across them, which is slow and easy to get wrong.\n\nWe use the Unsiloed extraction API to pull the handful of figures each check needs, each with a confidence score and the exact spot on the page it came from. Then we use Python to compare the documents and hand a person only the parts that don't agree. The guide below takes that approach through one applicant's file, five documents that pass a page-by-page read and fail a cross-check.\n\nIncome verification is checking evidence of what someone earns. Automating it means software reads that evidence, compares the figures, and leaves a person only the exceptions. Some services skip the paperwork and connect to payroll or bank accounts directly. This guide covers the other route, where the applicant uploads documents and each one answers a different question.\n\n| Document | What It Shows | What It Can't Tell You | \n|---|---|---|\n| Pay stub | Earnings and deductions for one pay period. | Whether the money reached the bank account. | \n| W-2 | Total wages and tax withheld for one year from one US employer. | What the employee earns now. | \n| Bank statement | Deposits and other transactions for the statement period. | Whether a deposit is pay from a job. | \n\nThe work happens in four steps.\n\nIf the documents arrive in one mixed PDF, [classify and separate its pages](https://www.unsiloed.ai/blog/document-classification-python) first. The rest of this guide takes one applicant's file through the four steps.\n\nElian Voss works for Ternvale Fabrication LLC and banks with Larkmere Bank. The file has two monthly pay stubs, last year's W-2 and two months of bank statements.\n\n| Document |  | Extracted JSON | \n|---|---|---|\n| August pay stub | [stub-08.pdf](https://www.unsiloed.ai/blog-assets/automated-income-verification/stub-08.pdf) | [stub-08.json](https://www.unsiloed.ai/blog-assets/automated-income-verification/stub-08.json) | \n| September pay stub | [stub-09.pdf](https://www.unsiloed.ai/blog-assets/automated-income-verification/stub-09.pdf) | [stub-09.json](https://www.unsiloed.ai/blog-assets/automated-income-verification/stub-09.json) | \n| 2025 W-2 | [w2-2025.pdf](https://www.unsiloed.ai/blog-assets/automated-income-verification/w2-2025.pdf) | [w2-2025.json](https://www.unsiloed.ai/blog-assets/automated-income-verification/w2-2025.json) | \n| August bank statement | [bank-08.pdf](https://www.unsiloed.ai/blog-assets/automated-income-verification/bank-08.pdf) | [bank-08.json](https://www.unsiloed.ai/blog-assets/automated-income-verification/bank-08.json) | \n| September bank statement | [bank-09.pdf](https://www.unsiloed.ai/blog-assets/automated-income-verification/bank-09.pdf) | [bank-09.json](https://www.unsiloed.ai/blog-assets/automated-income-verification/bank-09.json) | \n\nRead one page at a time, nothing stands out. The name matches everywhere. Each stub shows $6,000 of [gross pay](https://www.federalreserveeducation.org/teaching-resources/personal-finance/earning-income/understanding-your-pay-stub), the figure before deductions, and $4,500 of net pay, the figure that goes to the bank, paid by direct deposit to the account ending 4826. The bank statements are for that same account, and last year's W-2 reports $66,000.\n\nTwo things are hiding in these documents. One looks like a problem and isn't. The other looks fine and is a problem. Both only show up when the documents are compared.\n\nA schema tells the API which fields to return and what type each one is. We ask for very little, because every extra field is one more value someone might need to review. The [pay stub guide](https://www.unsiloed.ai/blog/pay-stub-ocr), [W-2 form guide](https://www.unsiloed.ai/blog/extract-data-from-pdf-form) and [bank statement guide](https://www.unsiloed.ai/blog/bank-statement-data-extraction) cover extracting each document in full.\n\n``` python\ndef field(kind, description):\n    return {\"type\": [kind, \"null\"], \"description\": description}\n\ndef obj(**fields):\n    return {\"type\": \"object\", \"properties\": fields, \"required\": list(fields)}\n\nstub_schema = obj(\n    name=field(\"string\", \"Employee full name\"),\n    employer=field(\"string\", \"Employer name\"),\n    pay_date=field(\"string\", \"Pay date as YYYY-MM-DD\"),\n    periods_paid=field(\"integer\", \"Payments this calendar year\"),\n    gross_pay=field(\"number\", \"Current gross pay\"),\n    net_pay=field(\"number\", \"Current net pay\"),\n    taxable_pay=field(\"number\", \"Current federal taxable wages\"),\n    ytd_taxable=field(\"number\", \"Year-to-date federal taxable wages\"),\n)\n\nw2_schema = obj(\n    name=field(\"string\", \"Box e employee name\"),\n    employer=field(\"string\", \"Box c employer name\"),\n    tax_year=field(\"integer\", \"Tax year\"),\n    box_1=field(\"number\", \"Box 1 wages, tips, other compensation\"),\n)\n\ndeposit = obj(\n    date=field(\"string\", \"Deposit date as YYYY-MM-DD\"),\n    description=field(\"string\", \"Description, verbatim\"),\n    amount=field(\"number\", \"Deposit amount\"),\n)\nbank_schema = obj(\n    name=field(\"string\", \"Account holder name\"),\n    deposits={\"type\": \"array\", \"items\": deposit,\n              \"description\": \"Every deposit row. Empty list if none.\"},\n)\n```\n\nThe pay stub fields include federal taxable wages, the earnings federal income tax is calculated on. That field turns out to matter more than gross pay.\n\nWe send each PDF to the [extraction endpoint](https://www.unsiloed.ai/docs/api-reference/extraction/extract-data) with its schema and poll until the job finishes. `model` is set to `gamma`, which reads these forms reliably, and `enable_citations` asks for the location of every value.\n\n``` python\nimport json, os, time, requests\n\nBASE = \"https://prod.visionapi.unsiloed.ai\"\nHEADERS = {\"api-key\": os.environ[\"UNSILOED_API_KEY\"]}\n\ndef extract(pdf, schema):\n    with open(pdf, \"rb\") as f:\n        job = requests.post(f\"{BASE}/v2/extract\", headers=HEADERS,\n            files={\"pdf_file\": (pdf, f, \"application/pdf\")},\n            data={\"schema_data\": json.dumps(schema), \"model\": \"gamma\",\n                  \"enable_citations\": \"true\"}).json()\n    while True:\n        result = requests.get(f\"{BASE}/extract/{job['job_id']}\", headers=HEADERS).json()\n        if result[\"status\"] == \"completed\":\n            return result[\"result\"]\n        time.sleep(3)\n\ndocs = {name: extract(f\"{name}.pdf\", schema) for name, schema in [\n    (\"stub-08\", stub_schema), (\"stub-09\", stub_schema), (\"w2-2025\", w2_schema),\n    (\"bank-08\", bank_schema), (\"bank-09\", bank_schema)]}\n```\n\nEvery value comes back with two scores and a citation. Here is Box 1 from the W-2.\n\n```\n{\n  \"value\": 66000.0,\n  \"score\": {\"grounding_score\": 0.98, \"extraction_score\": 0.998},\n  \"citation\": {\"page\": 1, \"bbox\": [48, 282, 130, 301],\n               \"page_width\": 612.0, \"page_height\": 792.0}\n}\n```\n\nThe `extraction_score` is the API's confidence in the value itself. The `grounding_score` is its confidence that it found the value at the cited spot. Both run from zero to one. The citation gives the page and a bounding box, the rectangle on the page where the value sits. That rectangle is what lets every check below point a reviewer to the exact figure behind it.\n\nNone of the documents can be verified alone, so each check takes a few fields from two or three of them and compares them.\n\nEach check below is a sketch written against the `docs` dictionary from the previous step. A production system would add its own handling for low scores and missing values, which we come back to at the end.\n\n``` python\nfrom datetime import date, timedelta\nimport re\n\nv = lambda f: f[\"value\"]\nstubs = {name: docs[name] for name in (\"stub-08\", \"stub-09\")}\nw2 = docs[\"w2-2025\"]\nbanks = [docs[\"bank-08\"], docs[\"bank-09\"]]\n```\n\nEvery document should name the same person and the same employer. We lowercase the names and strip punctuation before comparing, which handles \"ELIAN VOSS\" on the bank statement.\n\nThe employer is harder. On the bank statement, the paycheck shows up as `TERNVALE FAB PAYROLL PPD`, the bank's shorthand for a payroll deposit from Ternvale Fabrication. No string cleanup turns that into \"Ternvale Fabrication LLC\". Fuzzy matching might, but it might also match a deposit that isn't pay. A small table of descriptions a person has already confirmed is safer, and it grows as reviewers approve new ones.\n\n``` python\ndef normal(text):\n    return \" \".join(re.sub(r\"[^\\w\\s]\", \" \", text.casefold()).split())\n\nALIASES = {\"ternvale fab payroll ppd\": \"ternvale fabrication llc\"}\n\npayroll = [row for bank in banks for row in v(bank[\"deposits\"])\n           if normal(v(row[\"description\"])) in ALIASES]\n\npeople = {normal(v(d[\"name\"])) for d in docs.values()}\nemployers = {normal(v(d[\"employer\"])) for d in [*stubs.values(), w2]}\nemployers |= {ALIASES[normal(v(row[\"description\"]))] for row in payroll}\n\nprint(\"person:\", \"PASS\" if len(people) == 1 else \"REVIEW\", people)\nprint(\"employer:\", \"PASS\" if len(employers) == 1 else \"REVIEW\", employers)\n```\n\nThe September stub shows $6,000 gross pay a month. Multiply by twelve, the usual way to annualize a stub, and the applicant earns $72,000 a year. The W-2 for last year says $66,000 in Box 1. A naive check would flag a $6,000 gap and conclude the stubs overstate the income.\n\nThe answer is on the stub itself. Each month, $500 goes into a traditional 401(k), a workplace retirement plan paid into before income tax. The [IRS instructions for Box 1](https://www.irs.gov/instructions/iw2w3) leave those contributions out. So the stub figure to hold against Box 1 is federal taxable wages. $5,500 of taxable pay a month is $66,000 a year, which matches the W-2 exactly.\n\nThe year-to-date figure, the running total since January 1, gives a second view of the same year. September's stub shows $49,500 of taxable pay over nine payments, which also projects to $66,000.\n\n```\nlatest = stubs[\"stub-09\"]\ngross = v(latest[\"gross_pay\"]) * 12\ntaxable = v(latest[\"taxable_pay\"]) * 12\nprojected = v(latest[\"ytd_taxable\"]) / v(latest[\"periods_paid\"]) * 12\n\nprint(f\"gross x 12:     {gross:,.0f}\")\nprint(f\"taxable x 12:   {taxable:,.0f}\")\nprint(f\"YTD projected:  {projected:,.0f}\")\nprint(f\"W-2 Box 1:      {v(w2['box_1']):,.0f}\")\n```\n\nThese figures match to the dollar because the salary and contribution didn't change between years. With raises, bonuses, hourly pay or a midyear start, compare within a tolerance and send larger gaps to a person with both cited figures.\n\nEach stub says $4,500 went by direct deposit to the account ending 4826. For each stub, we look for a payroll deposit of the same amount within three days of the pay date.\n\n```\nfor name, stub in stubs.items():\n    paid = date.fromisoformat(v(stub[\"pay_date\"]))\n    hits = [row for row in payroll\n            if v(row[\"amount\"]) == v(stub[\"net_pay\"])\n            and abs(date.fromisoformat(v(row[\"date\"])) - paid) <= timedelta(days=3)]\n    page = stub[\"net_pay\"][\"citation\"][\"page\"]\n    status = \"PASS\" if hits else \"REVIEW, no matching deposit\"\n    print(f\"{paid} net {v(stub['net_pay']):,.0f}: {status} ({name}.pdf p.{page})\")\n```\n\nRun against the five documents, the checks print this.\n\n```\nperson: PASS {'elian voss'}\nemployer: PASS {'ternvale fabrication llc'}\ngross x 12:     72,000\ntaxable x 12:   66,000\nYTD projected:  66,000\nW-2 Box 1:      66,000\n2026-08-31 net 4,500: REVIEW, no matching deposit (stub-08.pdf p.1)\n2026-09-30 net 4,500: PASS (stub-09.pdf p.1)\n```\n\nThe names agree, and once taxable wages are compared like for like, so does the income. The gap that looked like a problem was a 401(k) contribution. The month that looked fine is the one to worry about. September's paycheck arrived on September 30. The August statement for account 4826 shows rent, groceries, a utility bill and a card payment, and no deposits at all.\n\nThe August paycheck is the one exception, and the output says where to look, so a reviewer opens the August stub and the August statement instead of rereading all five documents. There are ordinary explanations, such as a changed account, a delayed payroll run or a stub that doesn't match what was paid. Deciding which applies is a job for a person.\n\nValues with scores below your cutoff, and fields that come back null, are exceptions too, and they go to a person before any comparison runs. The [confidence score thresholds guide](https://www.unsiloed.ai/blog/confidence-score-thresholds-document-automation) covers choosing a cutoff for each field.\n\nThe same pattern covers whatever else your team checks, such as a second employer or an employment letter. Extract the few fields the check needs, compare them across documents, and keep the citations so every flag points back to the page that raised it. What the loan officer or leasing agent gets is a short list of places where the paperwork disagrees, with the decision still theirs.", "url": "https://wpnews.pro/news/how-to-automate-income-verification-from-pay-stubs-w-2s-and-bank-statements", "canonical_source": "https://dev.to/unsiloed/how-to-automate-income-verification-from-pay-stubs-w-2s-and-bank-statements-2e6p", "published_at": "2026-11-19 06:58:37+00:00", "updated_at": "2026-11-19 07:12:06.621822+00:00", "lang": "en", "topics": ["ai-tools", "artificial-intelligence", "ai-products"], "entities": ["Unsiloed AI", "Aman Mishra", "Ternvale Fabrication LLC", "Larkmere Bank"], "also_reported_by": [], "takeaway": "Extract only the handful of figures each document check needs with confidence scores and page coordinates, then compare them across documents in code so reviewers see only the exceptions rather than every page.", "recommendation": {"advice": "Cross-check extracted figures across pay stubs, W-2s and bank statements in code and route only mismatches to humans, since each document alone can look valid while disagreeing with the others.", "playbook": "output-verification", "playbook_url": "https://wpnews.pro/playbooks/output-verification"}, "alternates": {"html": "https://wpnews.pro/news/how-to-automate-income-verification-from-pay-stubs-w-2s-and-bank-statements", "markdown": "https://wpnews.pro/news/how-to-automate-income-verification-from-pay-stubs-w-2s-and-bank-statements.md", "text": "https://wpnews.pro/news/how-to-automate-income-verification-from-pay-stubs-w-2s-and-bank-statements.txt", "jsonld": "https://wpnews.pro/news/how-to-automate-income-verification-from-pay-stubs-w-2s-and-bank-statements.jsonld"}}