Skip to main content

Query File Recognition Results

Overview

The "Query File Recognition Results" API provided by DOCAI returns results in a standardized message format. The fieldList defines key-value pairs in the Key-Value format for fields within the file, while the itemList typically defines table fields. Different models calling the recognition interface may return different fields.

Request

POST https://api.docai.pro/api/identify/file/v2/identifyResult

Path parameters

Name Type Mandatory Description
fileIdListarraytrueUnique identifier for uploading files  
modelIdstringtrueThe unique identifier of the model
returnOcrResultstringfalseWhether to return OCR results,Default: 0,1: Returns OCR results,0: Does not return OCR results

Response body

NameTypeMandatoryDescription
fileIdstringtrueUnique identifier for uploading files
recognizeStatusstringtrueUpload file recognition status (0 - failed, 1 - successful, 2 - Identifying)
resultobjecttrueIdentification field

result Message Format

NameTypeMandatory Description
fieldListarrayfalseList of extracted fields from the document
   pageNumberintfalseThe page number within the document for this field  
   keystringfalseThe name of the extracted field
   valuestringfalseThe value of the extracted field
itemListarrayfalseExtracted line information from the document
   pageNumberintegerfalseThe page number within the document for this item
   keystringfalseThe name of the extracted item
   valuestringfalseThe value of the extracted item

Example request

curl -i -X POST api.docai.pro/api/identify/file/v2/identifyResult \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $DOCAI_API_KEY" \
-d '{"fileIdList":["2310091711378393918074800"],"modelId":"Your model Id"}'

Example response

{
"code": 200,
"message": null,
"costTime": null,
"data": [
{
"fileId": "2310091711378393918074800",
"recognizeStatus": "1",
"result": {
"fieldList": [
{
"pageNumber": 1,
"key": "paymentTerms",
"value": "Payment is due within 15 days"
},
{
"pageNumber": 1,
"key": "invoiceDate",
"value": "2019-02-11"
},
{
"pageNumber": 1,
"key": "documentType",
"value": "invoice"
},
{
"pageNumber": 1,
"key": "invoiceNumber",
"value": "US-001"
},
{
"pageNumber": 1,
"key": "grossAmount",
"value": "154.06"
},
{
"pageNumber": 1,
"key": "totalTax",
"value": "9.06"
},
{
"pageNumber": 1,
"key": "dueDate",
"value": "2019-02-26"
}
],
"taxList": [
[
{
"pageNumber": 1,
"key": "taxValue",
"value": "9.06"
},
{
"pageNumber": 1,
"key": "taxPercentage",
"value": "6.25"
}
]
],
"itemList": [
[
{
"pageNumber": 1,
"key": "totalPriceInclTax",
"value": "100.00"
},
{
"pageNumber": 1,
"key": "unitPrice",
"value": "100.00"
},
{
"pageNumber": 1,
"key": "quantity",
"value": "1"
},
{
"pageNumber": 1,
"key": "description",
"value": "Front and rear brake cables"
},
{
"pageNumber": 1,
"key": "totalPriceExclTax",
"value": "100.00"
}
],
[
{
"pageNumber": 1,
"key": "totalPriceInclTax",
"value": "30.00"
},
{
"pageNumber": 1,
"key": "unitPrice",
"value": "15.00"
},
{
"pageNumber": 1,
"key": "quantity",
"value": "2"
},
{
"pageNumber": 1,
"key": "description",
"value": "New set of pedal arms"
},
{
"pageNumber": 1,
"key": "totalPriceExclTax",
"value": "30.00"
}
],
[
{
"pageNumber": 1,
"key": "totalPriceInclTax",
"value": "15.00"
},
{
"pageNumber": 1,
"key": "unitPrice",
"value": "5.00"
},
{
"pageNumber": 1,
"key": "quantity",
"value": "3"
},
{
"pageNumber": 1,
"key": "description",
"value": "Labor 3hrs"
},
{
"pageNumber": 1,
"key": "totalPriceExclTax",
"value": "15.00"
}
]
]
}
}
],
"requestId": "da69edd3cb1d47b4a68db9303d280000",
"currentTimeMillis": 1696859401185
}