Barcode Reader OCR

Mindee’s Barcode Reader OCR API uses deep learning to automatically, accurately, and instantaneously parse your Barcode details. In under a second, the API extracts a set of data from your PDFs or photos of any document, including:

  • Barcodes 1d

  • Barcodes 2d

  • Orientation

The Barcode Reader OCR API supports all kind of documents.

Set up the API

circle-info

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 document including one or multiple barcodes. You can use the sample document provided below.

  1. Access your API by clicking on the Barcode Reader card in the Utilities

  1. From the left navigation, go to documentationarrow-up-right > API Reference, you'll find sample code in popular languages and command line.

  • 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.

circle-exclamation

API Response

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

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)

Extracted barcode data

Using the above barcode example the following are the basic fields that can be extracted.

Barcodes 1D

  • barcodes_1d: This field outputs the usual 1d barcodes like the Code-128 format. The API response includes, beside a confidence score, the position of the barcode on the document as well as the transcribed value, that is hidden behind the barcode.

Barcodes 2D

  • barcodes_2d: This field outputs the usual 2d barcodes like the QR-Code format. The API response includes, beside a confidence score, the position of the barcode on the document as well as the transcribed value, that is hidden behind the barcode. As seen in the example, it is no issue to output multiple barcodes of the same kind on the same document. This goes of course for the 1d barcodes as well.

Orientation

  • orientation: Classification indicating the possible rotation of the image. Possible values are:

    • 0

    • 90

    • 270 Images with a rotation of 180 degrees are not supported.

Last updated

Was this helpful?