Skip to main content
Version: V2.8

Interface General Rules

  1. Domain name: https://cloud.laiye.com/idp

  2. Request protocol: HTTPS

  3. Data format:JSON

  4. Verification methods

    4.1 App Signature Verification

    • HTTP Header:
    Header KeyDescription
    Api-Auth-pubkeyUser-created app's pubkey
    Api-Auth-timestampcurrent timestamp (seconds)
    Api-Auth-noncerandom string
    Api-Auth-signsignature Signature Generation Rules: sha1 value of Api-Auth-nonce+Api-Auth-timestamp+secret_key
    • Sample Code (Python)
    #encoding:utf-8  
    import requests
    import json
    import time
    import hashlib
    import random
    import string
    def GenerateHeader(api_auth_pubkey, app_auth_secretkey):
    api_auth_timestamp = str(int(time.time()))
    api_auth_nounce = "".join(random.sample(string.ascii_letters + string.digits, 10))
    HeaderDict = dict()
    prefix = "Value Exception"
    if api_auth_pubkey == "":
    raise Exception("{0}, the api_auth_pubkey must not be empty".format(prefix))
    if app_auth_secretkey == "":
    raise Exception("{0}, the app_auth_secret_key must not be empty".format(prefix))
    prefix = "Type Exception"
    if not isinstance(api_auth_pubkey, str):
    raise Exception("{0}, the type of api_auth_pubkey must be string".format(prefix))
    if not isinstance(app_auth_secretkey, str):
    raise Exception("{0}, the type of app_auth_secretkey must be string".format(prefix))
    HeaderDict["Api-Auth-nonce"] = api_auth_nounce
    HeaderDict["Api-Auth-pubkey"] = api_auth_pubkey
    HeaderDict["Api-Auth-timestamp"] = api_auth_timestamp
    token_name = hashlib.sha1()
    token_key = api_auth_nounce + api_auth_timestamp+app_auth_secretkey
    token_name.update(token_key.encode("utf-8"))
    HeaderDict["Api-Auth-sign"] = token_name.hexdigest()
    return HeaderDict

    4.2 Token Verification

    • HTTP Header:
    Header KeyDescription
    Api-Auth-access-tokenThe access-token obtained after the account OAuth is logged in

    4.3 SDK resources

    Download SDK

Common Error Codes

CodeDescription
0Normal
3Parameter error, The specific returned Message will vary depending on the type of error
8Resource exhaustion, such as too big the request body, etc. The specific returned Message will vary depending on the type of error
10000Service internal error
10001Header parsing error
10002Signature verification failed
10003Parameter is incorrect, Application does not exist
10004The classifier algorithm type does not match
10005The classifier model needs to be updated first
10006Need to select the image to be recognized
10007Wrong file type
10008Wrong file format, only png, jpeg, jpg, BMP, tiff, pdf are supported
10009Wrong file size, the length, and width of the file need to be between 15 and 4096 pixels
10010Processing timeout
10011Insufficient account quota
10012Token has expired
10013Invalid AI capability ID
10014The current AI capability is not enabled
10015Call frequency exceeds limit
10016The application type does not match, please select the correct API
10017Encrypted PDF is not supported
10018The requested data is too large, please control it within 10M
10019The valid template does not exist, and the template recognition cannot be performed
10020No valid template is matched
10021Published version does not exist, so extraction cannot be performed
10022Wrong request parameter
10023Only UTF8 encoding is supported

Frequency Limit Description

For security and response efficiency, we limit the calling frequency of the open platform interface.

For each call, the following three parameters are given in the returned Headers object (Response Headers)

  • X-Ratelimit-Remaining:current time window remaining requests)
  • X-Ratelimit-Reset:next reset time)
  • UTCX-Ratelimit-Limit:The maximum current limit times in the current time window.

Frequency Limit Rules

AI CapabilitiesURIRestriction Rules-
Text Recognition/v1/mage/ocr/generalEnterprise Edition: Determined by business communication Free Edition: 6 times per minute--
Form Recognition/v1/mage/ocr/tableEnterprise Edition: Determined by business communication Free Edition: 6 times per minute--
Card & Certificate Recognition/v1/mage/ocr/licenseEnterprise Edition: Determined by business communication Free Edition: 6 times per minute--
Invoice Recognition/v1/mage/ocr/billsEnterprise Edition: Determined by business communication Free Edition: 6 times per minute--
Template Recognition/v1/document/ocr/templateEnterprise Edition: Determined by business communication Free Edition: 6 times per minute--

