Case Study
Automating Physical Invoice Processing with AI
A document-processing platform that converts physical invoices into structured data ready for bulk import into Marangatu.
I built a web application that allows users to upload images of physical invoices, extract their accounting data with AI, review the results, and export them in the format required by Paraguay’s Marangatu tax system.
Context
Although electronic invoicing is increasingly common in Paraguay, many businesses still issue physical invoices. Some are printed, while others are handwritten, which means their information must be entered manually into Marangatu.
Entering each invoice individually took approximately one minute and became repetitive when processing large volumes. This was particularly time-consuming for accounting work involving invoices from multiple clients.
The goal was to reduce manual data entry without removing human validation, especially because image quality and handwritten documents could affect extraction accuracy.
Approach
I developed the backend with Laravel and used Redis queues to process invoices asynchronously. Users can upload up to 20 images at once, while the system groups them into batches of four before sending them to the OpenAI API.
GPT-5 mini analyzes each image and extracts the merchant RUC, issue date, receipt number, invoice number, total amount, 10% VAT, and 5% VAT. It also generates a confidence score based on image clarity and how reliably each required field could be identified.
Turso stores the invoice records and review state, while AWS provides the deployment environment for the application. This kept the workflow responsive while invoice extraction jobs continued running in the background.
The interface displays the original invoice beside the extracted data, allowing users to compare and correct individual fields before exporting. Once reviewed, the invoices are converted into a .txt file using the filename and data structure required by Marangatu.
The main technical challenge was making the AI integration reliable across different invoice formats. I refined the extraction instructions and confidence-score criteria so that clear invoices received high scores while ambiguous or handwritten documents were correctly flagged for closer review.
Outcome
The system has processed more than 1,000 invoices for personal use and for people close to me, including accounting workflows involving multiple clients.
Reviewing a correctly extracted invoice takes approximately five seconds instead of the minute previously required for manual entry. When a correction is needed, the complete review usually takes between 30 and 40 seconds.
The confidence score makes it possible to focus attention on uncertain invoices rather than manually checking every document with the same level of detail. After validation, hundreds of invoices can be imported into Marangatu in a single operation instead of being entered individually.
Stack