同步文档提取API

重要说明:

  • 所有请求及返回参数均严格以官网API文档为准。
  • API返回结果中可能包含未在文档中定义的字段。这些字段仅供内部调试使用,不保证稳定性及兼容性,请勿在生产环境中依赖这些字段,ZOLOZ保留随时修改或删除这些字段的权利,且无需另行通知。

概览

  • API 路径:POST /api/v1/zoloz/realdoc/parse
  • API 描述:该接口用于对传入的文档进行信息提取,并返回结构化的提取结果。

请求参数

字段名称

数据类型

是否必填

默认值

描述

示例值

bizId

String

-

商户的业务ID,用于区分不同的请求或任务。

20230601001

fileContent

String

null

待提取的文档文件,需经过Base64编码后传入,文件大小最大为10MB。

/9j/4AAQSkZJRgABAQAAlgCWAAD/4QCARXhpZgAA

fileUrl

String

null

待提取文件的URL地址。

说明fileUrlfileContent必须传入一个,同时传入时优先使用fileUrl

https://example.com/file.pdf

fileType

String

null

指定文件类型。支持的文件类型包括:pdf、jpg、jpeg、png、webp、bmp、tiff。

pdf

schemaId

String

null

文档提取模板ID,不同模板对应的文档类型不同。取值:

  • companies_registry_v1:公司注册证明
  • business_registration_certificate_v1:商业登记证明
  • invoice_v1:发票
  • receipt_v1:收据
  • bank_statement_v1:银行对账单
  • mys_birth_certificate_v1马来西亚出生证明

如果不传schemaId,则进行全量信息提取,返回结果格式如下:

copy
{
    "data": {
        "raw_text": [
            {
                "bbox": [
                    55, 
                    290, 
                    64, 
                    375
                ], 
                "text": "xxxx"
            }, 
            {
                "bbox": [
                    68, 
                    290, 
                    80, 
                    503
                ], 
                "text": "xxxx"
            }
        ]
    }
}

bank_statement_v1

includeExtInfo

String

N

是否在返回结果中为每个提取字段提供扩展信息。扩展信息包含字段的置信度分数(confidence_score)、边界框坐标(bbox)和所在页码(page)。取值:

  • Y:返回扩展信息
  • N:不返回扩展信息

Y

返回参数

字段名称

数据类型

描述

示例值

transactionId

String

ZOLOZ返回的事务ID。

R000000202510111032563d0e515f

data

Map<String, Object>

文档提取结果,不同schemaId对应的结果有所不同。

includeExtInfo=Y时,每个字段的值会从字符串变为包含textconfidence_scorebboxpage的对象。

参考返回示例

result

Result

API请求结果,包含结果状态、结果码和结果信息。

{

"resultStatus": "S",

"resultCode": "SUCCESS",

"resultMessage": "Success"

}

Data字段扩展信息说明

当请求参数includeExtInfo设置为Y时,data中每个提取字段的值会从字符串变为一个对象,包含以下属性:

字段名称

数据类型

描述

示例值

text

String

提取的字段值。

Customer Name

bbox

Integer

提取信息的边界框坐标,格式为[x1, y1, x2, y2]。

[12, 15, 45, 18]

confidence_score

Double

置信度分数,范围0-1。

置信度等级:

  • 高:≥ 0.95
  • 中:0.80-0.95
  • 低:< 0.80

0.98

page

Integer

信息提取字段所在页码。

1

Result字段说明

字段名称

数据类型

描述

示例值

resultStatus

String

结果状态。

  • S:成功
  • F:失败

S

resultCode

String

结果码。

  • SUCCESS:成功。
  • PARAMETER_ERROR:输入参数错误。
  • AUTHORIZATION_ERROR:认证或授权错误。
  • CLIENT_BUSINESS_ERROR:客户业务错误,例如文档链接下载失败。
  • INTERNAL_BUSINESS_ERROR:内部业务错误。
  • SYSTEM_ERROR:系统错误。

SUCCESS

resultMessage

String

结果信息。

  • 成功时返回Success
  • 失败时返回具体的失败信息。

Success

代码示例

请求示例

基础请求示例

copy
{
    "bizId": "20230601001", 
    "fileType": "pdf", 
    "fileContent": "/9j/4AAQSkZJRgABAQAAlgCWAAD/4QCARXhpZgAA", 
    "schemaId": "bank_statement_v1"
}

请求返回扩展信息示例(includeExtInfo=Y)

copy
{
    "bizId": "20230601002", 
    "fileType": "pdf", 
    "fileContent": "/9j/4AAQSkZJRgABAQAAlgCWAAD/4QCARXhpZgAA", 
    "schemaId": "bank_statement_v1", 
    "includeExtInfo": "Y"
}

返回示例

基础返回示例