Text Recognition

Interface Description

Detect and identify text content in documents, mainly used for the electronic version of various types of documents, such as contracts. Based on deep learning, the accuracy of print recognition can reach 99%.

Request

Request Method

HTTP method:POST

Request URI: /v1/mage/ocr/general

Request Parameter

ParameterIs it mandatoryTypeDescription
with_struct_infobooleanimage format ocr.ImageFileType format=2 [json_name='format']; Whether structured information is required
with_char_infobooleanWhether to return single-word information
img_base64requiredArray of stringsThe image is encoded in binary by base64, and multi-page documents are sent in order. Currently, only single sheet is supported.)

Request Examples

{
"with_struct_info": true,
"with_char_info": true,
"img_base64": [
"string"
]
}

Response

Response Parameter

FieldsIs it mandatoryTypeDescription
messagestringHints
codeintStatus Code
dataobjectdocUnderstandingOcrGeneralResultNew
+struct_contentobjectocrStructContent
++paragraphArray of objectsArray of page information for identification results
+++contentstringRecognized text content
+++paragraph_idintParagraph number
++pageArray of objectsArray of paragraph information for recognition results
+++contentstringText content after recognition
+++page_idintPage number
++rowArray of objectsArray of row information for recognition results
+++contentstringText content after recognition
+++row_idintRow number
+rotated_image_widthintThe image width of the rotation
+img_idStringUnique id generated for each image
+image_angleintRotation angle
+itemsArray of objectsThe recognition result of OCR
++probabilitiesArray of objectsThe probability of identifying a single word in the result
+++charstring
+++probabilityfloat
++positionsArray of objectsText block coordinates (from the upper left corner, a set of four corner coordinates clockwise)
+++yint
+++xint
++contentStringText block content
++char_positionsArray of objectsThe coordinate array of each text, the length should be equal to the length of content
+++positionsArray of objectsText coordinates (from the upper left corner, a set of four corner coordinates clockwise)
++++yint
++++xint
+rotated_image_heightintRotated image Height

Response Samples

{
"message": "string",
"code": 0,
"data": {
"struct_content": {
"paragraph": [
{
"content": "string",
"paragraph_id": 0
}
],
"page": [
{
"content": "string",
"page_id": 0
}
],
"row": [
{
"content": "string",
"row_id": 0
}
]
},
"rotated_image_width": 0,
"img_id": "string",
"msg_id": "string",
"image_angle": 0,
"items": [
{
"probabilities": [
{
"char": "string",
"probability": 0
}
],
"positions": [
{
"y": 0,
"x": 0
}
],
"content": "string",
"char_positions": [
{
"positions": [
{
"y": 0,
"x": 0
}
]
}
],
}
],
"rotated_image_height": 0
}
}

Form Recognition

Interface Description

Detect and recognize text content in tables, rows, columns, and cells in pictures. Mainly used to identify documents that contain tables, such as contracts, bills, etc. Supports framed tables, unframed tables, tables with merged cells, etc.

Request

Request Method

HTTP method:POST

Request URI: /v1/mage/ocr/table

Request Parameter

ParameterIs it mandatoryTypeDescription
img_base64requiredArray of stringsThe encoding formed after base64 the binary of the picture. Multi-page documents are sent in sequence Currently only single page are supported

Request Examples

{
"with_struct_info": true,
"with_raw_info": true,
"img_base64": "string"
}

Response

Response Parameter

