跳至主要内容

查詢文件識別結果

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

概觀

DOCAI文件識別接口返回標準的消息格式。fieldList定義了文件的鍵值格式中的鍵值對字段類型。itemList通常定義表格字段,不同的模型調用識別接口將返回不同的字段

路徑參數

名稱類型是否必填描述
fileIdList對象數組上傳文件的唯一標識
modelId 字串 模型的唯一標識
returnOcrResult字串是否回傳 OCR 結果,預設值: 0。1: 回傳 OCR 結果,0: 不回傳 OCR 結果。

響應主體

名稱類型是否必填描述
fileId字串上傳文件的唯一標識
recognizeStatus 字串 上傳文件識別狀態,0 失敗 1 成功 2 識別中
result對象識別字段

結果消息格式

名稱類型是否必填描述
fieldList對象數組 從檔案中選取的欄位清單
   pageNumber整數檔案中所在的頁數
   key字串選取欄位的欄位名
   value字串選取欄位的欄位名值
itemList對象數組檔案中提前的明細行資訊
   pageNumber整數檔案中所在的頁數
   key字串明細行的欄位名
   value字串明細行的欄位值

示例請求

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"}'

示例響應

{
"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
}