Licenses plate OCR

Mindee's bank check OCR API uses deep learning to automatically, accurately, and instantaneously parse data from paper and digital US bank checks. It takes the API a few seconds to extract data from your PDFs or photos of your bank checks. The API extracts the following data:

  • Account Number
  • Amount
  • Check Number
  • Check Position
  • Date
  • Payees
  • Routing number
  • Signature Position

📘

Before making any API calls, you need to have created your API key.

Set up the API

  1. You'll need a bank check. You can use the sample US bank check provided below.
1518
  1. Access your Bank Checks API by clicking on the Bank Checks card in the APIs Store
2842

API store

  1. From the left navigation, go to documentation > API Reference, you'll find sample code in popular languages and command line.
3002
curl -X POST \
  https://api.mindee.net/v1/products/mindee/bank_check/v1/predict\
  -H 'Authorization: Token my-api-key-here' \
  -H 'content-type: multipart/form-data' \
  -F document=@/path/to/your/file.png
from mindee import Client
  
my_client = Client().config_custom_doc(
    document_type="bank_check",
    singular_name="custom_doc",
    plural_name="custom_docs",
    account_name="Mindee",
    api_key="my-api-key-here"
)

my_doc = my_client.doc_from_path("/path/to/doc.pdf")

parsed_doc = my_doc.parse("bank_check")
// works for NODE > v10
const axios = require('axios');
const fs = require("fs");
const FormData = require('form-data')

async function makeRequest() {
    let data = new FormData()
    data.append('document', fs.createReadStream('./file.jpg'))
    const config = {
        method: 'POST',
        url: 'https://api.mindee.net/v1/products/mindee/bank_check/v1/predict',
        headers: { 
        'Authorization':'Token my-api-key-here',
        ...data.getHeaders()
            },
        data
    }

    try {
        let response = await axios(config)
        console.log(response.data);
    } catch (error) {
        console.log(error)
    }

}

makeRequest()
# tested with Ruby 2.5
require 'uri'
require 'net/http'
require 'net/https'
require 'mime/types'

url = URI("https://api.mindee.net/v1/products/mindee/bank_check/v1/predict")
file = "/path/to/your/file.png"

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Token my-api-key-here'
request.set_form([['document', File.open(file)]], 'multipart/form-data')

response = http.request(request)
puts response.read_body
<form onsubmit="mindeeSubmit(event)" >
    <input type="file" id="my-file-input" name="file" />
    <input type="submit" />
</form>

<script type="text/javascript">
    const mindeeSubmit = (evt) => {
        evt.preventDefault()
        let myFileInput = document.getElementById('my-file-input');
        let myFile = myFileInput.files[0]
        if (!myFile) { return }
        let data = new FormData();
        data.append("document", myFile, myFile.name);

        let xhr = new XMLHttpRequest();

        xhr.addEventListener("readystatechange", function () {
            if (this.readyState === 4) {
                console.log(this.responseText);
            }
        });

        xhr.open("POST", "https://api.mindee.net/v1/products/mindee/bank_check/v1/predict");
        xhr.setRequestHeader("Authorization", "Token my-api-key-here");
        xhr.send(data);
    }
</script>
  • 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, or terminal.
  • Replace /path/to/my/file with the path to your bank check.

❗️

Always remember to replace your API key!

  1. Run your code. You will receive a JSON response with the receipt details.

API Response

Here is the full JSON response you get when you call the API:

