How to use API?

How to use this API?


I understand nothing from this tutorial. Suppose I want to connect to

So what URL will be? Where to enter ApplicationId and Password

Image should be send in body (post)?



I tried, tried and somewhere found that url is:

As a result I get JSON but how to get result!?

I do not get andy url as written here:

Just some taskID. What should I do with that?

Why such simple things are so complicated?!




  • Avatar
    Koen de Leijer


    I was waiting for an answer for your previous question


    until I saw these two new ones.




    It should not be that hard after all with Python, please follow these steps:

    Then tell me what output you get after step "5"

    Or have a look at another sample from ABBYY



    Best regards

    Koen de Leijer


    Comment actions Permalink
  • Avatar

    Your answer is not to the point. I ask about http API.

    I started with Python but since this code is not handling errors I decided to use http protocol. Forgive me but your API tutorial is complete mess. As API user I always start from authorization (not even word about that in main tutorial). Then I'd like to know what each method returns and how to read it. Nothing about this. In next level tutorial I have info that 'processImage' method returns URL. Not true - there is no url in result JSON.


    BWT each post starts with 'Error creating post'. Have to click at least twice to post (sometimes page reload needed)


    Comment actions Permalink
  • Avatar

    I send image in POST to url:

    In result I get the answer:


    Then I use method:

    BUT I get error:

    {"taskId":"1cxxxxc0-cbfe-4b64-ae57-7a46f6682f1","registrationTime":"2019-12-19T16:19:00Z","statusChangeTime":"2019-12-19T16:19:01Z","status":"ProcessingFailed","error":"Internal error","filesCount":1,"requestStatusDelay":0}


    Comment actions Permalink
  • Avatar
    Koen de Leijer

    Due to circumstances I was not able to respond earlier.
    Keep in mind that I am not related to ABBYY and am I volunteering in helping on this forum.
    Here I have a working example (relying on ):

    A wrapper that needs your parameters (see ....AS_PROVIDED) from ABBYY:

    from ABBYY import CloudOCR

    class ABBYYWrapper(object):

        def __init__(self, pdf_):
            self._pdf = pdf_
            self._language = 'en'
            self._exportFormat = 'pdfSearchable'
            self._cloudurl = 'ABBYY_CLOUD_URL_AS_PROVIDED'
            self._cloudapplicationid = 'ABBYY_CLOUD_ID_AS_PROVIDED'
            self._cloudpassword = 'ABBYY_CLOUD_PASSWORD_AS_PROVIDED'

        def process_and_download(self):
            Performs the OCR on the PDF via the Cloud

            # set file-pointer to first byte of the file

            # create a dictionary holding  the PDF
            post_file = {'ocred_pdf':}

            # get handle to ABBYYs CloudOCR
            ocr_engine = CloudOCR(

            # override URL of ABBYYs CloudOCR
            ocr_engine.base_url = self._cloudurl

            # process the PDF and download/return the result
            result = ocr_engine.process_and_download(
            return result

    The wrapper can be called like:

    from io import BytesIO

    from .abbyy import ABBYYWrapper

    def perform_ocr(file_obj, settings, pdf_process_option):
        """Peforms OCR on PDF with ABBYY.

        :param file_obj: a file object open for reading.
        :return: a file object open for reading contained OCRed PDF.

        ocr_engine = ABBYYWrapper(file_obj, settings, pdf_process_option)
        ocr_result = ocr_engine.process_and_download()

        if not ocr_result:
            raise Exception("No stream found by OCR engine")
        elif len(ocr_result) > 1:
            raise Exception("Multiple streams found by OCR engine")
        return [value for value in ocr_result.values()][0]

    def get_ocred_pdf(file_obj):
        with perform_ocr(file_obj) as f:
            ocr_data =
        return BytesIO(ocr_data)

    In my case it will convert a scanned PDF to a searchable PDF.

    Comment actions Permalink

Please sign in to leave a comment.