Interface General Rules
Domain name:
https://cloud.laiye.com/idp
Request protocol: HTTPS
Data format:JSON
Verification methods
4.1 App Signature Verification
- HTTP Header:
Header Key Description Api-Auth-pubkey User-created app's pubkey Api-Auth-timestamp current timestamp (seconds) Api-Auth-nonce random string Api-Auth-sign signature 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 HeaderDict4.2 Token Verification
- HTTP Header:
Header Key Description Api-Auth-access-token The access-token obtained after the account OAuth is logged in 4.3 SDK resources
Common Error Codes
Code | Description |
---|---|
0 | Normal |
3 | Parameter error, The specific returned Message will vary depending on the type of error |
8 | Resource exhaustion, such as too big the request body, etc. The specific returned Message will vary depending on the type of error |
10000 | Service internal error |
10001 | Header parsing error |
10002 | Signature verification failed |
10003 | Parameter is incorrect, Application does not exist |
10004 | The classifier algorithm type does not match |
10005 | The classifier model needs to be updated first |
10006 | Need to select the image to be recognized |
10007 | Wrong file type |
10008 | Wrong file format, only png, jpeg, jpg, BMP, tiff, pdf are supported |
10009 | Wrong file size, the length, and width of the file need to be between 15 and 4096 pixels |
10010 | Processing timeout |
10011 | Insufficient account quota |
10012 | Token has expired |
10013 | Invalid AI capability ID |
10014 | The current AI capability is not enabled |
10015 | Call frequency exceeds limit |
10016 | The application type does not match, please select the correct API |
10017 | Encrypted PDF is not supported |
10018 | The requested data is too large, please control it within 10M |
10019 | The valid template does not exist, and the template recognition cannot be performed |
10020 | No valid template is matched |
10021 | Published version does not exist, so extraction cannot be performed |
10022 | Wrong request parameter |
10023 | Only 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 Capabilities | URI | Restriction Rules | - |
---|---|---|---|
Text Recognition | /v1/mage/ocr/general | Enterprise Edition: Determined by business communication Free Edition: 6 times per minute | -- |
Form Recognition | /v1/mage/ocr/table | Enterprise Edition: Determined by business communication Free Edition: 6 times per minute | -- |
Card & Certificate Recognition | /v1/mage/ocr/license | Enterprise Edition: Determined by business communication Free Edition: 6 times per minute | -- |
Invoice Recognition | /v1/mage/ocr/bills | Enterprise Edition: Determined by business communication Free Edition: 6 times per minute | -- |
Template Recognition | /v1/document/ocr/template | Enterprise 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
Parameter | Is it mandatory | Type | Description |
---|---|---|---|
with_struct_info | boolean | image format ocr.ImageFileType format=2 [json_name='format']; Whether structured information is required | |
with_char_info | boolean | Whether to return single-word information | |
img_base64 | required | Array of strings | The 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
Fields | Is it mandatory | Type | Description |
---|---|---|---|
message | string | Hints | |
code | int | Status Code | |
data | object | docUnderstandingOcrGeneralResultNew | |
+struct_content | object | ocrStructContent | |
++paragraph | Array of objects | Array of page information for identification results | |
+++content | string | Recognized text content | |
+++paragraph_id | int | Paragraph number | |
++page | Array of objects | Array of paragraph information for recognition results | |
+++content | string | Text content after recognition | |
+++page_id | int | Page number | |
++row | Array of objects | Array of row information for recognition results | |
+++content | string | Text content after recognition | |
+++row_id | int | Row number | |
+rotated_image_width | int | The image width of the rotation | |
+img_id | String | Unique id generated for each image | |
+image_angle | int | Rotation angle | |
+items | Array of objects | The recognition result of OCR | |
++probabilities | Array of objects | The probability of identifying a single word in the result | |
+++char | string | ||
+++probability | float | ||
++positions | Array of objects | Text block coordinates (from the upper left corner, a set of four corner coordinates clockwise) | |
+++y | int | ||
+++x | int | ||
++content | String | Text block content | |
++char_positions | Array of objects | The coordinate array of each text, the length should be equal to the length of content | |
+++positions | Array of objects | Text coordinates (from the upper left corner, a set of four corner coordinates clockwise) | |
++++y | int | ||
++++x | int | ||
+rotated_image_height | int | Rotated 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
Parameter | Is it mandatory | Type | Description |
---|---|---|---|
img_base64 | required | Array of strings | The 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
Fields | Is it mandatory | Type | Description |
---|---|---|---|
message | string | Hints | |
code | int | Status Code | |
data | object | docUnderstandingOcrGeneralResultNew | |
+tables | Array of objects | Form information | |
++column | int | The total number of columns in the table | |
++cells | Array of objects | Information of cells in the table | |
+++end_col | int | Column where the cell terminates | |
+++start_row | int | The 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) | |
+++positions | Array of objects | Cell coordinates (from the upper left corner, a set of four corner coordinates clockwise) | |
++++y | int | ||
++++x | int | ||
+++content | string | Text content of the cell | |
+++end_row | int | The row where the cell terminates | |
+++start_col | int | The 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_id | int | Table number, starting from 0 | |
++row | int | The total number of rows in the table | |
+rotated_image_width | int | Rotated image width | |
+img_id | string | Unique id generated for each image | |
+msg_id | string | Unique id for request | |
+image_angle | int | Rotation angle | |
+items | Array of objects | Information that is not text in the table | |
++probabilities | Array of objects | The probability of identifying a single word in the result | |
+++char | string | ||
+++probability | float | ||
++positions | Array of objects | Text block coordinates (from the upper left corner, a set of four corner coordinates clockwise) | |
+++y | int | ||
+++x | int | ||
++content | string | Text block content | |
++char_positions | Array of objects | The coordinate array of each text, the length should be equal to the length of content | |
+++positions | Array of objects | Text coordinates (from the upper left corner, a set of four corner coordinates clockwise) | |
++++y | int | ||
++++x | int | ||
+rotated_image_height | int | Rotated 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
Parameter | Is it mandatory | Type | Description |
---|---|---|---|
with_struct_info | boolean | Whether to return structured information (currently only general text is supported), the default is false | |
with_raw_info | boolean | Whether to return the original information recognized by the engine, the default is false | |
img_base64 | required | string | Image base64 |
Request Examples
{
"with_struct_info": true,
"with_raw_info": true,
"img_base64": "string"
}
Response
Response parameter
Fields | Is it mandatory | Type | Description |
---|---|---|---|
message | string | Hints | |
code | int | Status Code | |
data | object | Custom Template Recognition Data | |
+update_time | int | Template update time, timestamp in seconds | |
+template_hash | string | Template hash | |
+template_name | string | Template name | |
+results | Array of objects | The result of the identified field | |
++field_name | string | Fields name | |
++results | Array of strings | Field recognition result list | |
+raw | object | Raw result recognized by custom template engine | |
++tables | Array of objects | Form identification information | |
+++column | int64 | The total number of columns in the table | |
+++cells | Array of objects | Cell information of the table | |
++++end_col | int | Column where the cell terminates | |
++++start_row | int | The 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 | |
++++positions | Array of objects | Cell coordinates (from the upper left corner, a set of four corner coordinates clockwise) | |
+++++y | int | ||
+++++x | int | ||
++++content | string | Text content of the cell | |
++++end_row | int | The row where the cell terminates | |
++++start_col | int | The 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_id | int | Table number, starting from 0 | |
+++row | int | The total number of rows in the table | |
++struct_content | object | ocrStructContent | |
+++paragraph | Array of objects | Array of page information of recognition results | |
++++content | string | Text content of recognition | |
++++paragraph_id | int | Paragraph id | |
+++page | Array of objects | Array of paragraph information of recognition results | |
++++content | string | Text content of recognition | |
++++page_id | int | Page id | |
+++row | Array of objects | Array of row information of recognition results | |
++items | Array of objects | Text block recognition information | |
+++probabilities | Array of objects | The probability of identifying a single word in the result | |
++++char | String | ||
++++probability | float | ||
+++positions | Array of objects | Text block coordinates (from the upper left corner, a set of four corner coordinates clockwise) | |
++++y | int | ||
++++x | int | ||
+++content | string | Text block content | |
+++char_positions | Array of objects | The coordinate array of each text, the length should be equal to the length of content | |
++++positions | Array of objects | Text coordinates (from the upper left corner, a set of four corner coordinates clockwise) | |
+++++y | int | ||
+++++x | int | ||
++rotated_image_width | int | Rotated image width | |
++image_angle | int | Rotation angle | |
++rotated_image_height | int | Rotated image height | |
+msgId | string | Message 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
Fields | Is it mandatory | Type | Description |
---|---|---|---|
img_base64 | required | string | The encoding formed by base64 the binary of the image |
Request Examples
{
"img_base64": "string"
}
Response
Response Parameter
Fields | Is it mandatory | Type | Description |
---|---|---|---|
message | string | Hints | |
code | int | Status Code | |
data | string | docUnderstandingOcrLicenseResultNew | |
+msg_id | string | Unique id of request | |
+result | object | ocrOcrLicenseResponse | |
++type_description | string | Cards specific type description | |
++type_key | string | Cards specific type key | |
++rotated_image_width | int | Rotated image width | |
++img_id | string | Unique id generated for each image | |
++image_angle | int | Rotation angle | |
++items | Array of objects | Cards recognition results | |
+++positions | Array of objects | The coordinate position of the identification field in the original image, arranged clockwise, at least 4 points | |
++++y | int | ||
++++x | int | ||
+++value | string | Field Results | |
+++key | string | Field types | |
+++description | string | Field description | |
++type | int | - 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_height | int | Rotated 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
Fields | Is it mandatory | Type | Description |
---|---|---|---|
img_base64 | required | string | The encoding formed by base64 the image binary |
Request Examples
{
"img_base64": "string"
}
Response
Response Parameter
Fields | Is it mandatory | Type | Description |
---|---|---|---|
message | string | Hints | |
code | int | Status code | |
data | object | docUnderstandingOcrBillsResultNew | |
+msg_id | string | Unique id of request | |
+result | Array of objects | Recognition result | |
++kind | int | - 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_description | string | Description of the specific type of invoice | |
++type_key | string | Ticket specific type key | |
++rotated_image_width | int | Rotated image width | |
++items | Array of objects | Invoice recognition result | |
+++positions | Array of objects | The coordinate position of the identification field in the original image, arranged clockwise, at least 4 points | |
++++y | int | ||
++++x | int | ||
+++value | string | Field results | |
+++key | string | Field types | |
+++description | string | Field description | |
++rotated_image_height | int | Rotated image height | |
++goods | Array of objects | Form details section in the Invoice | |
+++items | Array of objects | ocrOcrCommonItem | |
++++positions | Array of objects | The coordinate position of the identification field in the original image, arranged clockwise, at least 4 points | |
+++++y | int | ||
+++++x | int | ||
++++value | string | Field results | |
++++key | string | Field types | |
++++description | string | Field description | |
++image_angle | int | Rotation angle) | |
++type | int | - 23:other- 24: English invoice | |
++class | int | - 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
Fields | Is it mandatory | Type | Description |
---|---|---|---|
format | int | Image Format | |
img_base64 | required | string | The encoding formed by base64 the image binary |
Request Examples
{
"format": "0",
"img_base64": "string"
}
Response
Response Parameter
Fields | Is it mandatory | Type | Description |
---|---|---|---|
message | string | Hints | |
code | int | Status code | |
data | object | Captcha recognition result | |
+positions | Array of objects | Vertex coordinates of the upper left corner of the recognition area | |
++y | int | ||
++x | int | ||
+msg_id | string | Unique id of request | |
+result | string | Result |
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
Fields | Is it mandatory | Type | Description |
---|---|---|---|
doc | required | string | Text content to be classified |
Request Examples
{
"doc": "string"
}
Response
Response Parameter
Fields | Is it mandatory | Type | Description |
---|---|---|---|
message | string | Hints | |
code | int | Status code | |
data | object | Return data by category | |
+msg_id | string | Unique id | |
+results | Array of objects | Classification result | |
++class_id | int | Classification id | |
++score | float | Confidence score 0-100 | |
++class_label | string | Category name | |
++debug_info | Array of objects | Debug info | |
+++unicode_start_pos | int | Unicode start position | |
+++start_pos | int | Utf8 encoding start position | |
+++length | int | Utf8 encoding length | |
+++keyword | string | Matching keywords | |
+++unicode_length | int | Unicode 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
Fields | Is it mandatory | Type | Description |
---|---|---|---|
file_compare | string | Document for comparison (base 64 encoded)) | |
file_base | string | Standard document (base 64 encoded) | |
file_compare_name | string | The 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_name | string | The 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
Fields | Is it mandatory | Type | Description |
---|---|---|---|
message | string | Hints | |
code | int | Status code | |
task_id | string | Compare 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
Fields | Is it mandatory | Type | Description |
---|---|---|---|
task_id | string | Comparison task ID |
Request Examples
{
"task_id": "string"
}
Response
Response Examples
Fields | Is it mandatory | Type | Description |
---|---|---|---|
message | string | Hints | |
code | int | Status code | |
data | object | Comparison result | |
+finished_page_num | int | Number of currently completed pages, start from 1 | |
+result_ocr | Array of objects | OCR recognition result(deprected) | |
++file_compare | string | Comparison document OCR recognition result of the current page | |
++file_base | string | Standard document OCR recognition result of the current page | |
++page_num | int | Page numbers, start from 1 | |
+task_id | string | Task ID | |
+total_page_num | int | Total pages | |
+result_details_ignore | Array of objects | Ignored differences | |
++diff_result | Array of objects | Diff result for current page | |
+++diff_index | int | diff in the standard document, the order in which the current page appears | |
+++content_compare | string | diff in the comparison document, the order in which the current page appears | |
+++location_compare | Array of objects | the 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_list | Array of objects | Diff area on current page) | |
+++++position | Array of objects | Coordinates of 4 points of upper left/upper right/lower right/lower left | |
++++++y | int | ||
++++++x | int | ||
++++page_num | int | The page number of current page (start from 1) | |
+++location_base | Array of objects | The 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_list | Array of objects | Diff area on current page | |
+++++position | Array of objects | Coordinates of 4 points of upper left/upper right/lower right/lower left | |
++++++y | int | ||
++++++x | int | ||
++++page_num | int | The page number of current page (start from 1) | |
+++diff_type | int | docUnderstandingDiffType. 0: Enum default value, usually not be used;1: Modification type;2: Delete type;3: Insert type | |
+++content_base | string | Diff content in the standard documentation | |
++page_num | int | Current page number, start from 1 | |
+base_page_result | Array of objects | Standard document identification results | |
++content | string | The full text of the identified content | |
++image_angle | int | Rotation angle | |
++page_num | int64 | Page numbers, start from 1 | |
+base_page_num | int64 | Standard documentation pages | |
+compare_page_num | int64 | Comparison document pages | |
+result_url | string | Comparison results link | |
+compare_page_result | Array of objects | Comparison document recognition results | |
++content | string | The full text of the identified content | |
++image_angle | int | Rotation angle | |
++page_num | int | Page numbers, start from 1 | |
+task_error_msg | string | When the task status is compare failed, this field indicates the reason for the failure | |
+result_summary | object | Comparison overall results | |
++diff_insert | int | Total diff to insert | |
++diff_ignore | int | Total diff to be ignored | |
++diff_page | int | Page number where diff exists, starts from 1 | |
++diff_sum | int | Total diff | |
++diff_delete | int | Total diff to be deleted | |
++diff_replace | int | Total diff to be modified | |
+task_status | int | docUnderstandingCompareTaskStatus. 0: enum default value, usually not be used;1: waiting;2: comparing;3: stopped; 4: The comparison is complete; 5:Comparison failed | |
+result_details | Array of objects | Detailed comparison results, the page number of the diff, the type of the diff, and the position of the diff in the two documents | |
++diff_result | Array of objects | Diff results for the current page | |
+++diff_index | int | diff in the standard document, the order in the current page | |
+++content_compare | string | Diff in the comparison document | |
+++location_compare | Array of objects | The 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_list | Array of objects | Diff area on this page | |
+++++position | Array of objects | Coordinates of 4 points of upper left/upper right/lower right/lower left | |
++++++y | int | ||
++++++x | int | ||
++++page_num | int | The page number of this page (Start from 1)) | |
+++location_base | Array of objects | The 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_list | Array of objects | Diff area on this page | |
+++++position | Array of objects | Coordinates of 4 points of upper left/upper right/lower right/lower left | |
++++++y | int | ||
++++++x | int | ||
++++page_num | int | The page number of this page (Start from 1)) | |
+++diff_type | int | docUnderstandingDiffType. 0: enum default value, usually not be used;1:Modification type;2: delete type;3: insert type | |
+++content_base | string | diff in the standard document | |
++page_num | int | The 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
Fields | Is it mandatory | Type | Description |
---|---|---|---|
task_id | string | Comparison task ID |
Request Examples
{
"task_id": "string"
}
Response
Response Parameter
Fields | Is it mandatory | Type | Description |
---|---|---|---|
message | string | Hints | |
code | int | Status code | |
link | string | Comparison 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
Fields | Is it mandatory | Type | Description |
---|---|---|---|
file_base64 | required | string | The encoding formed after the base 64 file binary |
Required Examples
{
"file_base64": "string"
}
Response
Response Parameter
Fields | Is it mandatory | Type | Description |
---|---|---|---|
message | string | Hints | |
code | int | Status code | |
task_id | string | Task 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
Fields | Is it mandatory | Type | Description |
---|---|---|---|
with_ocr_detail | boolean | Whether to return data details | |
file_base64 | required | string | The encoding formed after base64 file binary |
Request Examples
{
"with_ocr_detail": true,
"file_base64": "string"
}
Response
Response Parameter
Fields | Is it mandatory | Type | Description |
---|---|---|---|
message | string | Hints | |
code | int | Status code | |
data | object | Extraction result | |
+fields | Array of objects | Field extraction result | |
++field_type | int | Field type. Default: "0",Enum: "0" "1" "2"。0: default, not used,1: string,2: string array | |
++text_list | object | String array object | |
+++values | Array of objects | Array of string values | |
++++score | float | Confidence score | |
++++value | string | Value | |
++field_name | string | Field name |