Build an ASP.NET Core API for Intelligent Invoice Extraction Using Vision AI

Create an ASP.NET Core endpoint that extracts invoice fields and places uncertain documents in a review queue.

Architecture

Authenticated upload → file screening → invoice model → validation → review

Workflow and system boundaries

Prerequisites and configuration

Set request and page limits, verify MIME signatures, and store uploads under generated private object names. Hash the bytes for tenant-scoped deduplication and pass the file through a scanning step. Use the supported Document Intelligence prebuilt invoice model with a managed identity or protected credential. For long-running jobs, return an accepted response with a scoped job ID.

Implementation

Map invoice ID, vendor, date, currency, subtotal, tax, total and line items into an application DTO. Preserve field confidence and source region. Use decimal amounts, compare totals within the correct currency tolerance, and leave missing values null. Send low-confidence bank details and arithmetic mismatches to humans before any financial use.

Implementation example

{"currency":"USD","subtotal":100.00,"tax":8.25,"total":108.25}

Testing and troubleshooting

Test a valid synthetic invoice, an invalid file, a double upload, an invoice with no currency and an invoice with ambiguous decimal separators. Verify source access is tenant-bound and that logs emit job status without account numbers. Store source documents for a policy-defined retention period.

Frequently asked question

Can the API book or pay invoices automatically?

This workflow extracts and validates a draft. Payment follows the organization’s approved accounting workflow.

Official documentation

Comments