/ocr/value_add_tax_invoice

1.接口描述

该API是用于识别提取增值税发票上的文字信息。

请求方式:

POST

请求URL:

https://cloudapi.deepfinch.com/ocr/value_add_tax_invoice

调试工具

Debugging Tool

2.请求参数

2.1 请求头域

字段 类型 必需 描述
X-DF-API-ID string API调用凭证信息,详细信息请参考API调用
X-DF-API-SECRET string API调用凭证信息,详细信息请参考API调用

2.2 请求体

字段 类型 必需 描述
file file 见下方注释 需上传的图片文件,上传本地图片进行检测时选取此参数
url string 见下方注释 图片网络地址,采用抓取网络图片方式时需选取此参数

请求参数 fileurl 二选一。
url 中若含有特殊字符,则需要对这些字符进行转义,所有中文和特殊字符必需以UTF-8编码转义。
目前支持 http/https 协议的网络地址。下载限时 5s,超时后仍未下载完成则属于失败。
参数 file 需把图片文件以 multipart/form-data 的形式放到 POST 消息体中。

3.返回参数

字段 类型 描述
request_id string 本次请求的 id
status string 状态。正常为 OK ,其他值表示失败。详见错误码
result object 识别结果

3.1 result 字段的参数

字段 类型 说明
invoice_info object 发票基本信息
buyer_info object 购买者信息
seller_info object 销售者信息
detail_info objectArray 货物清单信息
amount_info object 金额信息

3.1.1 result 字段的参数

字段 类型 说明
invoice_code object 发票代码
invoice_check_code object 发票校验码
invoice_numb object 发票号码
invoice_date object 开票日期
invoice_password object 发票密码区
machine_code object 机器编码

3.1.2 buyer_info/seller_info字段的参数

字段 类型 说明
name object 姓名
checkcode object 纳税人识别码
address_and_phone object 地址和电话
bank_info object 银行卡信息

3.1.3 detail_info字段的参数

字段 类型 说明
detail_name object 货物名称
amount object 金额
tax_rate object 税率
tax_amount object 税额

3.1.4 amount_info字段的参数

字段 类型 说明
amount_total object 合计金额
tax_amount_total object 价税合计
amount_in_words object 合计大写
amount_in_figuers object 合计小写

3.1.5 字段结构

字段 类型 说明
txt string 提取文本
region floatArray 文本坐标

输出示例:

