薪火科技首页

多票据/发票ocr接口文档——薪火科技

支持类型: 增值税专用发票,机动车销售统一发票,货物运输业增值税专用发票,增值税普通发票,增值税电子普通发票,增值税普通发票(卷票),增值税电子普通发票(通行费),二手车销售统一发票,通用机打发票,通用定额发票,旅客运输普票,公路客运发票,船运客票,出租车发票,停车费发票,过路过桥费发票、汽车通行费,医疗费收据,教育费收据,行程单,火车票,增值税销货清单,商户小票,其它类型
多票据OCR识别在线演示网址


接口地址

http://api.xinhuokj.com:40072/ocr



HTTP头字段

Content-Type: application/json

HTTP正文体

{

"image": "/9j/4AAQSkZ......./9k=", //图片文件二进制数组经过base64编码后的字符串,目前支持jpg、tif、png、bmp等多种格式

"type": "9" , 

"token": "ef9c*************dbca", //请在用户中心获取token,网址:https://www.xinhuokj.com/user

}




可用postman工具调试,结果如下图所示:


返回字段描述

字段

说明

code

返回状态码。200:正常返回; 500:服务器内部错误

message

返回对应code的状态说明

result

图片结果信息

+ object_list

多张票据OCR识别结果集合

++ image_angle

切割后的单张票据图像角度

++ rotated_image_width

切割后的单张票据旋转后图片宽度

++ rotated_image_height

切割后的单张票据旋转后图片高度

++ position

切割后的单张票据在图片中的坐标

++ class

切割后的单张票据大类类型

++ type

切割后的单张票据具体类型

++ type_description

切割后的单张票据type字段对应的中文描述

++ kind

票据使用类型

++ kind_description

票据使用类型对应中文名描述

++ item_list

切割后的单张票据OCR识别结果

++ product_list

增值税发票项目明细(type为增值税发票出现)

+++ key

识别字段类型

+++ value

识别字段结果

+++ position

识别字段在原图中的坐标位置

+++ description

识别字段key中文描述

class中返回的类型结果描述:

字段

说明

nation_tax_invoice

国税

local_invoice

地方票种

other_invoice

其他票种

kind中返回的类型结果描述:

字段

说明

vehicle

用车

traffic

交通

education

教育

daily

日用

office

办公

service

服务

digital_appliance

数码电器

rent_decoration

房租装饰

communication

通讯

lodging

住宿

post

邮寄

repast

餐饮

foodstuff

食品

raiment

服饰

other

其他

type返回的类型列表:

字段

说明

vat_special_invoice

增值税专用发票

motor_vehicle_sale_invoice

机动车销售统一发票

vat_transport_invoice

货物运输业增值税专用发票

vat_common_invoice

增值税普通发票

vat_electronic_invoice

增值税电子普通发票

vat_roll_invoice

增值税普通发票(卷票)

vat_electronic_toll_invoice

增值税电子普通发票(通行费)

used_car_purchase_invoice

二手车销售统一发票

general_machine_invoice

通用机打发票

quota_invoice

通用定额发票

passenger_transport_invoice

旅客运输普票

highway_passenger_invoice

公路客运发票

shipping_invoice

船运客票

taxi_ticket

出租车发票

parking_invoice

停车费发票

vehicle_toll

过路过桥费发票、汽车通行费

education_receipt

教育费收据

air_transport

行程单

train_ticket

火车票

vat_invoice_sales_list

增值税销货清单

shop_receipt

商户小票

other

其它类型

typevat_special_invoicevat_electronic_invoicevat_common_invoicevat_electronic_toll_invoice, key返回的类型列表:

结果

说明

vat_invoice_correct_code

校验码

vat_invoice_daima

发票代码

vat_invoice_haoma

发票号码

vat_invoice_haoma_large_size

增值税发票No号码

vat_invoice_issue_date

开票日期

vat_invoice_rate_payer_id

纳税人识别号

vat_invoice_total

合计

vat_invoice_tax_rate

增值税税率

vat_invoice_seller_name

销售方名称

vat_invoice_seller_bank_account

销售方开户行及帐号

vat_invoice_seller_id

销售方纳税人识别号

vat_invoice_seller_addr_tell

销售方地址、电话

vat_invoice_payer_name

购买方名称

vat_invoice_payer_bank_account

购买方开户行及帐号