{
  "api_request": {
    "error": {},
    "resources": [
      "document"
    ],
    "status": "success",
    "status_code": 201,
    "url": "https://api.mindee.net/v1/products/mindee/bank_check/v1/predict"
  },
  "document": {
    "id": "cc875b84-e83e-4799-aabe-4b2c18f44b27",
    "name": "test_dummy.jpg",
    "n_pages": 1,
    "is_rotation_applied": true,
    "inference": {
      "started_at": "2022-09-06T16:37:28+00:00",
      "finished_at": "2022-09-06T16:37:29+00:00",
      "processing_time": 1.121,
      "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 receipt 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_number": {
          "confidence": 0.99,
          "polygon": [[0.51, 0.699], [0.632, 0.699],[0.51, 0.699], [0.632, 0.727], [0.51, 0.727]],
          "value": "7789778136"
        },
        "amount": {
          "confidence": 0.73,
          "polygon": [[0.51, 0.699], [0.632, 0.699],[0.51, 0.699], [0.632, 0.727], [0.51, 0.727]],
          "value": 15332.9
        },
        "check_number": {
          "confidence": 0.99,
          "polygon": [[0.258, 0.688], [0.343, 0.688], [0.343, 0.715], [0.258, 0.715]],
          "value": "0003401"
        },
        "check_position": {
          "bounding_box": [
            [0.111, 0.273],
            [0.947, 0.273],
            [0.947, 0.781],
            [0.111, 0.781]
          ],
          "polygon": [
            [0.117, 0.486],
            [0.117, 0.279],
            [0.127, 0.273],
            [0.164, 0.273],
            [0.309, 0.273],
            [0.348, 0.279],
            [0.492, 0.281],
            [0.52, 0.287],
            [0.789, 0.289],
            [0.947, 0.299],
            [0.938, 0.529],
            [0.938, 0.674],
            [0.932, 0.779],
            [0.881, 0.787],
            [0.842, 0.775],
            [0.719, 0.764],
            [0.492, 0.764],
            [0.223, 0.748],
            [0.141, 0.75],
            [0.113, 0.732],
            [0.121, 0.686]
          ],
          "quadrangle": [
            [0.128, 0.274],
            [0.947, 0.299],
            [0.931, 0.78],
            [0.112, 0.747]
          ],
          "rectangle": [
            [0.127, 0.272],
            [0.945, 0.299],
            [0.93, 0.779],
            [0.111, 0.753]
          ]
        },
        "date": {
          "confidence": 0.99,
          "polygon": [[0.787, 0.381], [0.865, 0.381], [0.865, 0.402], [0.787, 0.402]],
          "raw": ["03-29-2022"],
          "value": "2022-03-29"
        },
        "orientation": {
          "confidence": 0.99,
          "degrees": 0
        },
        "payees": [
          {
            "confidence": 0.76,
            "polygon": [[0.206, 0.567], [0.35, 0.567], [0.35, 0.587], [0.206, 0.587]],
            "value": "JOHN DOE"
          },
          {
            "confidence": 0.76,
            "polygon":  [[0.206, 0.567], [0.35, 0.567], [0.35, 0.587], [0.206, 0.587]],
            "value": "JANE DOE"
          }
        ],
        "routing_number": {
          "confidence": 1,
          "polygon": [[0.458, 0.688], [0.343, 0.688], [0.343, 0.715], [0.458, 0.715]],
          "value": "063608668"
        },
        "signatures_positions": [
          {
            "bounding_box": [
              [0.734, 0.631],
              [0.842, 0.631],
              [0.842, 0.682],
              [0.734, 0.682]
            ],
            "polygon": [
              [0.779, 0.652],
              [0.76, 0.627],
              [0.768, 0.627],
              [0.844, 0.66],
              [0.824, 0.674],
              [0.738, 0.68]
            ],
            "quadrangle": [
              [0.758, 0.632],
              [0.84, 0.664],
              [0.834, 0.673],
              [0.736, 0.68]
            ],
            "rectangle": [
              [0.754, 0.629],
              [0.84, 0.662],
              [0.821, 0.713],
              [0.734, 0.68]
            ]
          }
        ],

Additional Attributes

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

Account Number

  • account_number: In the JSON response below, we have the account number of the issuer.
{
  "account_number": {
    "confidence": 0.99,
    "page_id": 0,
    "polygon": [[0.51, 0.699], [0.632, 0.699],[0.51, 0.699], [0.632, 0.727], [0.51, 0.727]],
    "value": "7789778136"
  }
}

Amount

  • amount: In the JSON response below, we have the bank check amount transferred from the issuer to the recipient.
{
  "amount": {
    "confidence": 0.73,
    "page_id": 0,
    "polygon": [[0.51, 0.699], [0.632, 0.699],[0.51, 0.699], [0.632, 0.727], [0.51, 0.727]],
    "value": "15332.9"
  }
}

Check Number

  • check_number: In the JSON response below, we have the bank check number.
{
  "check_number": {
    "confidence": 0.99,
    "page_id": 0,
    "polygon": [[0.258, 0.688], [0.343, 0.688], [0.343, 0.715], [0.258, 0.715]], 
    "value": "0003401"
  }
}

Check Position

  • check_position: In the JSON response below, we have the position of the check information.
{
      "check_position": {
        "bounding_box": [
          [0.111, 0.273],
          [0.947, 0.273],
          [0.947, 0.781],
          [0.111, 0.781]
        ],
         "polygon": [
           [0.117, 0.486],
           [0.117, 0.279],
           [0.127, 0.273],
           [0.164, 0.273],
           [0.309, 0.273],
           [0.348, 0.279],
           [0.492, 0.281],
           [0.52, 0.287],
           [0.789, 0.289],
           [0.947, 0.299],
           [0.938, 0.529],
           [0.938, 0.674],
           [0.932, 0.779],
           [0.881, 0.787],
           [0.842, 0.775],
           [0.719, 0.764],
           [0.492, 0.764],
           [0.223, 0.748],
           [0.141, 0.75],
           [0.113, 0.732],
           [0.121, 0.686]
        ],
         "quadrangle": [
           [0.128, 0.274],
           [0.947, 0.299],
           [0.931, 0.78],
           [0.112, 0.747]
        ],
         "rectangle": [
           [0.127, 0.272],
           [0.945, 0.299],
           [0.93, 0.779],
           [0.111, 0.753]
         ]
 },

Date

  • date: In the JSON response below, we have the date the bank check was written.
{
  "date": {
    "confidence": 0.99,
    "page_id": 0,
    "polygon": [[0.787, 0.381], [0.865, 0.381], [0.865, 0.402], [0.787, 0.402]],
    "raw": ["03-29-2022"],
    "value": "2022-03-29"
  }
}

Orientation

  • orientation: The orientation field is only available at the page level as it describes whether the page image should be rotated to be upright. The rotation value is also conveniently available in the JSON response at:
    document > inference > pages [ ] > orientation > value.
    If the page requires rotation for correct display, the orientation field gives a prediction among these 3 possible outputs:
    • 0 degree: the page is already upright
    • 90 degrees: the page must be rotated clockwise to be upright
    • 270 degrees: the page must be rotated counterclockwise to be upright
{
  "orientation": {
    "confidence": 0.99,
    "degrees": 0
  }
}

Payees

  • payees: In the JSON response below, we have the bank check's recipient's full name.
{
  "payees": [
    {
      "confidence": 0.76,
      "page_id": 0,
      "polygon": [[0.206, 0.567], [0.35, 0.567], [0.35, 0.587], [0.206, 0.587]],
      "value": "JOHN DOE"
    },
    {
      "confidence": 0.76,
      "page_id": 0,
      "polygon": [[0.206, 0.567], [0.35, 0.567], [0.35, 0.587], [0.206, 0.587]],
      "value": "JANE DOE"
    }
  ]
}

Routing Number

  • routing_number: In the JSON response below, we have the unique, nine-digit number that functions as an address for your bank.
{
  "routing_number": {
    "confidence": 1,
    "polygon": [[0.458, 0.688], [0.343, 0.688], [0.343, 0.715], [0.458, 0.715]],
    "value": "063608668"
  }
}

Signature Position

  • signature_position: In the JSON response below, we have the position of the issuer's signature on the check.
{
        "signatures_positions": [
          {
            "bounding_box": [
              [0.734, 0.631],
              [0.842, 0.631],
              [0.842, 0.682],
              [0.734, 0.682]
            ],
            "polygon": [
              [0.779, 0.652],
              [0.76, 0.627],
              [0.768, 0.627],
              [0.844, 0.66],
              [0.824, 0.674],
              [0.738, 0.68]
            ],
            "quadrangle": [
              [0.758, 0.632],
              [0.84, 0.664],
              [0.834, 0.673],
              [0.736, 0.68]
            ],
            "rectangle": [
              [0.754, 0.629],
              [0.84, 0.662],
              [0.821, 0.713],
              [0.734, 0.68]
            ]
  }