FieldsIs it mandatoryTypeDescription
messagestringHints
codeintStatus Code
dataobjectdocUnderstandingOcrGeneralResultNew
+tablesArray of objectsForm information
++columnintThe total number of columns in the table
++cellsArray of objectsInformation of cells in the table
+++end_colintColumn where the cell terminates
+++start_rowintThe starting row of the cell (when the cell is in the first row, start_row=0, if the starting row and the ending row are both 0, it means that all columns and cells should be merged)
+++positionsArray of objectsCell coordinates (from the upper left corner, a set of four corner coordinates clockwise)
++++yint
++++xint
+++contentstringText content of the cell
+++end_rowintThe row where the cell terminates
+++start_colintThe starting column of the cell (when the cell is in the first column, start_col=0, if the starting column and the ending column are both 0, it means that all rows and cells should be merged
++table_idintTable number, starting from 0
++rowintThe total number of rows in the table
+rotated_image_widthintRotated image width
+img_idstringUnique id generated for each image
+msg_idstringUnique id for request
+image_angleintRotation angle
+itemsArray of objectsInformation that is not text in the table
++probabilitiesArray of objectsThe probability of identifying a single word in the result
+++charstring
+++probabilityfloat
++positionsArray of objectsText block coordinates (from the upper left corner, a set of four corner coordinates clockwise)
+++yint
+++xint
++contentstringText block content
++char_positionsArray of objectsThe coordinate array of each text, the length should be equal to the length of content
+++positionsArray of objectsText coordinates (from the upper left corner, a set of four corner coordinates clockwise)
++++yint
++++xint
+rotated_image_heightintRotated image height

Response Samples

{
"message": "string",
"code": 0,
"data": {
"tables": [
{
"column": 0,
"cells": [
{
"end_col": 0,
"start_row": 0,
"positions": [
{
"y": 0,
"x": 0
}
],
"content": "string",
"end_row": 0,
"start_col": 0
}
],
"table_id": 0,
"row": 0
}
],
"rotated_image_width": 0,
"img_id": "string",
"msg_id": "string",
"image_angle": 0,
"items": [
{
"probabilities": [
{
"char": "string",
"probability": 0
}
],
"positions": [
{
"y": 0,
"x": 0
}
],
"content": "string",
"char_positions": [
{
"positions": [
{
"y": 0,
"x": 0
}
]
}
],
}
],
"rotated_image_height": 0
}
}

Custom Template Recognition

Interface Description

Extract key information from structured data according to certain rules

Request

Request Method

HTTP method:POST

Request URI: /v1/document/ocr/template

Request Parameter

ParameterIs it mandatoryTypeDescription
with_struct_infobooleanWhether to return structured information (currently only general text is supported), the default is false
with_raw_infobooleanWhether to return the original information recognized by the engine, the default is false
img_base64requiredstringImage base64

Request Examples

{
"with_struct_info": true,
"with_raw_info": true,
"img_base64": "string"
}

Response

Response parameter

FieldsIs it mandatoryTypeDescription
messagestringHints
codeintStatus Code
dataobjectCustom Template Recognition Data
+update_timeintTemplate update time, timestamp in seconds
+template_hashstringTemplate hash
+template_namestringTemplate name
+resultsArray of objectsThe result of the identified field
++field_namestringFields name
++resultsArray of stringsField recognition result list
+rawobjectRaw result recognized by custom template engine
++tablesArray of objectsForm identification information
+++columnint64The total number of columns in the table
+++cellsArray of objectsCell information of the table
++++end_colintColumn where the cell terminates
++++start_rowintThe starting column of the cell (when the cell is in the first column, start_col=0, if the starting column and the ending column are both 0, it means that all rows and cells should be merged
++++positionsArray of objectsCell coordinates (from the upper left corner, a set of four corner coordinates clockwise)
+++++yint
+++++xint
++++contentstringText content of the cell
++++end_rowintThe row where the cell terminates
++++start_colintThe starting column of the cell (when the cell is in the first column, start_col=0, if the starting column and the ending column are both 0, it means that all rows and cells should be merged
+++table_idintTable number, starting from 0
+++rowintThe total number of rows in the table
++struct_contentobjectocrStructContent
+++paragraphArray of objectsArray of page information of recognition results
++++contentstringText content of recognition
++++paragraph_idintParagraph id
+++pageArray of objectsArray of paragraph information of recognition results
++++contentstringText content of recognition
++++page_idintPage id
+++rowArray of objectsArray of row information of recognition results
++itemsArray of objectsText block recognition information
+++probabilitiesArray of objectsThe probability of identifying a single word in the result
++++charString
++++probabilityfloat
+++positionsArray of objectsText block coordinates (from the upper left corner, a set of four corner coordinates clockwise)
++++yint
++++xint
+++contentstringText block content
+++char_positionsArray of objectsThe coordinate array of each text, the length should be equal to the length of content
++++positionsArray of objectsText coordinates (from the upper left corner, a set of four corner coordinates clockwise)
+++++yint
+++++xint
++rotated_image_widthintRotated image width
++image_angleintRotation angle
++rotated_image_heightintRotated image height
+msgIdstringMessage id

Response Examples

{
"message": "string",
"code": 0,
"data": {
"update_time": "string",
"template_hash": "string",
"template_name": "string",
"results": [
{
"field_name": "string",
"results": [
"string"
]
}
],
"raw": {
"tables": [
{
"column": 0,
"cells": [
{
"end_col": 0,
"start_row": 0,
"positions": [
{
"y": 0,
"x": 0
}
],
"content": "string",
"end_row": 0,
"start_col": 0
}
],
"table_id": 0,
"row": 0
}
],
"struct_content": {
"paragraph": [
{
"content": "string",
"paragraph_id": 0
}
],
"page": [
{
"content": "string",
"page_id": 0
}
],
"row": [
{
"content": "string",
"row_id": 0
}
]
},
"items": [
{
"probabilities": [
{
"char": "string",
"probability": 0
}
],
"positions": [
{
"y": 0,
"x": 0
}
],
"content": "string",
"char_positions": [
{
"positions": [
{
"y": 0,
"x": 0
}
]
}
],
}
],
"rotated_image_width": 0,
"image_angle": 0,
"rotated_image_height": 0
},
"msgId": "string"
}
}

Card & Certificate Recognition

Interface Description

Structured detection and identification of card information in pictures.

Request

Request Method

HTTP method:POST

Request URI: /v1/mage/ocr/license

Request Parameter

FieldsIs it mandatoryTypeDescription
img_base64requiredstringThe encoding formed by base64 the binary of the image

Request Examples

{
"img_base64": "string"
}

Response

Response Parameter

FieldsIs it mandatoryTypeDescription
messagestringHints
codeintStatus Code
datastringdocUnderstandingOcrLicenseResultNew
+msg_idstringUnique id of request
+resultobjectocrOcrLicenseResponse
++type_descriptionstringCards specific type description
++type_keystringCards specific type key
++rotated_image_widthintRotated image width
++img_idstringUnique id generated for each image
++image_angleintRotation angle
++itemsArray of objectsCards recognition results
+++positionsArray of objectsThe coordinate position of the identification field in the original image, arranged clockwise, at least 4 points
++++yint
++++xint
+++valuestringField Results
+++keystringField types
+++descriptionstringField description
++typeint- 24: Malaysian ID Card - 25: New Zealand driver's license - 26: Indonesia ID Card - 27: Thailand ID Card - 28: Sweden driver's license - 29: Malaysia driver‘s license - 30: Philippine ID Card - 31: Singapore driver's license - 32: Indonesia driver's license - 33: United States driver's license
++rotated_image_heightintRotated image height

Response Examples

{
"message": "string",
"code": 0,
"data": {
"msg_id": "string",
"result": {
"type_description": "string",
"type_key": "string",
"rotated_image_width": 0,
"img_id": "string",
"image_angle": 0,
"items": [
{
"positions": [
{
"y": 0,
"x": 0
}
],
"value": "string",
"key": "string",
"description": "string"
}
],
"type": "0",
"rotated_image_height": 0
}
}
}

Invoice Recognition

Interface Description

Structured detection and recognition of invoices in documents.

Request

Request Method

HTTP method:POST

Request URI: /v1/mage/ocr/bills

Request Parameter

FieldsIs it mandatoryTypeDescription
img_base64requiredstringThe encoding formed by base64 the image binary

Request Examples

{
"img_base64": "string"
}

Response

Response Parameter

FieldsIs it mandatoryTypeDescription
messagestringHints
codeintStatus code
dataobjectdocUnderstandingOcrBillsResultNew
+msg_idstringUnique id of request
+resultArray of objectsRecognition result
++kindint- 0:default - 1: Vehicle use- 2: Transportation- 3: Medical- 4: Education- 5: Daily use- 6: Office- 7: Service- 8: Digital appliances- 9: Rent decoration- 10: Communication- 11: Accommodation- 12: Mailing- 13: Catering- 14: Food- 15: Clothing- 16: Other
++type_descriptionstringDescription of the specific type of invoice
++type_keystringTicket specific type key
++rotated_image_widthintRotated image width
++itemsArray of objectsInvoice recognition result
+++positionsArray of objectsThe coordinate position of the identification field in the original image, arranged clockwise, at least 4 points
++++yint
++++xint
+++valuestringField results
+++keystringField types
+++descriptionstringField description
++rotated_image_heightintRotated image height
++goodsArray of objectsForm details section in the Invoice
+++itemsArray of objectsocrOcrCommonItem
++++positionsArray of objectsThe coordinate position of the identification field in the original image, arranged clockwise, at least 4 points
+++++yint
+++++xint
++++valuestringField results
++++keystringField types
++++descriptionstringField description
++image_angleintRotation angle)
++typeint- 23:other- 24: English invoice
++classint- 0: Default - 1:State tax - 2:Local invoice - 3:Other invoice

Response Examples

{
"message": "string",
"code": 0,
"data": {
"msg_id": "string",
"result": {
"img_id": "string",
"result": [
{
"kind": "0",
"type_description": "string",
"type_key": "string",
"rotated_image_width": 0,
"items": [
{
"positions": [
{
"y": 0,
"x": 0
}
],
"value": "string",
"key": "string",
"description": "string"
}
],
"rotated_image_height": 0,
"goods": [
{
"items": [
{
"positions": [
{
"y": 0,
"x": 0
}
],
"value": "string",
"key": "string",
"description": "string"
}
]
}
],
"image_angle": 0,
"type": "0",
"class": "0"
}
]
}
}
}

Captcha Recognition

Interface Description

Through OCR technology, detect and identify verification codes in pictures, including but not limited to alphanumeric combinations, four arithmetic operations, etc.

Request

Request Method

HTTP method:POST

Request URI: /v1/document/ocr/verification

Request Parameter

FieldsIs it mandatoryTypeDescription
formatintImage Format
img_base64requiredstringThe encoding formed by base64 the image binary

Request Examples

{
"format": "0",
"img_base64": "string"
}

Response

Response Parameter

FieldsIs it mandatoryTypeDescription
messagestringHints
codeintStatus code
dataobjectCaptcha recognition result
+positionsArray of objectsVertex coordinates of the upper left corner of the recognition area
++yint
++xint
+msg_idstringUnique id of request
+resultstringResult

Response Examples

{
"message": "string",
"code": 0,
"data": {
"positions": [
{
"y": 0,
"x": 0
}
],
"msg_id": "string",
"result": "string"
}
}

Text Classification

Interface Description

Text classification, the incoming documents are classified according to the rules set by a certain user, which is convenient for users to organize similar documents.

Request

Request Method

HTTP method:POST

Request URI: /v1/document/classify

Request Parameter

FieldsIs it mandatoryTypeDescription
docrequiredstringText content to be classified

Request Examples

{
"doc": "string"
}

Response

Response Parameter

FieldsIs it mandatoryTypeDescription
messagestringHints
codeintStatus code
dataobjectReturn data by category
+msg_idstringUnique id
+resultsArray of objectsClassification result
++class_idintClassification id
++scorefloatConfidence score 0-100
++class_labelstringCategory name
++debug_infoArray of objectsDebug info
+++unicode_start_posintUnicode start position
+++start_posintUtf8 encoding start position
+++lengthintUtf8 encoding length
+++keywordstringMatching keywords
+++unicode_lengthintUnicode length

Response Examples

{
"message": "string",
"code": 0,
"data": {
"msg_id": "string",
"results": [
{
"class_id": 0,
"score": 0,
"class_label": "string",
"debug_info": [
{
"unicode_start_pos": 0,
"start_pos": 0,
"length": 0,
"keyword": "string",
"unicode_length": 0
}
]
}
]
}
}

Contract Comparison-Submit Task

Interface Description

Contract comparison task submission interface, upload 2 files to be compared and return the task ID.

Request

Request Method

HTTP method:POST

Request URI: /v1/mage/solution/contract/compare

Request Parameter

FieldsIs it mandatoryTypeDescription
file_comparestringDocument for comparison (base 64 encoded))
file_basestringStandard document (base 64 encoded)
file_compare_namestringThe file name of the comparison document, without the file suffix (optional, if not passed, the platform will name the file as "Comparison Document")
file_base_namestringThe file name of the standard document, without the file suffix (optional, if not passed, the platform will name the file as "standard document")

Request Examples

{
"file_compare": "string",
"file_base": "string",
"file_compare_name": "string",
"file_base_name": "string"
}

Response

Response Parameter

FieldsIs it mandatoryTypeDescription
messagestringHints
codeintStatus code
task_idstringCompare task ID

Response Examples

{
"message": "string",
"code": 0,
"task_id": "string"
}

Contract Comparison-Get Results

The interface for obtaining the result of contract comparison, query the comparison result according to the task ID.

Request

Request Method

HTTP method:POST

Request URI: /v1/mage/solution/contract/detail

Request Parameter

FieldsIs it mandatoryTypeDescription
task_idstringComparison task ID

Request Examples

{
"task_id": "string"
}

Response

Response Examples

FieldsIs it mandatoryTypeDescription
messagestringHints
codeintStatus code
dataobjectComparison result
+finished_page_numintNumber of currently completed pages, start from 1
+result_ocrArray of objectsOCR recognition result(deprected)
++file_comparestringComparison document OCR recognition result of the current page
++file_basestringStandard document OCR recognition result of the current page
++page_numintPage numbers, start from 1
+task_idstringTask ID
+total_page_numintTotal pages
+result_details_ignoreArray of objectsIgnored differences
++diff_resultArray of objectsDiff result for current page
+++diff_indexintdiff in the standard document, the order in which the current page appears
+++content_comparestringdiff in the comparison document, the order in which the current page appears
+++location_compareArray of objectsthe location of the diff in the comparison document, Diff may cross pages. It is also possible to cross line within the same page. For a Diff that crosses both pages and lines, it is necessary to split by page first and then by line within one page.
++++position_listArray of objectsDiff area on current page)
+++++positionArray of objectsCoordinates of 4 points of upper left/upper right/lower right/lower left
++++++yint
++++++xint
++++page_numintThe page number of current page (start from 1)
+++location_baseArray of objectsThe location of the diff in the standard documentation, the Diff may cross pages. It is also possible to cross lines in the same page. For a Diff that crosses both pages and lines, it is necessary to split by page first, and then split by line within one page.
++++position_listArray of objectsDiff area on current page
+++++positionArray of objectsCoordinates of 4 points of upper left/upper right/lower right/lower left
++++++yint
++++++xint
++++page_numintThe page number of current page (start from 1)
+++diff_typeintdocUnderstandingDiffType. 0: Enum default value, usually not be used;1: Modification type;2: Delete type;3: Insert type
+++content_basestringDiff content in the standard documentation
++page_numintCurrent page number, start from 1
+base_page_resultArray of objectsStandard document identification results
++contentstringThe full text of the identified content
++image_angleintRotation angle
++page_numint64Page numbers, start from 1
+base_page_numint64Standard documentation pages
+compare_page_numint64Comparison document pages
+result_urlstringComparison results link
+compare_page_resultArray of objectsComparison document recognition results
++contentstringThe full text of the identified content
++image_angleintRotation angle
++page_numintPage numbers, start from 1
+task_error_msgstringWhen the task status is compare failed, this field indicates the reason for the failure
+result_summaryobjectComparison overall results
++diff_insertintTotal diff to insert
++diff_ignoreintTotal diff to be ignored
++diff_pageintPage number where diff exists, starts from 1
++diff_sumintTotal diff
++diff_deleteintTotal diff to be deleted
++diff_replaceintTotal diff to be modified
+task_statusintdocUnderstandingCompareTaskStatus. 0: enum default value, usually not be used;1: waiting;2: comparing;3: stopped; 4: The comparison is complete; 5:Comparison failed
+result_detailsArray of objectsDetailed comparison results, the page number of the diff, the type of the diff, and the position of the diff in the two documents
++diff_resultArray of objectsDiff results for the current page
+++diff_indexintdiff in the standard document, the order in the current page
+++content_comparestringDiff in the comparison document
+++location_compareArray of objectsThe location of the diff in the Comparison document. Diff may cross pages, and may also cross lines within the same page. For a Diff that crosses both pages and lines, you need to split by page first, and then by line within a page.
++++position_listArray of objectsDiff area on this page
+++++positionArray of objectsCoordinates of 4 points of upper left/upper right/lower right/lower left
++++++yint
++++++xint
++++page_numintThe page number of this page (Start from 1))
+++location_baseArray of objectsThe location of the diff in the standard document. Diff may cross pages, and may also cross lines within the same page. For a Diff that crosses both pages and lines, you need to split by page first, and then by line within a page.
++++position_listArray of objectsDiff area on this page
+++++positionArray of objectsCoordinates of 4 points of upper left/upper right/lower right/lower left
++++++yint
++++++xint
++++page_numintThe page number of this page (Start from 1))
+++diff_typeintdocUnderstandingDiffType. 0: enum default value, usually not be used;1:Modification type;2: delete type;3: insert type
+++content_basestringdiff in the standard document
++page_numintThe page number of current page (start from 1)