vat_invoice_payer_addr_tell

购买方地址、电话

vat_invoice_total_cover_tax

价税合计大写

vat_invoice_total_cover_tax_digits

价税合计小写

vat_invoice_tax_total

税额合计

vat_invoice_goods_list

货物或服务名称

vat_invoice_price_list

金额明细

vat_invoice_tax_rate_list

税率明细

vat_invoice_tax_list

税额明细

vat_invoice_zhuan_yong_flag

专票/普票

vat_invoice_dai_kai_flag

代开(非代开条目为空)

vat_invoice_plate_specific

规格型号明细

vat_invoice_electrans_unit

单位明细

vat_invoice_electrans_quantity

数量明细

vat_invoice_electrans_unit_price

单价明细

vat_invoice_daima_right_side

右侧打印发票代码

vat_invoice_haoma_right_side

右侧打印发票号码

vat_invoice_page_number

抵扣联/发票联

vat_invoice_type

发票类型

vat_invoice_total_note

备注

vat_invoice_cipher_field

密码区

vat_invoice_drawer

开票人

vat_invoice_review

复核

vat_invoice_payee

收款人

exist_stample

盖章存在性判断

vat_invoice_headline_page_number

标题发票联

vat_invoice_corrent_code_print

打印校验码

vat_invoice_total_print

打印合计

vat_invoice_note_correct_code

备注校验码

vat_invoice_machine_no

机器编号

vat_invoice_daima_print

打印发票代码

vat_invoice_elec_payment_id

电子支付标识

vat_invoice_issue_date_print

右侧打印开票日期

vat_invoice_qr_code

qr

vat_invoice_credit_memo

红冲/非红冲

sub_type

子类型

vat_invoice_qr_code

qr

vat_invoice_tax

税额明细

vat_invoice_tax_rate

税率明细

vat_invoice_price

金额明细

vat_invoice_electrans_unit_price

单价明细

vat_invoice_electrans_quantity

数量明细

vat_invoice_electrans_unit

单位明细

vat_invoice_plate_specific

规格型号

vat_invoice_goods

货物或服务名称

typemotor_vehicle_sale_invoice, key返回的类型列表:

字段

说明

vehicle_invoice_buyer

购买方名称

vehicle_invoice_buyer_id

购买方名称的身份证号码或组织机构代码

vehicle_invoice_car_model

厂牌型号

vehicle_invoice_car_made_place

产地

vehicle_invoice_cert_id

合格证号

vehicle_invoice_engine_id

发动机号码

vehicle_invoice_car_vin

车辆识别代号/车架号

vehicle_invoice_total_price

价税合计

vehicle_invoice_total_price_digits

价税合计小写

vehicle_invoice_price_without_tax

不含税价

vehicle_invoice_tax_rate

税率

vehicle_invoice_tax_amount

税额

vehicle_invoice_telephone

电话

vehicle_invoice_issue_date

开票日期

vehicle_invoice_daima

发票代码

vehicle_invoice_haoma

发票号码

vehicle_invoice_dealer

销货单位

vehicle_invoice_jida_daima

机打代码

vehicle_invoice_jida_haoma

机打号码

vehicle_invoice_machine_id

机器编码

vehicle_invoice_tax_author_id

主管税务代码

vehicle_invoice_tax_author_name

主管税务机关

vehicle_invoice_seller_bank_name

开户银行

vehicle_invoice_seller_bank_account

账号

vehicle_invoice_seller_tax_id

纳税人识别号

vehicle_invoice_commodity_inspection_id

商检单号

vehicle_invoice_import_certificate_id

进口证明书号

vehicle_invoice_seller_address

地址

vehicle_invoice_tax_payment_certificate_number

完税凭证号

vehicle_invoice_issued_by

开票人

vehicle_invoice_tax_code

税控码

vehicle_invoice_limit_number

限乘人数

vehicle_invoice_vehicle_type

车辆类型

vehicle_invoice_tonnage

吨位

vehicle_invoice_page_number

发票联

vehicle_invoice_qr_code

二维码

vehicle_invoice_buyer_tax_id

购方纳税人识别号

typeused_car_purchase_invoice, key返回的类型列表:

字段

说明

vehicle_invoice_daima

购车发票代码

vehicle_invoice_haoma

购车发票号码

vehicle_invoice_buyer

购货单位()

