• Home
  • /
  • Blog
  • /
  • Public OCR API Specification

Public OCR API Specification


Die Public OCR API Specification finden Sie auch auf Postman: https://www.postman.com/rs-public

Supported Requests

Parse a document in language and retrieve text including PDF/A

The Public OCR API Definition (POAD) defines the interface of how OCR services can be queried to retrieve requested results.

It's independent of a concrete implementation, even if there is one open source docker variant available.

That's why the endpoint is the primary variable, which defines, which service should be queried. For testing purposes also a sandbox installation is available (refer https://royal-software.de/email-ocr/).

Furthermore the API Version is part of each request.

When starting with POAD the initial (and current) version is: 1.0.0

As soon as changes are available, it will be described here.

The requests are done with a multipart/form-data HTTP request. The interface returns a JSON for each request, if the Accept Header is set to 'application/json'.

Otherwise HTML views will be rendered, to also provide a user-friendly alternative.

POST

Perform parseRequest

{{endpoint}}/ocr/{{api_version}}/parseDocument

If a file is attached, the request will work. This is the most basic request available, which just retrieves:

  • endpoint
  • api version
  • binary file
  • fromPage (optional: if the parsing should not start from page 1, which is the default)
  • toPage (optional: if not all pages should be parsed)
  • language (optional)

And returns a JSON in the following format: { "pages": [ { "page": 1, "content": "Dear Sirs or Madames,\n ..." }, { "page": 2, "content": "Furthermore its important that ..." } ] }

Request Headers

Accept


Body form-data

language


file


application/json



{{language}}
Defines the ISO/639-1 language (de, en, fr, ...) for the document


/Users/philpro/Downloads/demo-image.png
The file (image or PDF), which should be parsed.


Parse a document in language and retrieve text information

This request will return a PDF/A file (base64 encoded) additionally to the recognized text.

The result file represents the original file but with an additional invisible text layer.

This makes it possible to copy&paste the recognized text on top of the original scanned image.

It needs nearly the same parameters as the request, which will only return the text, but one additional boolean parameter:

  • endpoint
  • api version
  • binary file
  • returnPdf=true
  • language (optional)

And returns a JSON in the following format: { "pages": [...], "Pdfa": "AEd..." }

POST

Perform parseRequest and retrieve PDF/A result file

{{endpoint}}/ocr/{{api_version}}/parseDocument

Make things easier for your teammates with a complete request description.

Request Headers

Accept


Body form-data

language


file


returnPdf


application/json



{{language}}
Defines the ISO/639-1 language (de, en, fr, ...) for the document


/Users/philpro/Downloads/demo-image.png
The file (image or PDF), which should be parsed.


true
Indicates, that result PDF should be returned within the response


Wir lassen Ihre Ziele real werden