Response Examples

{
"message": "string",
"code": 0,
"data": {
"finished_page_num": 0,
"result_ocr": [
{
"file_compare": "string",
"file_base": "string",
"page_num": 0
}
],
"task_id": "string",
"total_page_num": 0,
"result_details_ignore": [
{
"diff_result": [
{
"diff_index": 0,
"content_compare": "string",
"location_compare": [
{
"position_list": [
{
"position": [
{
"y": 0,
"x": 0
}
]
}
],
"page_num": 0
}
],
"location_base": [
{
"position_list": [
{
"position": [
{
"y": 0,
"x": 0
}
]
}
],
"page_num": 0
}
],
"diff_type": "0",
"content_base": "string"
}
],
"page_num": 0
}
],
"base_page_result": [
{
"content": "string",
"image_angle": 0,
"page_num": 0
}
],
"base_page_num": 0,
"compare_page_num": 0,
"result_url": "string",
"compare_page_result": [
{
"content": "string",
"image_angle": 0,
"page_num": 0
}
],
"task_error_msg": "string",
"result_summary": {
"diff_insert": 0,
"diff_ignore": 0,
"diff_page": [
0
],
"diff_sum": 0,
"diff_delete": 0,
"diff_replace": 0
},
"task_status": "0",
"result_details": [
{
"diff_result": [
{
"diff_index": 0,
"content_compare": "string",
"location_compare": [
{
"position_list": [
{
"position": [
{
"y": 0,
"x": 0
}
]
}
],
"page_num": 0
}
],
"location_base": [
{
"position_list": [
{
"position": [
{
"y": 0,
"x": 0
}
]
}
],
"page_num": 0
}
],
"diff_type": "0",
"content_base": "string"
}
],
"page_num": 0
}
]
}
}