vehicle_invoice_buyer_id

购买身份证号码/组织机构代码

vehicle_invoice_buyer_addr

购买方地址

vehicle_invoice_buyer_phone

购买方电话号码

vehicle_invoice_seller

卖方单位()

vehicle_invoice_seller_id

卖方身份证号码/组织机构代码

vehicle_invoice_seller_addr

卖方地址

vehicle_invoice_seller_phone

卖方电话号码

vehicle_invoice_plate_num

车牌照号

vehicle_invoice_register_num

登记证号

vehicle_invoice_vehicle_type

车辆类型

vehicle_invoice_vin

车架号/车辆识别代码

vehicle_invoice_car_model

厂牌型号

vehicle_invoice_dmv

转入地车辆管理所名称

vehicle_invoice_price_total_price

价税合计

vehicle_invoice_total_price_digits

价税合计小写

vehicle_invoice_auction_house

经营、拍卖单位

vehicle_invoice_auction_house_addr

经营、拍卖单位地址

vehicle_invoice_auction_house_tax_id

经营、拍卖单位纳税人识别号

vehicle_invoice_auction_house_bank_account

经营、拍卖单位开户银行、账号

vehicle_invoice_auction_house_phone

经营、拍卖单位电话

vehicle_invoice_market

二手车市场

vehicle_invoice_market_addr

二手车市场地址

vehicle_invoice_market_tax_id

二手车市场纳税人识别号

vehicle_invoice_market_bank_acount

二手车市场开户银行、账号

vehicle_invoice_market_phone

二手车市场电话

vehicle_invoice_note

备注

vehicle_invoice_issue_date

购车发票开票日期

exist_stample

盖章存在性判断

typevat_roll_invoice, key返回的类型列表:

字段

说明

invoice_head

发票票头

invoice_number

发票号码

invoice_code

发票代码

machine_number

机器号码

machine_code

机器编码

total_money

合计金额(小写)

total_money_big

合计金额(大写)

date_of_invoice

开票日期

check_number

校验码

buy_name

购方名称

buy_tax_number

购方纳税人识别号

sold_name

销方名称

sold_tax_number

销方纳税人识别号

cashier_name

收款员

typevehicle_toll, key返回的类型列表:

字段

说明

toll_code

车辆通行费代码

toll_number

车辆通行费号码

date

收费时间

time

收费时间

money

收费金额

typequota_invoice, key返回的类型列表:

字段

说明

quota_invoice_code

发票代码

quota_invoice_number

发票号码

money_small

金额(小写)

money_big

金额(大写)

location

发票所在地

typetaxi_ticket, key返回的类型列表:

字段

说明

invoice_code

发票代码

invoice_no

发票号码

date

日期

taxi_no

车号

boarding_time

上车时间

landing_time

下车时间

mileage

里程

sum

金额

location

发票所在地

typeair_transport, key返回的类型列表:

字段

说明

passenger_name

旅客姓名

id_no

身份证件号码

serial_number

印刷序号

total

合计金额

fare

票价

civil_aviation_fund

民航发展基金

fuel_surcharge

燃油附加费

other_taxes

其他税费

issued_date

填开日期

issued_by

填开单位

e_ticket_no

电子客票号码

from

出发站

to

到达站

flight_number

航班号

seat_class

座位等级

date

航班日期

time

航班时间

fare_basis

客票级别

typetrain_ticket, key返回的类型列表:

字段

说明

passenger_name

乘客名称

passenger_id

乘客身份证

train_number

车次号

departure_station

出发地

departure_date

乘车时间

class

座位类别

ticket_number

火车票红色编码

arrival_station

目的地

seat_number

座位号

price

价格

check

检票口

ticket_id

火车票ID

typegeneral_machine_invoiceshipping_invoice, key返回的类型列表:

字段

说明

invoice_code

发票代码

invoice_number

发票号码

money

金额

date

日期

time

时间

object_keyhighway_passenger_invoicepassenger_transport_invoice, key返回的类型列表:

字段

说明

invoice_code

发票代码

invoice_number

发票号码

money

金额

date

日期

time

时间

passenger_name

乘客姓名

passenger_id

乘客身份证号码

typeparking_invoice, key返回的类型列表:

字段

说明

invoice_number

发票号码

money

金额

typevat_invoice_sales_list, key返回的类型列表:

