Query the extraction result

Updated at:

Query the extraction task status and structured result

Call this API to query the extraction task status and structured result. Keep polling while data.status is processing; stop when it becomes success or failed.

NoteMake sure you have obtained an API Key before calling. See Authentication.

Request parameters

ParameterTypeRequiredDescription
biz_idstringYesThe business task ID returned by /extract/submit.
oss_configobjectNoOSS output configuration.
oss_config.access_key_idstringNoManaged OSS AccessKey ID.
oss_config.access_key_secretstringNoManaged OSS AccessKey Secret.
oss_config.security_tokenstringNoManaged OSS Security Token.

Response

FieldTypeDescription
request_idstringThe request ID.
data.statusstringProcessing status: init, processing, success, or failed.
data.page_countintegerEstimated page count.
data.extract_result_jsonobjectThe structured extraction result generated according to extract_schema.
data.fieldsarrayField-level extraction results.
data.fields[].pathstringField path.
data.fields[].schema_typestringSchema field type.
data.fields[].statusstringField status; public examples include found, miss, and inferred.
data.fields[].valueanyThe field value, which can be any JSON value defined by the schema.
data.fields[].citationsarrayCitation list.
data.fields[].citations[].citation_idstringCitation ID.
data.fields[].citations[].quotestringQuoted original text.
data.fields[].citations[].pageintegerCitation page number.
data.fields[].citations[].page_widthintegerPage width.
data.fields[].citations[].page_heightintegerPage height.
data.fields[].citations[].bboxarrayCoordinates relative to the page width and height, in [x,y,w,h] format.
data.fields[].reasonstringExplanation of the field result; applies when status is inferred.

NoteWhile the status is processing, keep querying this endpoint; when the status is failed, refer to Error codes to handle the cause of failure.

Code example

curl -X POST 'https://{workspaceId}.cn-beijing.maas.aliyuncs.com/api/v2/apps/parse-x/extract/result' \
  -H "Authorization: Bearer $DASHSCOPE_API_KEY" \
  -H 'Content-Type: application/json' \
  -d '{
    "biz_id": "biz_xxx"
  }'
{
  "request_id": "request_xxx",
  "data": {
    "status": "success",
    "extract_result_json": {
      "contract_number": "contract_xxx",
      "total_amount": 144000
    },
    "fields": [
      {
        "path": "contract_number",
        "schema_type": "string",
        "status": "found",
        "value": "contract_xxx",
        "citations": [
          {
            "citation_id": "citation_xxx",
            "quote": "Contract number: contract_xxx",
            "page": 1,
            "page_width": 1080,
            "page_height": 1920,
            "bbox": [100, 100, 100, 100]
          }
        ]
      }
    ],
    "page_count": 10
  }
}