Automatically Extracting Receipts Using the Mindee Client Libraries
Overview
Just want to get to the full script? Jump to the relevant section.
When to Use This Feature
Use the Multi-Receipts Detector API when you have:
A single image containing multiple receipts
The need to process each receipt individually without manual separation
A desire to streamline receipt processing workflows
The Multi-Receipts Detector API scans the contents of a file, identifies the coordinates of individual receipts, and allows for their extraction and separate processing.
Prerequisites
Before you begin, ensure you have:
A valid and up-to-date Mindee API key
An active subscription to the Multi-Receipts Detector API
An active subscription to the Receipt OCR API (Also works with the Financial Document OCR API)
The Mindee client library installed for your programming language
Sample File
For this tutorial, we'll use the following sample multi-receipt image:

When preparing your own files, ensure that:
Receipts are clear, unstained, and properly unfolded
Receipts don't overlap and are fully within the image
Receipts are aligned in roughly the same direction
No other types of documents are mixed in with the receipts
Basic Setup
Import the necessary classes from the Mindee library.
Initialize the Mindee client with your API key.
Load the input file.
Processing the Input
Detect Multiple Receipts
Use the Multi-Receipts Detector API to identify individual receipts in the image:
Extract Individual Receipts
Extract the detected receipts from the original image:
Process Each Receipt
Loop through the extracted receipts and process each one with the Receipt OCR API:
Example Output
After processing, you'll receive detailed information about each receipt. Here's a sample output:
Full Script
Best Practices
Handle potential errors and exceptions in your code.
Implement rate limiting or delays between API calls to avoid overloading the server.
Consider saving extracted receipts locally if needed for further processing or record-keeping.
Ensure your input images are of good quality for optimal results.
Troubleshooting
If you encounter issues:
Verify your API key and subscription status for both Multi-Receipts Detector and Receipt OCR APIs.
Check the input file format and ensure it's supported.
Review the API response for any error messages.
Consult the Mindee API documentation for more detailed information.
Next Steps
Explore advanced features of the Mindee API.
Integrate the extracted data into your existing workflows.
Consider implementing batch processing for large volumes of receipts.
Last updated
Was this helpful?