字段

说明

purchaser_name

购买方名称

seller_name

销售方名称

invoice_code

发票代码

invoice_number

发票号码

total_page

合计页码

page

当前页码

total

金额合计

tax_total

税额合计

has_stamp

销售方盖章存在性判断

issued_date

填开日期

typeshop_receipt, key返回的类型列表:

字段

说明

money

金额

date

时间

no

单号

shop

商户

sku

商品

typeeducation_receiptvat_transport_invoice, 目前仅支持分类,暂无结构化识别。

正常返回示例

{

    "code":200,

    "message":"success",

    "result":{

        "object_list":[

            {

                "image_angle":270,

                "rotated_image_width":1440,

                "rotated_image_height":1080,

                "position":[

                    300,

                    394,

                    1059,

                    411,

                    1059,

                    481,

                    300,

                    459

                ],

                "class":"local_invoice",

                "type":"quota_invoice",

                "type_description":"通用定额发票",

                "item_list":[

                    {

                        "key":"quota_invoice_code",

                        "value":"131001827953",

                        "position":[

                            752,

                            532,

                            1256,

                            535,

                            1256,

                            573,

                            752,

                            567

                        ],

                        "description":"发票代码"

                    },

                    {

                        "key":"money_small",

                        "value":"10.00",

                        "position":[

                            300,

                            394,

                            1059,

                            411,

                            1059,

                            481,

                            300,

                            459

                        ],

                        "description":"金额(小写)"

                    }

                ]

            },

            {

                "image_angle":270,

                "rotated_image_width":1330,

                "rotated_image_height":1280,

                "position":[

                    300,

                    394,

                    1059,

                    411,

                    1059,

                    481,

                    300,

                    459

                ],

                "class":"other",

                "type":"train_ticket",

                "type_description":"火车票",

                "item_list":[

                    {

                        "key":"departure_station",

                        "value":"上海站",

                        "position":[

                            126,

                            275,

                            700,

                            270,

                            700,

                            311,

                            126,

                            320

                        ],

                        "description":"出发地"

                    },

                    {

                        "key":"arrival_station",

                        "value":"131001827953",

                        "position":[

                            177,

                            159,

                            1127,

                            149,

                            1127,

                            206,

                            177,

                            217

                        ],

                        "description":"目的地"

                    }

                ]

            }

        ]

    }

}

 


错误码

识别服务返回的code与message定义:

code message 含义
200 Success 请求成功
500 Server error 服务器内部错误
40001 Access server error 验证服务器错误,请再次请求, 如果持续出现此类错误,请联系技术支持团队
40002 Service temporarily unavailable 服务暂不可用,请再次请求, 如果持续出现此类错误,请联系技术支持团队
40003 Unsupported openapi method 调用的API不存在,请检查后重新尝试
40004 Open api request limit reached 集群超限额
40017 Open api daily request limit reached 每天请求量超限额
40018 Open api qps request limit reached QPS超限额
40019 Open api total request limit reached 请求总量超限额
40020 Open api daily testing limit reached. 今日测试次数已达上限
40100 Empty App key or app secret app_key 或 app_secret 为空
40101 App does not exist 实例不存在,请检查 app_key
40102 Invalid app secret 实例验证失败,请检查 app_secret
40103 Invalid App 实例已失效
40104 App has expired 实例已超过有效期
40105 Invalid IP source 无效的IP来源
40106 App does not match service 实例与service不匹配
40107 App has been overdrawn by 5% of the total count. Please use it after recharging. 实例额度已透支总额度的5%,请充值后使用
40110 App key or app secret invalid app_key 或 app_secret无效
40200 Internal error 服务器内部错误
40201 Not enough param 缺少必须的参数,请检查参数是否有遗漏
40202 Service not support 请求了不支持的服务,请检查调用的url
40300 Empty image 图片为空,请检查后重新尝试
40301 Image format error 上传的图片格式错误,现阶段我们支持的图片格式为:PNG、JPG、JPEG、BMP,请进行转码或更换图片
40302 Image size error 上传的图片大小错误
40303 File type unsupport 文件类型不支持
40400 Recognize error 识别错误,请再次请求
40401 Image recognize error 图像识别错误
40500 Classify failed 未能成功分类
40600 Missing request body 缺少 request body
50001 Time out 超时
90099 Unknown error 未知错误