Work snippetAI invoice capture
AI supplier invoice capture into Xero bills, with job-code matching and an approval queue
How I would approach about 270 supplier invoices a month for a 22-tech electrical and HVAC business: each email and PDF read by a model, checked for duplicates and price changes, matched to a job and placed in an approval queue before a draft bill is created in Xero.
Work snippet with example figures.
- Area
- AI invoice capture
- Tools
- Xero · ServiceM8 · Jobber · n8n · Airtable
- Typical scope
- US$2,800–4,500
- Timeline
- About 7 weeks · 4 fixed milestones
Problem
What the owner sees
- Supplier bills typed into Xero by hand from PDFs, days after they arrive
- Materials that are not tied to a job, so job costing is wrong
- The same invoice emailed twice and paid twice
- Supplier prices that creep up unnoticed
- An AI tool that posts to the ledger with nobody looking
Reading an invoice is the slow part of accounts payable, and it is work a model can do well. Deciding that the invoice is right, belongs to a job and should be paid is not. The design splits the two: the model reads and proposes, rules check, and a person approves before anything reaches Xero.
| Everyday situation | What goes wrong |
|---|---|
| Invoice arrives as a PDF in an email | Typed into Xero days later, with typos in the amount or date |
| Job number appears only in the email subject | The bill is coded to general materials and job costing misses it |
| Supplier resends with the word Reminder | Entered twice and paid twice |
| Price on the invoice is above the last purchase | Nobody notices until the margin report |
| Supplier statement arrives with the invoices | Statement lines are entered as bills |
| Photo of an invoice taken at an angle | The amount is read wrongly or entered from memory |
| Credit note emailed as an invoice | Posted as a positive bill |
System map
A 22-tech electrical and HVAC business receiving about 270 supplier invoices a month into one accounts mailbox. A part-time bookkeeper enters them in Xero, and the job system is ServiceM8 or Jobber.
The example reads each email and PDF, proposes a Xero bill with a job code, runs the checks and puts the result in an approval queue. The bookkeeper approves, and only then is a draft bill created in Xero.
| Part | What it does |
|---|---|
| Accounts mailbox | A dedicated mailbox for supplier invoices. The workflow reads this mailbox only. |
| n8n workflow | Triage, reading, checks, queue and posting. Every step is logged. |
| Document reader | Text layer first, OCR for scans and photos. |
| Language model | Extracts fields into a fixed schema with a confidence for each value and the text it was read from. |
| Approval queue | An Airtable base where the bookkeeper sees the PDF beside the proposed bill. |
| Xero | Contacts, accounts, tracking categories, bills and attachments. |
| Job list and price history | Open jobs and purchase orders read from the job system, and the last three prices paid for each item. |
How the data moves
- Email arrives
- PDF read
- Fields extracted
- Checks run
- Approval queue
- Draft bill in Xero
- Bookkeeper pays as usual
Rules agreed in writing
Thresholds are set from a test on 60 past invoices with known answers, then written down. A change needs the bookkeeper and the owner to agree.
| Item | Example setting |
|---|---|
| Ready band | Every key field at 0.95 or above and every check passes. One-click approval, still by a person. |
| Review band | Any key field from 0.80 to 0.94, or one soft check fails. The fields in doubt are highlighted. |
| Manual band | Any key field under 0.80, or a hard check fails. Entered by hand with the PDF alongside. |
| Hard checks | Total equals lines plus tax within 0.02. Supplier matched to an existing Xero contact. Not a duplicate. |
| Soft checks | Price more than 5% or US$25 above the average of the last three. Job code unclear. New supplier. |
| Job-code order | Purchase order number, then a job number in the text, then a delivery address matching one open job, then none. |
| Second approval | Over US$5,000, a new supplier or a changed bank detail needs the owner as well. |
| What is created | A draft bill with the PDF attached. Never an authorised bill, a payment or a new contact. |
Flow steps
Ten steps. A step that fails stops that invoice only, and the reason is shown in the queue.
| Step | Trigger | What happens | Result |
|---|---|---|---|
| 1 Receive | New email in the accounts mailbox | Message ID and attachments stored. Logos and signature images under 20 KB ignored. | Intake record |
| 2 Classify | Attachment present | Invoice, credit note, statement or other. Statements and remittances are routed away. | Document type |
| 3 Read | Invoice or credit note | Text layer extracted. OCR if there is none. | Plain text |
| 4 Extract | Text ready | Model fills the schema: supplier, number, dates, lines, tax, total, each with confidence and source text. | Proposed bill |
| 5 Validate | Proposed bill | Arithmetic, tax rates, date sanity and supplier match. | Hard check results |
| 6 Duplicates | Validation done | Supplier and invoice number, then supplier with total and date within 14 days, then file hash. | Duplicate flag or clear |
| 7 Job code | Lines read | Purchase order, job number in text or subject, then delivery address. | Job code with evidence |
| 8 Price check | Lines matched to items | Each unit price compared with the last three purchases. | Variance flags |
| 9 Queue | All checks run | Band assigned and the record placed in the approval queue with the PDF. | Queue item |
| 10 Approve and post | Approver clicks approve | Draft bill created in Xero, PDF attached, price history updated. | Xero bill ID |
Field mapping
The first table is the field mapping into Xero. The second shows how a job code is chosen and how far it is trusted.
| Extracted value | Xero field | Rule |
|---|---|---|
| Supplier name | Contact | Exact match, then close match with the sender domain. Never creates a contact. |
| Invoice number | Invoice number | Kept as printed. Compared after removing spaces and leading zeros. |
| Invoice date and due date | Date and due date | Due date from terms on the contact if the invoice has none. |
| Line description, quantity, unit price | Line item fields | As printed. Item code kept in the description. |
| Tax per line | Tax type | Rate matched to a Xero tax rate by percentage. |
| Account | Account code | Supplier default, or the account used last time for that item. |
| Job code | Tracking category option | Only when the evidence is a purchase order or a job number. |
| Attachment | Original file, unchanged. |
| Evidence found | What it matches | Result |
|---|---|---|
| Purchase order number in the invoice | An open purchase order linked to one job | Job code proposed, high trust |
| Job number in the subject or body | One open job | Job code proposed, high trust |
| Delivery address matches one open job | One open job at that address | Proposed, medium trust, shown as a Review item |
| Delivery address matches several open jobs | Several jobs | No code. The approver chooses from a list. |
| Nothing usable | Nothing | Stock or overhead suggested. The approver confirms. |
Edge cases
These are written as test invoices, taken from real mail where the business allows it.
| Situation | How it is handled |
|---|---|
| Credit note | Created as a supplier credit note draft, never a positive bill |
| Supplier statement | Routed to a statements folder. No bill is created. |
| Bank details change in an email | Flagged to the owner, not processed, and checked by phone on a known number |
| One email with three invoices | Split into three queue items |
| Resent invoice with a different number | Caught by total and date, shown beside the original |
| Foreign currency invoice | Manual band unless the contact is set up in that currency |
| Password-protected PDF | Manual band with a note to ask the supplier |
| Negotiated price below the price list | Approver accepts the variance and records the agreed price with a reason |
| Job already closed | Warning shown. The approver picks another job or overhead. |
| Xero unavailable when approving | One retry, then the item waits. The invoice number is checked first so no bill is created twice. |
Human sign-off and audit trail
The model never approves, pays, creates a contact or changes a bank detail. Approval is a person clicking a button on a record they can see.
| Who | Signs off | When | If nobody acts |
|---|---|---|---|
| Bookkeeper | Ready items, after a glance at highlighted fields | Daily | Items age in the queue and appear on a Friday report |
| Bookkeeper | Review items, after editing the highlighted fields | Daily | Same |
| Bookkeeper | Manual items, entered from the PDF | Daily | Same |
| Owner | Over US$5,000, new suppliers and changed bank details | Within one working day | Item stays in the queue and nothing is posted |
| Operations manager | Accepting a price variance as the new agreed price | Weekly | Variance stays flagged |
| Field | Example |
|---|---|
| Source | Email message ID and received time |
| File | SHA-256 hash of the PDF, page count |
| Extracted values | Each field with its confidence and source text |
| Checks | Each check with PASS, FAIL or WARN |
| Edits | Field, value before, value after, who and when |
| Approval | Approver name, time and band at approval |
| Xero bill | Bill ID, job code and the evidence used |
Data and privacy
Supplier invoices contain bank details and prices. The design sends the model as little as it needs and keeps the rest in your accounts.
| Data | Handling |
|---|---|
| Mailbox | The workflow reads the accounts mailbox only. Processed emails are moved to a folder, not deleted. |
| Bank and card numbers | Masked in the text before it goes to a hosted model. The original stays in the PDF. |
| Model use | A hosted model on terms that do not allow training on your data, or a local model as in snippet 08. Written down at the Audit. |
| Xero access | Connected to your Xero organisation with the scopes the build needs. The workflow has no payment step. |
| Accounts | Mailbox, n8n, Airtable and Xero stay in your accounts. I am added as a user and removed at handover. |
Worked example
The tables below use one month of example figures. They show the shape of the numbers, not a client result.
| Measure | Count |
|---|---|
| Invoices and credit notes received | 268 |
| Not invoices: statements, remittances, marketing | 21 |
| Duplicates caught | 6 |
| Processed | 241 |
| Ready band | 163 |
| Review band | 58 |
| Manual band | 20 |
| Approved as draft bills | 236 |
| Rejected by the approver | 5 |
| Item | Average of last three | This invoice | Change | Result |
|---|---|---|---|---|
| Conduit, 20 mm, 3 m | 14.20 | 15.90 | +12.0% | Over 5%: flagged |
| Breaker, 20 A single pole | 11.80 | 11.80 | +0.0% | Clear |
| Cable, 2.5 mm twin, 100 m | 138.00 | 142.00 | +2.9% | Under 5%: clear |
| Isolator, 63 A | 46.50 | 52.40 | +12.7% | Over 5%: flagged |
Testing and checks
Every check has a written pass condition and fail condition before it is run. A FAIL stops go-live until it is cleared and the check is run again.
| ID | Check | Method | PASS when | FAIL when |
|---|---|---|---|---|
| T1 | Clean PDF | Run ten invoices with a text layer | Fields equal the PDF and band is Ready | Any wrong field in Ready |
| T2 | Photo at an angle | Run a skewed phone photo | Manual band, never Ready | Ready band |
| T3 | Same invoice twice | Send the same email twice | Second one flagged as a duplicate | Two bills possible |
| T4 | Resend with a new number | Same total and date | Flagged beside the original | Not flagged |
| T5 | Total off by 0.03 | Edit a test invoice | Hard check fails, Manual band | Passes |
| T6 | Price up 11% | Change one unit price | Review band, variance highlighted | No flag |
| T7 | Job number in the subject only | Send a test email | Job proposed with the evidence shown | No job or the wrong job |
| T8 | Credit note | Send a supplier credit | Credit note draft | Positive bill |
| T9 | Changed bank details | Send a test email | Flagged to the owner, nothing created | A bill is created |
| T10 | Approve click | Approve one Ready item | One draft bill with the PDF attached | No bill or two bills |
| T11 | 60 past invoices | Run the whole set against known answers | Accuracy per field reported and thresholds agreed | Thresholds set without a result |
Scope and milestones
A fixed scope agreed in writing before anything starts. Each milestone is paid when you sign off its deliverable.
| Area | Included |
|---|---|
| Systems Audit | Review of the accounts mailbox, a month of invoices and the Xero chart and tracking setup, a 45-minute call, written findings and a fixed quote |
| Mailbox intake | Triage, classification and reading of PDFs and photos |
| Extraction and checks | Schema, confidence bands, arithmetic, duplicate and price checks |
| Job-code matching | Purchase order, job number and address rules |
| Approval queue | Airtable queue with the PDF beside the proposed bill |
| Xero posting | Draft bills with attachments, tracking and supplier credits |
| Testing | Eleven checks, including 60 past invoices kept aside |
| Handover | Written SOPs, a recorded handover video and files you own, plus 14 days of fixes after go-live |
| Not included | Tax filing and statutory returns. |
| Also outside the scope | Paying bills or building the bank file. Supplier onboarding. Model and OCR usage fees, billed to you by the vendors. Chart of accounts redesign. |
| Milestone | Deliverable | Timing | Share |
|---|---|---|---|
| M1 Rules and schema | Bands, checks and job-code rules signed, 60 invoices gathered | Weeks 1 to 2 | 25% |
| M2 Reading and checks | Extraction, duplicate and price checks working, T1 to T9 pass | Weeks 3 to 4 | 30% |
| M3 Queue and Xero | Approval queue and draft bills working, T10 and T11 pass | Weeks 5 to 6 | 30% |
| M4 Handover | A week of parallel running, SOPs, handover video, 14 days of fixes | Week 7 | 15% |
Typical scope for this kind of project: US$2,800–4,500
About 7 weeks across 4 fixed milestones. The Systems Audit (US$300, fixed) comes first and confirms the scope.
Describe what is going wrong between your job system and your books, and I will say where I would look first.
Send a short note through the form on the home page. I will reply with where I would start, and whether the US$300 Systems Audit is the right first step.