{
    "status": "OK",
    "request_id": "TID5ad591e2169544079a2e66f5822933e0",
    "result": {
        "amount_info": {
            "amount_in_figuers": {
                "region": [
                    377.11784882627745,
                    200.21450292616888,
                    417.2228750828416,
                    200.21450292616888,
                    417.2228750828416,
                    208.9700009856773,
                    377.11784882627745,
                    208.9700009856773
                ],
                "txt": "120.00"
            },
            "amount_in_words": {
                "region": [
                    186.80126968149128,
                    201.67375260275364,
                    226.54170479026845,
                    201.67375260275364,
                    226.54170479026845,
                    210.42925066226204,
                    186.80126968149128,
                    210.42925066226204
                ],
                "txt": "壹佰贰拾圆整"
            },
            "amount_total": {
                "region": [
                    347.2213747077478,
                    185.62200616032155,
                    382.2221248952947,
                    185.62200616032155,
                    382.2221248952947,
                    194.37750421982994,
                    347.2213747077478,
                    194.37750421982994
                ],
                "txt": "120.00"
            },
            "tax_amount_total": {
                "region": "",
                "txt": ""
            }
        },
        "buyer_info": {
            "address_and_phone": {
                "region": "",
                "txt": ""
            },
            "bank_info": {
                "region": "",
                "txt": ""
            },
            "checkcode": {
                "region": "",
                "txt": ""
            },
            "name": {
                "region": "",
                "txt": ""
            }
        },
        "detail_info": [],
        "invoice_info": {
            "invoice_check_code": {
                "region": [
                    302.74125467774036,
                    214.80699969201623,
                    403.36841146693763,
                    214.80699969201623,
                    403.36841146693763,
                    223.19768533237846,
                    302.74125467774036,
                    223.19768533237846
                ],
                "txt": "000085XXXXXXXXXX"
            },
            "invoice_code": {
                "region": [
                    112.78926668074108,
                    29.84710318490111,
                    202.84328018411694,
                    29.84710318490111,
                    202.84328018411694,
                    44.074787531602276,
                    112.78926668074108,
                    44.074787531602276
                ],
                "txt": "023XXXX1XX"
            },
            "invoice_date": {
                "region": [
                    393.5244504766901,
                    44.43959995074846,
                    451.85903412260154,
                    44.074787531602276,
                    452.2236252703885,
                    53.92472284854923,
                    393.88904162447704,
                    54.6543476868416
                ],
                "txt": "20227年03月24日"
            },
            "invoice_numb": {
                "region": [
                    358.88829143693016,
                    27.293416250877822,
                    407.3789140925941,
                    27.293416250877822,
                    407.3789140925941,
                    41.521100597578986,
                    358.88829143693016,
                    41.521100597578986
                ],
                "txt": "01XXX92"
            },
            "invoice_password": [
                {
                    "region": [
                        299.09534319987085,
                        70.3412817101275,
                        451.12985182702766,
                        62.31540848891146,
                        451.85903412260154,
                        71.80053138671224,
                        299.8245254954448,
                        79.82640460792827
                    ],
                    "txt": "03+92<662/1*0374c4943296016"
                },
                {
                    "region": [
                        301.28289008659254,
                        79.0967797696359,
                        451.85903412260154,
                        71.80053138671224,
                        452.2236252703885,
                        80.92084186536682,
                        301.6474812343795,
                        88.2170902482905
                    ],
                    "txt": "J-475>216+9246621*83/47-03"
                },
                {
                    "region": [
                        300.55370779101867,
                        87.85227782914431,
                        451.12985182702766,
                        81.28565428451301,
                        451.4944429748146,
                        90.4059647631676,
                        300.9182989388056,
                        96.9725883077989
                    ],
                    "txt": "<++924662/1*83/4c-4-0.5"
                },
                {
                    "region": [
                        301.28289008659254,
                        96.9725883077989,
                        452.2236252703885,
                        90.04115234402141,
                        452.5882164181755,
                        99.16146282267601,
                        301.6474812343795,
                        106.0928987864535
                    ],
                    "txt": "+176-0648101+7830×54+6366×1"
                }
            ],
            "machine_code": {
                "region": [
                    93.4659358480329,
                    57.57284704001107,
                    149.6129726072227,
                    57.57284704001107,
                    149.6129726072227,
                    65.5987202612271,
                    93.4659358480329,
                    65.5987202612271
                ],
                "txt": "80XXXXX021"
            }
        },
        "seller_info": {
            "address_and_phone": {
                "region": [
                    123.72700111434948,
                    236.69574484078726,
                    244.04207988404193,
                    236.69574484078726,
                    244.04207988404193,
                    246.5456801577342,
                    123.72700111434948,
                    246.5456801577342
                ],
                "txt": "XXXXXXXXX"
            },
            "bank_info": {
                "region": "",
                "txt": ""
            },
            "checkcode": {
                "region": [
                    135.02932669574483,
                    227.21062194298648,
                    230.91679856371184,
                    227.21062194298648,
                    230.91679856371184,
                    237.42536967907964,
                    135.02932669574483,
                    237.42536967907964
                ],
                "txt": "91230107XXXXXXXXX08"
            },
            "name": {
                "region": "",
                "txt": ""
            }
        }
    }
}

4.错误码

状态码 status 字段 说明
400 INVALID_ARGUMENT 请求参数错误
400 DETECTION_FAILED 图片检测失败
401 UNAUTHORIZED 未授权或授权失败
403 RATE_LIMIT_EXCEEDED 调用频率超出限额
404 NOT_FOUND 请求路径错误
500 INTERNAL_ERROR 服务器内部错误

输出示例:

{
  "status": "INVALID_ARGUMENT",
  "reason": "must specify 'file'",
  "request_id": "TID8bf47ab6eda64476973cc5f5b6ebf57e"
}

5.输入示例

results matching ""

    No results matching ""