copy
{
    "result": {
        "resultStatus": "S", 
        "resultCode": "SUCCESS", 
        "resultMessage": "Success"
    }, 
    "data": {
        "account_holders_name": "MS. IxxG", 
        "account_number": "91802xxxxx04", 
        "bank_name": "AXIS BANK", 
        "starting_balance": "47315.01", 
        "ending_balance": "115368.01", 
        "deposits_and_credits": "372700.00", 
        "withdrawals_and_debits": "304647.00", 
        "scheme_code": "CA- LARGE RETAILERS AND DISTRIBUTORS", 
        "customer_id": "88xxx0", 
        "currency": "INR", 
        "lien_amount": "0.00", 
        "nomination_details": "NOMINATION REGISTERED", 
        "PIN": "11xxx1", 
        "details": [
            {
                "date": "10/04/2019", 
                "description": "MOB/SELFFT/SURJEET SINGH/9130100", 
                "balance": "315.01"
            }, 
            {
                "date": "13/04/2019", 
                "description": "GST @18% on Charge", 
                "balance": "2028.81"
            }
        ]
    }, 
    "transactionId": "R000000202510111032563d0e515f"
}

返回扩展信息示例(includeExtInfo=Y)

当传入有效的schemaIdincludeExtInfo设置为Y时,data中每个字段的值变为包含扩展信息的对象。

copy
{
    "result": {
        "resultStatus": "S", 
        "resultCode": "SUCCESS", 
        "resultMessage": "Success"
    }, 
    "data": {
        "account_holders_name": {
            "text": "MS. IxxG", 
            "confidence_score": 0.95, 
            "bbox": [
                12, 
                15, 
                45, 
                18
            ], 
            "page": 1
        }, 
        "account_number": {
            "text": "91802xxxxx04", 
            "confidence_score": 0.98, 
            "bbox": [
                22, 
                25, 
                45, 
                18
            ], 
            "page": 1
        }, 
        "bank_name": {
            "text": "AXIS BANK", 
            "confidence_score": 0.99, 
            "bbox": [
                30, 
                5, 
                70, 
                8
            ], 
            "page": 1
        }, 
        "starting_balance": {
            "text": "47315.01", 
            "confidence_score": 0.92, 
            "bbox": [
                65, 
                25, 
                90, 
                28
            ], 
            "page": 1
        }, 
        "ending_balance": {
            "text": "115368.01", 
            "confidence_score": 0.93, 
            "bbox": [
                65, 
                30, 
                90, 
                33
            ], 
            "page": 1
        }, 
        "details": [
            {
                "date": {
                    "text": "10/04/2019", 
                    "confidence_score": 0.97, 
                    "bbox": [
                        5, 
                        0.45, 
                        0.2, 
                        48
                    ], 
                    "page": 1
                }, 
                "description": {
                    "text": "MOB/SELFFT/SURJEET SINGH/9130100", 
                    "confidence_score": 0.9, 
                    "bbox": [
                        22, 
                        0.45, 
                        75, 
                        48
                    ], 
                    "page": 1
                }, 
                "balance": {
                    "text": "315.01", 
                    "confidence_score": 0.96, 
                    "bbox": [
                        80, 
                        45, 
                        95, 
                        48
                    ], 
                    "page": 1
                }
            }
        ]
    }, 
    "transactionId": "R000000202510111032563d0e515f"
}

data字段返回示例

不同schemaId返回的data结果不同。以下示例均为includeExtInfo=N(默认)时的返回结构。

companies_registry_v1

copy
{
    "document_type": "CERTIFICATE OF INCORPORATION", 
    "certificate_no": "7xxx6", 
    "company_name": {
        "english": "xxx Co., Limited", 
        "chinese": "xxx Co., Ltd."
    }, 
    "date_of_incorporation": "19 May 2025", 
    "company_type": "limited company"
}

business_registration_certificate_v1

copy
{
    "document_type": "BUSINESS REGISTRATION CERTIFICATE", 
    "document_copy_type": "ORIGINAL", 
    "company_name": {
        "chinese": "xxxx Co., Ltd.", 
        "english": "xxxxCO., LIMITED"
    }, 
    "branch_name": "", 
    "address": "UNIT NO.532B ON 5/F STAR HOUSE NO.3 SALISBURY ROAD TSIM SHA TSUI KL", 
    "nature_of_business": "Cosmetics, Investment", 
    "legal_status": "BODY CORPORATE", 
    "date_of_commencement": "23/11/2024", 
    "date_of_expiry": "22/11/2025", 
    "certificate_no": "7xxx", 
    "fee_and_levy": {
        "total": "$2,200", 
        "fee": "$2,200", 
        "levy": "$0"
    }
}

invoice_v1

