Projects / Document processing
Live demo

LedgerFlow AI

Reads supplier invoices, checks the maths, VAT, duplicates and bank details, and sends clean ones to accounting without a human.

n8nOpenAI visionPostgreSQLS3Xero

Business problem

Finance teams re-type invoices into accounting by hand, miss duplicates, and pay the occasional fraudulent invoice with changed bank details.

Solution

Invoices arrive by email or upload. OpenAI vision extracts every field; SQL rules check line maths, VAT rates, dates, duplicates, purchase orders and limits. Clean invoices are approved automatically; anything else gets a review page, and a bank-detail change blocks payment until confirmed.

What it saves

≈ 36 hours and $1,000+ saved per month

for a business processing 400 supplier invoices a month

  • Manual handling: ~6 min per invoice to open, check and type into accounting → 40 h/month.
  • With LedgerFlow ~70% go through untouched; the rest take ~2 min on the review page → about 4 h/month.
  • 36 hours saved × $30/h ≈ $1,080 per month. One blocked payment to a fraudster’s bank account can be worth more than the whole project.
Illustrative estimate based on the assumptions above. Every business is different: the numbers are worked out for your process before anything is built.

Ways to adapt it to your business

  • Intake: a dedicated invoices@ inbox, uploads, Google Drive / Dropbox folders, or supplier portals.
  • Accounting: Xero, QuickBooks Online, FreeAgent, Sage — draft bills with the original attached.
  • Your own rules: approval limits, purchase-order matching, VAT rates, cost centres, multiple currencies.
  • Approvals and alerts in Slack or Microsoft Teams; receipts and expense claims too.

Tech stack

n8n
intake, extraction, review pages, export queue, reports
OpenAI vision
reads PDFs and phone photos into a strict schema
PostgreSQL
the validation rules, suppliers, documents and audit trail
S3 / MinIO
stores every original file
Xero
draft bills with the original attached
Slack
alerts, decisions, weekly summary
Live demo

Run an invoice through the pipeline

Act as the bookkeeper of a fictional agency. Send a supplier invoice through the pipeline: the AI reads it, the rules check it, and you see the decision.

Runs live here

  • AI reading of PDFs and phone photos
  • All checks: maths, VAT, duplicates, bank details, PO, limits
  • Review page, supplier learning, Slack notifications

Built, connected per client

  • Intake from a watched Gmail inbox
  • Export to Xero as draft bills with the original attached
  • Weekly summary and review reminders

Inside the workflows

Real screenshots from n8n, with what every node does.

01 · Intake & AI extraction

Gmail TriggerUpload WebhookLoad ContextCollect FilestruefalseHas Files?truefalseUnauthorized?Respond 401Respond 400Hash FilesRegister DocumentsAttach RegistrationtruefalseFrom Upload?Respond AcceptedtruefalseNew Document?doneloopLoop Over DocumentsBuild ExtractionRequestStore OriginalAI ExtractParse ExtractionSave & ValidateBuild NotificationtruefalseNotify?SlackLog Slack Message
Drag to move · scroll or pinch to zoom · click a node
  1. Gmail Trigger · Upload Webhook

    Invoices arrive as email attachments or through an upload API protected by a key.

  2. Load Context · Collect Files

    Loads the configuration and chart of accounts, keeps PDFs and images, and rejects other file types.

  3. Has Files? · Unauthorized? · Respond 401 / 400

    Wrong API keys and requests without a usable file get a clear error.

  4. Hash Files · Register Documents · Attach Registration

    A SHA-256 fingerprint of every file: the same invoice sent twice is recognised and never processed again.

  5. From Upload? · Respond Accepted

    Uploads get an immediate answer with the document id; processing continues in the background.

  6. New Document? · Loop Over Documents

    Processes new documents one by one, so one bad file never stops the others.

  7. Build Extraction Request · Store Original

    Stores the original in S3 and prepares the file for the vision model.

  8. AI Extract · Parse Extraction

    OpenAI reads supplier, VAT number, bank details, dates, line items and totals into a strict JSON schema with confidence scores.

  9. Save & Validate

    One PostgreSQL function applies every rule: line maths, VAT rates, dates, duplicates, purchase orders, limits and changed bank details — and decides auto-approve or review.

  10. Build Notification · Notify? · Slack · Log Slack Message

    Slack gets a summary of what was decided and why, with a review link when a person is needed.

02 · Review page

Review PageLoad Review DataDownload forPreviewRender Review PageRespond Review PageFile RequestFind FiletruefalseFound?Download OriginalRespond FileRespond 404DecisionApply ReviewRender ResultRespond ResulttruefalseNotify Team?Slack: DecisionLog Slack Decision
Drag to move · scroll or pinch to zoom · click a node
  1. Review Page · Load Review Data · Download for Preview · Render Review Page · Respond Review Page

    A secure page with the original document next to the extracted data and every issue found, with all fields editable.

  2. File Request · Find File · Found? · Download Original · Respond File · Respond 404

    Serves the original file to the reviewer only with a valid token.

  3. Decision · Apply Review · Render Result · Respond Result

    Applies corrections, re-runs every check, requires a phone confirmation for changed bank details, and learns new suppliers and accounts.

  4. Notify Team? · Slack: Decision · Log Slack Decision

    The team sees who approved or rejected what, and whether bank details were confirmed.

Technical implementation

Originals stored in S3 (MinIO) and fingerprinted so a file is never processed twice. Validation is a tested PostgreSQL function; approving a new supplier once teaches the system. Approved bills are exported to Xero as drafts with the original attached; Slack alerts and weekly reports.

Business value

Most invoices go through untouched, people only look at real exceptions, and fraud attempts are stopped before payment.

What this changes for the business

  • Most invoices go from inbox to accounting without anyone typing a number.
  • People only look at real exceptions, with the problem already explained and the original next to the data.
  • Duplicates and changed bank details are stopped before payment, protecting the business from the most common invoice fraud.
  • Month-end close gets faster: every bill is already coded, checked and attached to its original.