Contract Comparison-Download Results

The contract comparison download result interface downloads the comparison result according to the task ID.

Request

Request Method

HTTP method:POST

Request URI: /v1/mage/solution/contract/files

Request Parameter

FieldsIs it mandatoryTypeDescription
task_idstringComparison task ID

Request Examples

{
"task_id": "string"
}

Response

Response Parameter

FieldsIs it mandatoryTypeDescription
messagestringHints
codeintStatus code
linkstringComparison result link

Response Examples

{
"message": "string",
"code": 0,
"link": "string"
}

Multi-Page Extraction Model - Submit Task

The interface for multi-page extraction model task submission. Upload 1 file to be analyzed and return the task ID.

Request

Request Method

HTTP method:POST

Request URI: /v1/mage/idp/extractor/create

Request Parameter

FieldsIs it mandatoryTypeDescription
file_base64requiredstringThe encoding formed after the base 64 file binary

Required Examples

{
"file_base64": "string"
}

Response

Response Parameter

FieldsIs it mandatoryTypeDescription
messagestringHints
codeintStatus code
task_idstringTask ID

Response Examples

{
"message": "string",
"code": 0,
"task_id": "string"
}

Single Page Extraction Model

Detect and analyze the content in the image, and return the extraction result

Request

Request Method

HTTP method:POST

Request URI: /v1/mage/idp/extractor/single/extract

Request Parameter

FieldsIs it mandatoryTypeDescription
with_ocr_detailbooleanWhether to return data details
file_base64requiredstringThe encoding formed after base64 file binary

Request Examples

{
"with_ocr_detail": true,
"file_base64": "string"
}

Response

Response Parameter

FieldsIs it mandatoryTypeDescription
messagestringHints
codeintStatus code
dataobjectExtraction result
+fieldsArray of objectsField extraction result
++field_typeintField type. Default: "0",Enum: "0" "1" "2"。0: default, not used,1: string,2: string array
++text_listobjectString array object
+++valuesArray of objectsArray of string values
++++scorefloatConfidence score
++++valuestringValue
++field_namestringField name