Bank Account Details OCR

This Bank account details OCR is currently available only for French bank account documents.

Mindee’s Bank account details OCR API uses deep learning to automatically, accurately, and instantaneously parse data from French RIB (Relevés d'identité Bancaire).

It takes the API a few seconds to extract data from your PDFs or photos of bank account details or RIB. The API extracts the following data:

  • Account holder's names

  • IBAN

  • BBAN (Bank code, branch code, number and key)

  • Swift

Set up the API

Create an API key

To begin using the Mindee V1 OCR API, your first step is to create your V1 API key.

  1. You'll need a bank account details document or RIB. You can use the sample provided below.

  2. Access your Bank Account Details API by clicking on the Bank Account Details card in the Document Catalog.

  3. From the left navigation, go to documentation > API Reference, to find sample code in popular languages and command line.

from mindee import Client, PredictResponse, product

# Init a new client
mindee_client = Client(api_key="my-api-key-here")

# Load a file from disk
input_doc = mindee_client.source_from_path("/path/to/the/file.ext")

# Load a file from disk and parse it.
# The endpoint name must be specified since it cannot be determined from the class.
result: PredictResponse = mindee_client.parse(product.fr.BankAccountDetailsV2, input_doc)

# Print a summary of the API result
print(result.document)

# Print the document-level summary
# print(result.document.inference.prediction)
  • Replace my-api-key-here with your new API key, or use the select an API key feature and it will be filled automatically.

  • Copy and paste the sample code of your desired choice in your application, code environment, terminal etc.

  • Replace /path/to/the/file.ext with the path to your input document.

  1. Run your code. You will receive a JSON response with the Bank Statement information.

API Response

Below is the full sample JSON response you get when you call the API. Since the response is quite verbose, we will walk through the fields section by section.

{
  "api_request": {
    "error": {},
    "resources": [
      "document"
    ],
    "status": "success",
    "status_code": 201,
    "url": "https://api.mindee.net/v1/products/mindee/bank_account_details/v2/predict"
  },
  "document": {
    "id": "65383b84-39ce-4aad-8980-3f15589dda5b",
    "name": "bank_account_details_sample.jpg",
    "n_pages": 1,
    "is_rotation_applied": true,
    "inference": {
      "started_at": "2023-06-16T13:22:40.382074",
      "finished_at": "2023-06-16T13:22:41.498981",
      "processing_time": 1.117,
      "pages": [
        {
          "id": 0,
          "orientation": {"value": 0},
          "prediction": { .. },
          "extras": {}
        }
      ],
      "prediction": { .. },
      "extras": {}
    }
  }
}

You can find the prediction within the prediction key found in two locations:

  • In document > inference > prediction for document-level predictions: it contains the different fields extracted at the document level, meaning that for multi-pages PDFs, we reconstruct a single passport object using all the pages.

  • In document > inference > pages[ ] > prediction for page-level predictions: it gives the prediction for each page independently. With images, there is only one element on this array, but with PDFs, you can find the extracted data for each PDF page.

Each predicted field may contain one or several values:

  • a confidence score

  • a polygon highlighting the information location

  • a page_id where the information was found (document level only)

{
 "prediction": {
   "account_holders_names": {
     "confidence": 0.98,
     "page_id": 0,
     "polygon": [[0.046, 0.841],[0.19, 0.841],[0.19, 0.858],[0.046, 0.858]],
     "value": "MR OLIVIER CESAR"
    },
    "bban": {
      "bban_bank_code": "12345",
      "bban_branch_code": "12345",
      "bban_key": "16",
      "bban_number": "1234567891A",
      "confidence": 0.56,
      "page_id": 0,
      "polygon": [[0.122, 0.616],[0.44, 0.616],[0.44, 0.754],[0.122, 0.754]]
    },
    "iban": {
      "confidence": 0.99,
      "page_id": 0,
      "polygon":  [[0.122, 0.74],[0.384, 0.74],[0.384, 0.754],[0.122, 0.754]],
      "value": "FR8412345123451234567891A16"
    },
    "swift": {
      "confidence": 0.95,
      "page_id": 0,
      "polygon":[[0.628, 0.738],[0.809, 0.738],[0.809, 0.754],[0.628, 0.754]],,
      "value": "PSSTFRPPMAR"
    }
  }
 }

Detailed Field Information

Depending on the field type specified, additional attributes can be extracted from the bank account details object. Using the above RIB example, the following are the basic fields that can be extracted.

Account holder name

  • account_holders_names: In the JSON response below, we have the value of the account holder's names outputted as a single string including civilities.

{
   "account_holders_names": {
     "confidence": 0.98,
     "page_id": 0,
     "polygon": [[0.046, 0.841],[0.19, 0.841],[0.19, 0.858],[0.046, 0.858]],
     "value": "MR OLIVIER CESAR"
  }
}

BBAN

  • bban: In the JSON response below we have the list of values of the bban. For French Bank Account Details only.

    • bban_bank_code: The bank code outputted as a string.

    • bban_branch_code: The branch code outputted as a string.

    • bban_number: The bban number outputted as a string.

    • bban_key: The BBAN key outputted as a string

{
  "bban": {
    "bban_bank_code": "12345",
    "bban_branch_code": "12345",
    "bban_key": "16",
    "bban_number": "1234567891A",
    "confidence": 0.56,
    "page_id": 0,
    "polygon": [[0.122, 0.616],[0.44, 0.616],[0.44, 0.754],[0.122, 0.754]]
	}
}

IBAN

  • iban: In the JSON response below, we have the value of the IBAN.

{
  "iban": {
    "confidence": 0.99,
    "page_id": 0,
    "polygon":  [[0.122, 0.74],[0.384, 0.74],[0.384, 0.754],[0.122, 0.754]],
    "value": "FR8412345123451234567891A16"
  },
}

swift

  • swift: In the JSON response below, we have the value of the swift code.

{
  "swift": {
      "confidence": 0.95,
      "page_id": 0,
      "polygon":[[0.628, 0.738],[0.809, 0.738],[0.809, 0.754],[0.628, 0.754]],,
      "value": "PSSTFRPPMAR"
  }
}

Last updated

Was this helpful?