Content Management and Capture

 View Only

Automation Document Processing API Introduction

By XUE XU posted Sun March 27, 2022 06:06 AM


Automation Document Processing provides the capabilities that help you build an AI-powered data enrichment tool for document processing and storage.

ADP API offers document uploading, status checking, downloading JSON output or pdf file and delete document.. Customer could extract desired information from complex electronic document automatically with these APIs.

ADP API is asynchronous, user could send next request immediately without waiting response of current request. For example, when user uploads a document to ADP via API, he does not need to wait online for the progressing complete. Instead, he could continue to work on other documents. .

How to send an ADP API? Let’s talk about it. Note: this applies to CP4BA 21.0.3 and later release, which turns to Zen front door for authentication.

  • Host and URL
<zen host>/adp/aca/v1/projects/<ca project id>/<api endpoint>
For example:
  •  Authentication header
    • A Zen API key is necessary, encode it with username using base64:
         <username>:<api key> => <Base64 encoded>
         The API key is generated from Zen home page:

  • Then add prefix ‘ZenApiKey:
Authorization: ZenApiKey <encoded value>

Following are API examples for uploading document, getting status, getting document json, getting document pdf and deleting document.
  • Upload document
Endpoint: /v1/projects/<project_id>/analyzers
It’s a POST request, accept multiple data in request body, here introduce 3 common fields: “responseType”, “jsonOptions” and “file”.
    • file: file path and name. For example, file=@/Users/xuxue/files/invoice/APT002.pdf
    • responseType: output file format after process, it’s multiple choices. For example, "responseType=json,pdf"
    • jsonOptions: is required if JSON is provided in “responseType”, means which options will include in output json file. If select “kvp”, “dc” must be selected too. For example, "jsonOptions=dc,kvp"
    • Sample with curl command:
Curl -k -X POST ""\
 -H "Authorization: ZenApiKey Y2VhZG1pbjpKSFRhOUJMWVpRWWIyV0tBRnh5Y2RvdmVJS01IRTlTcDlrQlZUR0dB"\
 -F "responseType=json,pdf"\
 -F "jsonOptions=dc,kvp"\
 -F "file=@/Users/xuxue/files/invoice/sonyinvoice.pdf"
  • Get file status
Endpoint: /v1/projects/<project_id>/analyzers/<file_id>
    • It’s GET request, after upload document, user don’t wait for complete, but use this API to get status. The file id is from response of upload document request API.
    • Sample with curl command:
curl -k -X GET ""\
 -H "Authorization: ZenApiKey Y2VhZG1pbjpKSFRhOUJMWVpRWWIyV0tBRnh5Y2RvdmVJS01IRTlTcDlrQlZUR0dB"
  • Get json
Endpoint: /v1/projects/<project_id>/analyzers/<file_id>/json
    • It’s GET request, if select “json” in responseType, after process complete, user could get json content with this API. Returned json content may be large, could save it to a file.
    • Sample with curl command:
curl -k -X GET ""\
 -H "Authorization: ZenApiKey Y2VhZG1pbjpKSFRhOUJMWVpRWWIyV0tBRnh5Y2RvdmVJS01IRTlTcDlrQlZUR0dB"

    • Delete document
    Endpoint: /v1/projects/<project_id>/analyzers
      • It’s DELETE request. Use for delete a document.
      • Sample with curl command:
    curl -k -X DELETE ""\
     -H "Authorization: ZenApiKey Y2VhZG1pbjpKSFRhOUJMWVpRWWIyV0tBRnh5Y2RvdmVJS01IRTlTcDlrQlZUR0dB"

    Guide for ADP API: