The problem
The client is a logistics and freight brokerage working with dozens of carriers, each of which invoices differently: some send structured EDI documents, some send PDFs from wildly different billing systems, and a few still fax or email scanned paper invoices. Their six-person accounts-payable team was manually keying line items from every invoice into the ERP system and cross-checking them against the rate agreement and shipment record. The work scaled roughly linearly with shipment volume, and as the company grew it was becoming the team's full-time job rather than one part of it.
The team wasn't slow because of a skills gap; the work itself was tedious and error-prone. A misread line-haul rate or an overlooked accessorial charge could mean overpaying a carrier by a few hundred dollars, small individually but adding up across thousands of invoices a month. Leadership wanted automation, but was explicit that an automatic wrong payment was a worse outcome than the current manual process, however slow.
What we actually did
We built a pipeline that ingests invoices in every format the client receives, extracts line items, validates them against the shipment record and rate agreement, and auto-processes anything that passes cleanly. Everything else goes to a human reviewer with the specific discrepancy flagged.
Weeks 1-2: cataloging the actual format variety, not assuming it
We pulled three months of historical invoices from all of the client's active carriers and found 41 distinct format variants across structured EDI, PDF, and scanned formats. That was more than the AP team had estimated, because a few carriers had quietly changed their invoice templates mid-year without anyone noticing. Building extraction against this real variety, rather than the handful of formats that came to mind first, shaped the rest of the build.
Weeks 3-4: extraction plus validation against two independent sources
Every extracted invoice is validated against two things: the shipment record (does this invoice correspond to a real, expected shipment?) and the carrier's rate agreement on file (does the billed amount match contracted rates, including accessorial charges?). An invoice only auto-processes if it passes both checks within a tight tolerance. Anything outside tolerance, or any invoice with a low-confidence line item, goes to a human reviewer automatically.
Weeks 5-6: exception routing and the reviewer interface
We spent more build time on exception routing and the reviewer interface than on extraction itself. A reviewer's job was now almost entirely the harder cases, so the interface had to show exactly what triggered each exception (which line item, which check failed, by how much). Presenting a full invoice with no guidance would only have moved the manual-review bottleneck, not shrunk it.
Challenges and tradeoffs
- A few carriers' invoice formats changed without notice during the build itself, which we treated as a signal, not a nuisance. Two carriers updated their invoice templates in the middle of our six-week build, breaking extraction logic tuned to their old formats. Rather than treating this as bad luck, we built a format-drift detector that flags when a carrier's invoices start failing extraction at an unusual rate, so future template changes are caught quickly instead of silently degrading accuracy.
- Scanned and faxed invoices from a handful of smaller carriers had real OCR quality problems. A few carriers still send invoices as low-quality scanned faxes, which made OCR error rates for that segment meaningfully higher than for digital PDFs or EDI. We set a stricter auto-processing threshold for this segment instead of one uniform tolerance, accepting a higher review rate for these carriers rather than risking a misread on poor source documents.
- The AP team needed to trust the system before volume would actually shift to it, and that took a deliberate ramp, not a flip of a switch. We ran the pipeline in shadow mode for two weeks. It made its auto-process or route-to-review decision on every real invoice without executing any payment, so the AP team could compare its calls with what they would have done before any real payment ran through it unsupervised.
Results
89% of incoming invoices now auto-process without a human touch, measured across the first two full months of production and all 41 cataloged carrier formats. A follow-up audit found that 0.4% of auto-processed invoices needed a correction afterward, all minor and none involving an overpayment of more than a few dollars. The client's controller considers that acceptable compared with the manual process's own historical error rate.
The AP team's role has shifted from keying line items to reviewing flagged exceptions and handling the carrier relationship issues they surface. The team's lead describes this as a far better use of the team's expertise than data entry, and the team has absorbed continued shipment-volume growth without adding headcount since the pipeline went live.
What we'd do differently
We'd build the format-drift detector in week one rather than reactively, after two carriers' template changes broke extraction mid-build. It became one of the most valuable pieces of the system, catching a third carrier's format change within days of production rollout, and it deserved to be part of the initial design.