copy
{
    "invoice_number": "25117000000923922723", 
    "invoice_date": "July 11, 2025", 
    "total_tax": "31.66", 
    "invoice_amount": "275.22", 
    "currency": "¥", 
    "buyer_name": "xxx company", 
    "buyer_tax_id": "9xxxx", 
    "seller_name": "Beijing Hema Network Technology Co., Ltd.", 
    "seller_tax_id": "9xxx", 
    "drawer": "Tang xx", 
    "details": [
        {
            "description": "*Other food*food-13%", 
            "unit_price": "248.85", 
            "quantity": "1", 
            "line_amount": "248.85", 
            "discount": ""
        }, 
        {
            "description": "**Other food*food-13%", 
            "unit_price": "", 
            "quantity": "", 
            "line_amount": "-5.29", 
            "discount": ""
        }
    ]
}

receipt_v1

copy
{
    "receipt_number": "00050109", 
    "merchant_name": "Wuhan Yuxiwan Xinjingxi Catering Co., Ltd.", 
    "total_amount": "1185.00", 
    "date": "2024-11-06", 
    "details": [
        {
            "description": "Braised Pork Ribs with Fresh Rehmannia Soup", 
            "line_amount": "180.00"
        }, 
        {
            "description": "Stewed Free-Range Chicken", 
            "line_amount": "208.00"
        }, 
        {
            "description": "Tofu Stewed with Yan Fish", 
            "line_amount": "188.00"
        }, 
        {
            "description": "Sauteed Tripe with Fermented Rice", 
            "line_amount": "56.00"
        }, 
        {
            "description": "Spicy Salt Pork Ribs", 
            "line_amount": "78.00"
        }, 
        {
            "description": "Steamed Goose Slices", 
            "line_amount": "168.00"
        }, 
        {
            "description": "Stuffed Bitter Melon", 
            "line_amount": "66.00"
        }, 
        {
            "description": "Pickled Cabbage Stir-Fried with Pork Tripe", 
            "line_amount": "93.00"
        }, 
        {
            "description": "Scallion-Scented Yam", 
            "line_amount": "66.00"
        }, 
        {
            "description": "Vegetables", 
            "line_amount": "52.00"
        }, 
        {
            "description": "Beverages", 
            "line_amount": "30.00"
        }
    ]
}

bank_statement_v1

copy
{
        "account_holders_name": "MS. IxxG",
        "account_number": "91802xxxxx04",
        "bank_name": "AXIS BANK",
        "starting_balance": "47315.01",
        "ending_balance": "115368.01",
        "deposits_and_credits": "372700.00",
        "withdrawals_and_debits": "304647.00",
        "scheme_code": "CA- LARGE RETAILERS AND DISTRIBUTORS",
        "customer_id": "88xxx0",
        "currency": "INR",
        "lien_amount": "0.00",
        "nomination_details": "NOMINATION REGISTERED",
        "PIN": "11xxx1",
        "details": [
            {
                "date": "10/04/2019",
                "description": "MOB/SELFFT/SURJEET SINGH/9130100",
                "balance": "315.01"
            },
            {
                "date": "13/04/2019",
                "description": "GST @18% on Charge",
                "balance": "2028.81"
            }
        ]
    }

mys_birth_certificate_v1

copy
{
    "BASIC": {
        "Registration_Area": "MALAYSIA BARAT", 
        "Registration_Centre": "JPN NEGERI JOHOR"
    }, 
    "CHILD": {
        "Full_Name": "xxUYO", 
        "Date_and_Time_of_Birth": "15 FEBRUARI 2018 05:21 AM", 
        "Race": "INDONESIA", 
        "Place_of_Birth": "PUSAT PAKAR SAKITPUAN DAN PERBIDANAN KHOR & LOH SKUDAI", 
        "Status_of_Citizenship": "WARGANEGARA", 
        "Gender": "LELAKI", 
        "Religion": "ISLAM"
    }, 
    "FATHER": {
        "Name": "xxONO", 
        "Identity_Card_Number": "7xx3", 
        "Age": "47 TAHUN", 
        "Status_of_Citizenship": "BUKAN WARGANEGARA", 
        "Status_of_Residence": "PEMASTAUTIN TETAP", 
        "Race": "INDONESIA", 
        "Religion": "ISLAM", 
        "Types_and_Number_of_Other_Document": "Maklumat Tidak Berkenaan"
    }, 
    "MOTHER": {
        "Name": "xxRTI", 
        "Identity_Card_Number": "7xx3", 
        "Age": "37 TAHUN", 
        "Status_of_Citizenship": "BUKAN WARGANEGARA", 
        "Status_of_Residence": "Maklumat Tidak Berkenaan", 
        "Race": "INDONESIA", 
        "Religion": "ISLAM", 
        "Types_and_Number_of_Other_Document": "PASPORT INDONESIA Bxx4", 
        "Residence_Address": "LOT 368 A JALAN AHAD KAMPUNG UNGKU MOHSIN 80350 JOHOR BAHRU JOHOR"
    }, 
    "INFORMANT": {
        "Name": "xxONO", 
        "Identity_Card_Number": "7xx3", 
        "Date_of_Registration": "21 FEBRUARI 2018", 
        "Types_and_Number_of_Other_Document": "Maklumat Tidak Berkenaan"
    }
}