# Financial Documents OCR

## Overview

The Financial Document API is ideal for applications where you might receive both invoices and receipts and want a single integration point. The core functionality of this API involves a two-step process:

1. **Document Classification:** Upon receiving a document, the API first analyzes it to determine whether it is an invoice or a receipt.
2. **Intelligent Routing:** Based on the classification, the document is then automatically routed to the appropriate underlying API for detailed information extraction.

This approach simplifies your integration by eliminating the need to pre-classify documents on your end and choose which specific API to call.

## Underlying APIs

The Financial Document API leverages the capabilities of our dedicated Invoice and Receipt APIs. Once a document is classified, it is processed by one of these APIs. You can find their respective documentation here:

* [Invoice API Documentation](https://docs.mindee.com/v1/off-the-shelf-products/invoice-ocr)
* [Receipt API Documentation](https://docs.mindee.com/v1/off-the-shelf-products/receipt-ocr)

Understanding the specific functionalities and responses of these underlying APIs can be helpful when working with the Financial Document API.

## Financial Documents Data Fields Summary

### Field-by-Field Explanation

This section provides details about specific fields within the Financial Document API response and highlights how their behavior **might differ based on whether the processed document was classified as an invoice or a receipt.**

### Category & Subcategory

The `category` field in the API response provides information about the type of the financial document. However, its interpretation **depends on the document type:**

* **Invoice:** For documents classified as invoices, the category field \*\*will always return \*\*the value `miscellaneous`. This is because our primary invoice processing focuses on extracting key financial details rather than granular categorization.
* **Receipt:** For documents classified as receipts, the category field reflects the output of our dedicated receipt categorization model. This model analyzes the receipt content to determine the specific category (e.g., `toll`, `food`, `parking`, `transport`, `accommodation`, `gasoline`, `telecom`, `miscellaneous`.).

### Due Date

The `due_date` field represents the expected payment date for a financial document. However, its source and meaning differ slightly between invoices and receipts:

* **Invoice:** For invoices, the `due_date` field accurately reflects the **actual due date** explicitly stated on the invoice document. Our system extracts this information to provide you with the correct payment deadline.
* **Receipt:** Receipts generally do not have a concept of a formal "due date." In the context of our Financial Document API, when a receipt is processed, the **date of the transaction** (the date printed on the receipt) is copied into the `due_date` field. This is done to maintain consistency across the API response structure. Therefore, for receipts, the `due_date` essentially represents **the transaction date, not a payment deadline.**
