[1.2] API Reference

Last modified by admin on 2023/04/10 17:45

Introduction

The akaBot Vision API allows you to programmatically access and manage your organization's data and account information.

In this document, you will find an introduction to the API usage from a developer perspective and a reference to all the API objects and methods.

How does the API in akaBot Vision work?

IDP Sequence (1)-Page-1.drawio.png

a. Import Document

The user has to log in to akaBot Vision to get token in the API Key in the Account section below the user's profile section first.                                                                                                              image-20230221102727-1.png

Then user can upload documents manually by calling API Import Document and sending request information (token and files need to be uploaded) to IDP Server then IDP Server will respond the documentIds and document status "Importing" to user. It might take IDP Server 2-3 minutes to process document depending on the document's size. 

b. Get Document Status          

After the processing time, the user kindly re-checks the document's status by calling API Get Document Status and the request information is documentId which has been responded to via API Import Document

  • If the document has the status "Confirmed", it means this document is processed successfully and the user can export data via calling API Export Document with input parameters (Id and exportType)Confirmed.png
  • If the document has the status "Rejected", it means that IDP detected this document not to be an invoice and then rejected it.            Rejected.png
  • If the document has the"Splitted" status and splittedDocs is not empty, it means this document has multiple pages, and IDP automatically split into child documents. Users can map split-document by using the parent id               Split.png
    • At this time, the user can check the status of the child documents by calling API Get Document Status for documentIds that have been responded to in splittedDocs and export the "Confirmed" documents in splittedDocs by calling API Export Document                 Split docs.png
  • If the document has the "To-review" status, it means that the user needs to review documents then change it to "Confirmed" status by API Update Document Status before exporting data           To-review.png

c. Get Documents

If users want to get a list of all documents with a specific status, user can call API Get Documents

d. Export Documents

The user needs to wait for the document to be changed to the "Confirmed" status and get the extracted data information by calling the API Export Document to IDP Server with the input parameters (token, documentId that need to be extracted and file format that user wants to export), then the API Export Document will respond to the user the extracted data in the chose format.

The API sample will follow the API Details below

API Details

1. Import Document

  • Purposes: Documents can be imported into akaBot Vision using the REST API. Supported file formats are PDF, PNG, JPEG.
  • URL: {serverEndpoint}/api/uploadFile/{pipelineId}
  • Content-Type: multipart/form-data
  • Method: POST
  • Request header: Authorization: Bearer {apiKey}
  • Input body:
AttributeTypeDescriptionRequired
pipelineIdstringPipeline’s idYes
filesForm-dataList documents that want to be uploadedYes
  • Response:

If success, will return code 200 and response is Document model array

If fail, will return error code and message code as below

Responses codeDescription
200OK
201Created
401Unauthorized
403Forbidden
404Not found

Example Response:

image-20221128175926-2.png

2. Export Document

  • Purposes: Documents after being confirmed can be exported to csv,json,xlxs,xml file via API export document
  • URL: {serverEndpoint}/api/export-documents/{id}?exportType={exportType}
  • Content-Type: application/json
  • Method: GET
  • Request header: Authorization: Bearer {apiKey}
  • Input parameters:
AttributeTypeDescriptionRequired
idstringDocument id want export dataYes
exportTypestring

File format that user wanted to export

  • csv
  • xlxs
  • xml
  • json
Yes
  • Output
    • If success, will return code 200 and file with input type
    • If fail, will return error code and message code as below
Responses codeDescription
200OK
401Unauthorized
403Forbidden
404Not found

Example Response:

image-20221128175926-4.png

3. Get Documents

  • Purposes: Can get list documents of specific pipeline with specific status (IMPORTING,TOREVIEW,CONFIRMED,EXPORTED,DELETED,REJECTED). If user do not send status to API, API will respond the list of documents with all statuses
  • URL: {serverEndpoint}/api/documents?page={page}&size={size}&status={status}&pipelineId={pipelineId}&documentName={documentName}&dateFrom={dateFrom}&dateTo={dateTo}&sort=createdDate,desc
  • Content-Type: application/json
  • Method: GET
  • Request header: Authorization: Bearer {apiKey}
  • Input parameters:
AttributeTypeDescriptionRequired
pageintegerPage number of the requested pageNo
sizeintegerSize of a pageNo
sortstringSorting criteria in the format: property(,asc|desc). Default sort order is ascending.No
statusstringDocuments’ status (IMPORTING, TOREVIEW, CONFIRMED, EXPORTED, DELETED, REJECTED)No
pipelineIdstringPipeline’s IdYes
documentNamestringSearch for document names containing input valuesNo
dateFromintegerSort document from dateNo
dateTointegerSort document to dateNo
  • Output

If success, will return code 200 and response is Document model array

If fail, will return error code and message code as below

Responses codeDescription
200OK
401Unauthorized
403Forbidden
404Not found

Example Response:

image-20221128175926-6.png

4. Update Document Status

  • Purposes: User can change document status via API update document status
  • URL: {serverEndpoint}/api/change-docs-status
  • Content-Type: application/json
  • Method: POST
  • Request header: Authorization: Bearer {apiKey}
  • Input body:
AttributeTypeDescriptionRequired
docIdsString arrayList document’s Id need to be updated statusYes
statusChangestringThe status that documents will change toYes
  • Output
    • If success, will return code 200
    • If fail, will return error code and message code as below
Responses codeDescription
200OK
401Unauthorized
403Forbidden
404Not found

Example Response:

image-20221128175926-8.png

5. Get Document Status

  • Purposes: Get document status
  • URL: {serverEndpoint}/api/documents/{id}    
  • Content-Type: application/json
  • Method: GET
  • Request header: Authorization: Bearer {apiKey}
  • Input parameters:
AttributeTypeDescriptionRequired
idstringDocument Id want to get infoYes
  • Output:

If success, will return code 200 and response is a Document model

If fail, will return error code and message code as below

Responses codeDescription
200OK
401Unauthorized
403Forbidden
404Not found

Example Response:

image-20221128175926-10.png

Appendix

  1. Server endpoint: https://idp.akabot.com/ or http://idp.akabot.io
  2. Get API Key:
    Step 1: Go to {serverEndpoint} /account/api-keys
    Step 2: Copy key image-20221128175926-11.png
  3. Status is support: akaBot Docs
  4. Document model type:
AttributeTypeDescription
aiResponsestringResult get from AI
checkSumstringList documents that want to be uploaded
contentTypestringUploaded document’s format
createBystringPerson who upload documents
createDatestringDate upload document
dataMappingsarray 
dataMergestringMapping results between field to capture and AI’s results
documentKeystringDocument’s id
duplicateDocsarray

List documents are duplicated to recently uploaded documents

Id: Duplicate document’s id

Name: Duplicate document’s name

Status: Duplicate document’s status

 

id Document’s id
lastModifiedBystringPerson who last modified the document
lastModifiedDateDatetimeDate when document was last modified
namestringDocument’s name
pathUrlstringDocument’s URL
pipelineIdstringPipeline’s id
reasonstringReason for rejecting documents
reviewerEmailstringEmail who review documents
splittedDocsarrayList documents after being splitted
splitedPagesnumberNumber of document’s pages after being splitted
statusstringDocument’s status
tenantIdstringTenant’s Id
totalPagesstringTotal pages of documents
  
Navigation