How to use Eagle Doc Finance OCR API

Eagle Doc's Finance OCR simplifies gathering important details from images or scans of both receipts and invoices, making your receipt and invoice app work smoother. Plus, you don't have to worry about managing different endpoints—the Finance API takes care of everything for you.

We consistently enhance the performance of our algorithm. While the interface remains unchanged, there will be no increments in the API version. However, you may observe distinct version numbers within the 'version' field of the JSON response.

Server

We currently operate one server in Frankfurt, Germany. This server is supported by a load balancer, allowing it to scale smoothly based on the workload. If you require a dedicated server or specific location, please get in touch with us.

alternative



Finance Processing Endpoints




Finance API version 1 (v1)

This endpoint converts receipt or invoice images into structure information in JSON format.

Parameters
Name Description
api-key (header) API key which you will receive with your subscription here
file (form-data) File of the receipts or invoices. To be sent in the body as form-data with the key 'file'. If the document has multiple pages, you can attach them all as separate image files (supported image formats include: png, jpg, tif) or as a PDF.
❗ Important: The API does not support batch processing of multiple finance documents in one API call. Please call for each finance document the endpoint separately. Or use the batch processing endpoint for batch processing.
privacy (query parameter) Boolean (true, false) to indicate if the uploaded file is stored on the server to further enhance the algorithm or not. 'true' means that the file is not stored, 'false' means that the file is stored. The default value is false. To change, you can set it: &privacy=true
polygon (query parameter) Boolean (true, false) to indicate if you want to receive coordinate information of the extracted data. The data provides you with the ability to draw polygons around the extracted text on the input file. The default value is false. To change, you can set it: &polygon=true
fullText (query parameter) Boolean (true, false) to indicate if you want to receive the full text of the extracted data. The data will be an array of strings per page (in case of multiple pages of the receipt/invoice). The data can be used for example to make receipts/invoices searchable in your database. The default value is false. To change, otherwise you can set it: &fullText=true
Responses
Code Description
200 OK is returned to indicate that the receipt/invoice was processed successfully.

The retrieved data is presented in the form of a JSON structure comprising several distinct fields. The below explanation provides further details. It's important to note that the resultant structure exclusively encompasses the detected or available data, implying that not all fields within the JSON structure will be included in the output.
Field Name Description
docType Type of the document: Receipt, Invoice, CreditMemo, DebitMemo, FinalInvoice, Offer, PartialInvoice, PastdueInvoice, ProformaInvoice
general Summarizes general information about the receipt/invoice, which includes an array of key-value pairs.
Possible keys can be: ShopName, ShopStreet, ShopHouseNumber, ShopCity, ShopZip, ShopState, ShopCountry, ShopTel, ShopEmail, ShopWeb, CustomerName, CustomerCompany, CustomerStreet, CustomerHouseNumber, CustomerCity, CustomerZip, CustomerState, CustomerCountry, Time, InvoiceDate, InvoiceDueDate, DeliveryDate1, DeliveryDate2, InvoiceNumber, OrderNumber, TotalPrice, Tip, Currency, ReverseCharge, Telephone, Email, Fax, Website, POBox, Weee, TaxNumber, VATNumber, CompanyRegistrationNumber, StoreID, TableNr, GroupNr, GuestNr, Transaction, TransactionAuthCode, Terminal, TransactionRef, Cashier, CustomerNr, ItemsNr, DocumentType
productItems Contains an array of the line items. Each line item is an array of key-value pairs.
Possible keys can be: ProductId, ProductName, ProductPrice, ProductUnitPrice, ProductQuantity, ProductUnit, TaxPercentage, TaxLabel, TaxAmount, TaxNetAmount, TaxGrossAmount, IsRefund
taxes Contains an array of tax infos with different tax types. Each tax info is an array of key-value pairs.
Possible keys can be: TaxPercentage, TaxLabel, TaxAmount, TaxNetAmount, TaxGrossAmount
payments This field is to indicate how the transaction has been paid, for example: paypal, Credit card, Debit card and so on. It contains an array of payment infos with different payment types and the possible card number included in the receipt. Each payment info is an array of key-value pairs.
Possible keys can be: PaymentMethod, PaymentCardNumber
paymentBanks This field is to indicate how the invoice can been paid through banks with the bank name, BIC and IBAN. It contains an array of payment banks with BankName, BIC and IBAN. Each payment info is an array of key-value pairs.
Possible keys can be: BankName, BIC, IBAN
performanceOption Indicates which algorithm was used for processing the receipt. At the moment there is 'ACCURACY' and 'FALLBACK' available. 'FALLBACK' indicates that our algorithm encountered challenges while processing the receipt, therefore it provides basic information.
fileHash MD5 hash of the input file. This information can be used to check for duplicates
version Version of the algorithm which was used to process the receipt
pages size information (height and width) of all pages
fullText texts of lines on all pages
languages array of language codes of languages detected in the document
mainLanguage language code of the main language detected in the document

Key-Value pairs
All key value pairs mentioned above have the same format like this:

                                
                                        "key": {
                                            "value": "STRONG FLOUR",
                                            "polygon": {
                                                "p1": {
                                                    "x": 104.0,
                                                    "y": 67.0
                                                },
                                                "p2": {
                                                    "x": 221.0,
                                                    "y": 67.0
                                                },
                                                "p3": {
                                                    "x": 221.0,
                                                    "y": 80.0
                                                },
                                                "p4": {
                                                    "x": 104.0,
                                                    "y": 80.0
                                                }
                                            },
                                            "page": 1,
                                            "confidence": 0.89
                                        }

Inside the value structure, you can find "value": "". The "value" is represented in a format of String no matter it is a number or text. "polygon" is used to indicate the location of the found result on a page of the invoice. "page" is used to indicate the page number where the found result is on, which starts from 1. "confidence" is used to indicate the confidence of the extraction correctness, which is range from 0 to 1. If the input parameter "polygon" in request "/api/finance/v1/processing?polygon=false" set to "false", the polygon information will not be returned. The key-value pair then simplified like this:

                                
                                        "key": {
                                            "value": "STRONG FLOUR",
                                            "page": 1,
                                            "confidence": 0.89
                                        }
403 BadCredentialException is used to indicate that for example the API key is not valid.
404 FileNotFoundException is used to indicate that there is no file found.
405 MethodNotAllowedException: Access to the API not allowed. There are multiple reasons possible: you reached the agreed quota, your contract expired or another internal error. Please contact us if the error persists.
500 InternalServerErrorException is used to indicate that something went wrong. Reason is not known.
Full JSON Example

Request with /api/finance/v1/processing?polygon=true&fullText=true
An example of the whole JSON response of the parsed receipt looks like this (click this link).




To see the usage of your key, go to management endpoint .