AI Invoice Intake & Approval
A production-style n8n pipeline (v4): Mistral OCR extracts invoices (including scans), business rules validate them, every run lands in an audit trail keyed by uid, and humans approve only what matters.
A production-style n8n pipeline (v4): Mistral OCR extracts invoices (including scans), business rules validate them, every run lands in an audit trail keyed by uid, and humans approve only what matters.
// the pipeline, end to end
Finance teams processing 50+ invoices a month lose 8–12 hours a week opening emails, re-typing vendor names and totals into spreadsheets, and chasing managers for sign-off. And real invoices are messy: scans, phone photos, layouts that change vendor to vendor.
A Gmail trigger watches the intake inbox; a has-PDF gate skips anything without an attachment. The document is prepared for OCR, then one call to Mistral’s /v1/ocr with a document-annotation JSON schema (so the API itself guarantees the output shape), and the annotations are parsed into vendor, invoice number, dates, totals, terms; null when genuinely missing, never guessed.
A Code node validates and applies the business rules (required fields, subtotal + tax ≈ total, ≥ $1,000 needs a human). Every invoice is appended to a Google Sheets audit trail before any routing happens, then a needs-human-approval gate sends either a request-approval email to the manager or an auto-approval notice back to the sender. Failed extractions degrade gracefully to human review.
The v4 revision exists for one reason: auditability. Every invoice the audit harness sends carries a uid in the email subject; the workflow carries that uid through to the audit trail and dedupes on it, so re-runs can’t double-count. The result is an audit trail that can be joined row-for-row against a ground-truth register, which is exactly what the Invoice Pipeline Audit Harness does.