功能描述
对多种国内通用票据进行识别,并将结果进行结构化匹配,以JSON格式返回。
支持PDF(多页)、OFD(多页)、JPG、PNG、TIFF、单帧GIF格式的文件上传和识别。当单页内包含多张票据时,支持识别并切分出各张票据,分别进行识别。
支持29类票据,种类包括:
Type |
票据大类 |
air_transport |
行程单 |
blockchain_electronic_invoice |
区块链电子发票 |
education_receipt |
教育费收据 |
general_machine_invoice |
通用机打发票 |
highway_passenger_invoice |
公路客运发票 |
machine_printed_invoice |
机打发票 |
medical_receipt |
医疗费收据 |
motor_vehicle_sale_invoice |
机动车销售统一发票 |
non_tax_income_unified_bill |
非税收入票据 |
parking_invoice |
停车费发票 |
passenger_transport_invoice |
旅客运输普票 |
quota_invoice |
通用定额发票 |
shipping_invoice |
船运客票 |
shop_receipt |
商户小票 |
taxi_ticket |
出租车发票 |
train_ticket |
火车票 |
travel_transport |
出行行程单 |
used_car_purchase_invoice |
二手车销售统一发票 |
vat_common_invoice |
增值税普通发票 |
vat_electronic_invoice |
增值税电子普通发票 |
vat_electronic_special_invoice |
增值税电子专用发票 |
vat_electronic_invoice_new |
电子发票(普通发票) |
vat_electronic_toll_invoice |
增值税电子普通发票(通行费) |
vat_electronic_special_invoice_new |
电子发票(增值税专用发票) |
vat_invoice_sales_list |
增值税销货清单 |
vat_roll_invoice |
增值税普通发票(卷票) |
vat_special_invoice |
增值税专用发票 |
vat_transport_invoice |
货物运输业增值税专用发票 |
vehicle_toll |
过路过桥费发票 |
other |
其他 |
请求URL
https://api.textin.com/ai/service/v1/receipt_crop_and_recog_multi
HTTP请求方法
HTTP POST
请求头说明(Request Header)
请在HTTP请求中添加以下自定义Header。
header 名 |
值 |
x-ti-app-id |
请登录后前往 “工作台-账号设置-开发者信息” 查看 x-ti-app-id |
x-ti-secret-code |
请登录后前往 “工作台-账号设置-开发者信息” 查看 x-ti-secret-code |
URL 参数(Parameters)
参数名 |
数据类型 |
是否必填 |
允许的值 |
默认值 |
描述 |
return_ocr_result |
integer |
否 |
0,1 |
0 |
返回全文结果,1为输出全文,0为不输出全文 |
crop_complete_image |
integer |
否 |
0,1 |
0 |
选择是否需要输出各票据图片,1为输出各票据切片base64编码,0为不输出各票据图片 |
crop_value_image |
integer |
否 |
0,1 |
0 |
选择是否返回关键字段切图图片,1为输出字段图片,0为不输出字段图片 |
confidence |
integer |
否 |
0,1 |
0 |
支持返回置信度,1为返回置信度,0为不返回置信度 |
merge_digital_elec_invoice |
integer |
否 |
0,1 |
0 |
支持将多页全电票的结果合并为一页,1为合并,0为不合并 |
coord_restore |
integer |
否 |
0,1 |
0 |
是否将item_list中字段坐标映射到原图,1为映射到原图,0为映射到切边图 |
请求体说明(Request Body)
Content-Type: application/octet-stream
目前支持PDF(多页)、OFD(多页)、JPG、PNG、TIFF、单帧GIF格式的文件上传和识别.
请注意,请求体的数据格式为文件的二进制流,非 FormData 或其他格式。文件大小不超过 30M,图像宽高须介于 20 和 10000(像素)之间。
响应体说明(Response Data)
Content-Type:application/json
JSON结构说明如下:
- type: object
- description: 响应体
- properties:
- pageNum:
- type: integer
- description: 总页数
- example: 1
- pages:
- type: array
- description: 样本每页的识别结果
- items:
- type: object
- required:
- properties:
- result:
- type: object
- properties:
- object_list:
- allOf:
- $ref: '#/components/schemas/ObjectList'
- duration:
- type: integer
- description: 识别耗时
- example: 7700
- page_number:
- type: integer
- description: 页码, 从0开始计算
- example: 0
响应字段说明:
字段名 |
描述 |
type |
切分后单张票据类型 |
type_description |
切分后单张票据类型中文描述 |
image_angle |
切分后单张票据的角度 |
rotated_image_width |
切分后单张票据转正后的宽度 |
rotated_image_height |
切分后单张票据转正后的高度 |
kind |
切分后单张票据的使用类型 |
kind_description |
切分后单张票据使用类型中文描述 |
position |
切分后单张票据在原图中的坐标位置 |
Type字段枚举值
Type |
中文描述 |
air_transport |
行程单 |
blockchain_electronic_invoice |
区块链电子发票 |
education_receipt |
教育费收据 |
general_machine_invoice |
通用机打发票 |
highway_passenger_invoice |
公路客运发票 |
machine_printed_invoice |
机打发票 |
medical_receipt |
医疗费收据 |
motor_vehicle_sale_invoice |
机动车销售统一发票 |
non_tax_income_unified_bill |
非税收入票据 |
parking_invoice |
停车费发票 |
passenger_transport_invoice |
旅客运输普票 |
quota_invoice |
通用定额发票 |
shipping_invoice |
船运客票 |
shop_receipt |
商户小票 |
taxi_ticket |
出租车发票 |
train_ticket |
火车票 |
travel_transport |
出行行程单 |
used_car_purchase_invoice |
二手车销售统一发票 |
vat_common_invoice |
增值税普通发票 |
vat_electronic_invoice |
增值税电子普通发票 |
vat_electronic_special_invoice |
增值税电子专用发票 |
vat_electronic_invoice_new |
电子发票(普通发票) |
vat_electronic_toll_invoice |
增值税电子普通发票(通行费) |
vat_electronic_special_invoice_new |
电子发票(增值税专用发票) |
vat_invoice_sales_list |
增值税销货清单 |
vat_roll_invoice |
增值税普通发票(卷票) |
vat_special_invoice |
增值税专用发票 |
vat_transport_invoice |
货物运输业增值税专用发票 |
vehicle_toll |
过路过桥费发票 |
other |
其他 |
Kind字段枚举值
Kind |
中文描述 |
communication |
通讯 |
daily |
日用 |
digital_appliance |
数码电器 |
education |
教育 |
foodstuff |
食品 |
lodging |
住宿 |
medical_treatment |
医疗 |
office |
办公 |
other |
其他 |
post |
邮寄 |
raiment |
服饰 |
rent_decoration |
房租装饰 |
repast |
餐饮 |
service |
服务 |
traffic |
交通 |
vehicle |
用车 |
字段说明
Type_air_transport
Item List
字段名 |
中文描述 |
agentcode |
销售单位代号 |
civil_aviation_fund |
民航发展基金 |
e_ticket_no |
电子客票号码 |
fare |
票价 |
fuel_surcharge |
燃油附加费 |
id_no |
身份证件号码 |
insurance |
保险 |
issued_by |
填开单位 |
issued_date |
填开日期 |
other_taxes |
其他税费 |
passenger_name |
旅客姓名 |
restriction |
签注 |
serial_number |
印刷序号 |
total |
合计金额 |
exist_invoice_seal |
发票专用章存在性判断 |
Flight Data List
字段名 |
中文描述 |
from |
出发站 |
to |
到达站 |
carrier |
承运人 |
flight_number |
航班号 |
seat_class |
座位等级 |
date |
航班日期 |
time |
航班时间 |
fare_basis |
客票级别 |
allow |
行李 |
Type_train_ticket
Item List
字段名 |
中文描述 |
ticket_number |
火车票红色编码 |
boarding_gate |
检票口 |
check |
检票口 |
departure_station |
出发地 |
train_number |
车次号 |
arrival_station |
目的地 |
departure_date |
乘车时间 |
seat_number |
座位号 |
price |
价格 |
class |
座位类别 |
passenger_id |
乘客身份证 |
passenger_name |
乘客名称 |
ticket_id |
火车票ID |
code |
发票代码 |
number |
发票号码(ticket_id后七位) |
is_refund |
是否退票费 |
Type_vat_invoice_sales_list
Item List
字段名 |
中文描述 |
purchaser_name |
购买方名称 |
seller_name |
销售方名称 |
invoice_code |
发票代码 |
invoice_number |
发票号码 |
total_page |
合计页码 |
page |
当前页码 |
total |
金额合计 |
tax_total |
税额合计 |
has_stamp |
销售方盖章存在性判断 |
issued_date |
填开日期 |
exist_invoice_seal |
发票专用章存在性判断 |
tax_subtotal |
税额小计 |
subtotal |
金额小计 |
Type_shop_receipt
item_list
字段名 |
中文描述 |
key |
识别字段key |
money |
金额 |
no |
单号 |
date |
时间 |
shop |
商户 |
sku |
商品 |
Type_travel_transport
item_list
字段名 |
中文描述 |
key |
识别字段key |
apply_date |
申请日期 |
start_date |
起始时间 |
end_date |
结束时间 |
phone_number |
行程人手机号 |
total_money |
合计金额 |
Type_non_tax_income_unified_bill
item_list
字段名 |
中文描述 |
key |
识别字段key |
PayerPartyName |
交款人名称 |
EInvoiceNumber |
电子票据号码 |
RandomNumber |
校验码 |
IssuedDate |
开票日期 |
ItemCode |
项目编码 |
ItemName |
项目名称 |
ItemUnit |
单位 |
ItemQuantity |
数量 |
ItemStd |
标准 |
ItemAmount |
金额 |
ItemExt |
明细信息扩展 |
TotalAmount_Words |
金额大写 |
TotalAmount |
总金额 |
Checker |
复核人 |
EInvoiceCode |
电子票据代码 |
PayerPartyCode |
交款人代码 |
RecName |
收款人全称 |
InvoicingPartyName |
开票单位名称 |
Remark |
备注 |
Type_general_machine_invoice
item_list
字段名 |
中文描述 |
invoice_code |
发票代码 |
invoice_number |
发票号码 |
money |
金额 |
date |
日期 |
time |
时间 |
buyer |
付款方名称 |
buyer_tax_id |
付款方证件号 |
seller |
收款方名称 |
seller_tax_id |
收款方证件号 |
machine_printed_number |
机打号码 |
exist_invoice_seal |
发票专用章存在性判断 |
Type_highway_passenger_invoice
item_list
字段名 |
中文描述 |
invoice_code |
发票代码 |
invoice_number |
发票号码 |
money |
金额 |
date |
日期 |
time |
时间 |
passenger_name |
乘客姓名 |
passenger_id |
乘客身份证号码 |
exist_invoice_seal |
发票专用章存在性判断 |
Type_medical_receipt
item_list
字段名 |
中文描述 |
transaction_number |
交易流水号 |
workflow_number |
业务流水号 |
invoice_bar_code |
票据条码 |
invoice_number |
票据编号 |
medical_institution_type |
医疗机构类型 |
name |
姓名 |
sex |
性别 |
medical_insurance_type |
医保类型 |
social_security_number |
社会保障卡号 |
amount_big |
大写合计 |
amount_small |
小写合计 |
exist_invoice_seal |
发票专用章存在性判断 |
Type_motor_vehicle_sale_invoice
item_list
字段名 |
中文描述 |
type |
类型 |
vehicle_invoice_buyer |
购方名称 |
vehicle_invoice_buyer_id |
购方身份证号码/组织机构代码 |
vehicle_invoice_buyer_tax_id |
购方纳税人识别号 |
vehicle_invoice_car_made_place |
产地 |
vehicle_invoice_car_model |
厂牌型号 |
vehicle_invoice_car_vin |
车辆识别代号/车驾号码 |
vehicle_invoice_cert_id |
合格证号 |
vehicle_invoice_commodity_inspection_id |
商检单号 |
vehicle_invoice_daima |
发票代码 |
vehicle_invoice_dealer |
销方名称 |
vehicle_invoice_engine_id |
发动机号码 |
vehicle_invoice_haoma |
发票号码 |
vehicle_invoice_import_certificate_id |
进口证明书号 |
vehicle_invoice_issue_date |
开票日期 |
vehicle_invoice_issued_by |
开票人 |
vehicle_invoice_jida_daima |
机打代码 |
vehicle_invoice_jida_haoma |
机打号码 |
vehicle_invoice_limit_number |
限乘人数 |
vehicle_invoice_machine_id |
机器编号 |
vehicle_invoice_page_number |
发票联 |
vehicle_invoice_price_without_tax |
不含税价 |
vehicle_invoice_qr_code |
二维码 |
vehicle_invoice_seller_address |
销方地址 |
vehicle_invoice_seller_bank_account |
销方账号 |
vehicle_invoice_seller_bank_name |
销方开户银行 |
vehicle_invoice_seller_tax_id |
销方纳税人识别号 |
vehicle_invoice_tax_amount |
增值税税额 |
vehicle_invoice_tax_author_id |
主管税务机关代码 |
vehicle_invoice_tax_author_name |
主管税务机关 |
vehicle_invoice_tax_authorith |
主管税务机关 |
vehicle_invoice_tax_authorith_id |
主管税务机关代码 |
vehicle_invoice_tax_code |
税控码 |
vehicle_invoice_tax_payment_certificate_number |
完税凭证号 |
vehicle_invoice_tax_rate |
增值税税率 |
vehicle_invoice_telephone |
销方电话 |
vehicle_invoice_tonnage |
吨位 |
vehicle_invoice_total_price |
价税合计 |
vehicle_invoice_total_price_digits |
价税合计小写 |
vehicle_invoice_vehicle_type |
车辆类型 |
exist_invoice_seal |
发票专用章存在性判断 |
Type_parking_invoice
item_list
字段名 |
中文描述 |
type |
类型 |
class |
大类类型 |
invoice_number |
发票号码 |
money |
金额 |
exist_invoice_seal |
发票专用章存在性判断 |
Type_passenger_transport_invoice
item_list
字段名 |
中文描述 |
type |
类型 |
class |
大类类型 |
invoice_code |
发票代码 |
invoice_number |
发票号码 |
money |
金额 |
date |
日期 |
time |
时间 |
passenger_name |
乘客姓名 |
passenger_id |
乘客身份证号码 |
exist_invoice_seal |
发票专用章存在性判断 |
Type_quota_invoice
item_list
字段名 |
中文描述 |
quota_invoice_code |
发票代码 |
quota_invoice_number |
发票号码 |
location |
发票所在地 |
money_small |
金额(小写) |
money_big |
金额(大写) |
exist_invoice_seal |
发票专用章存在性判断 |
Type_shipping_invoice
item_list
字段名 |
中文描述 |
type |
类型 |
class |
大类类型 |
invoice_code |
发票代码 |
invoice_number |
发票号码 |
money |
总金额 |
date |
日期 |
time |
时间 |
passenger |
乘船人 |
departure |
出发点 |
arrival |
到达点 |
exist_invoice_seal |
发票专用章存在性判断 |
Type_taxi_ticket
item_list
字段名 |
中文描述 |
invoice_code |
发票代码 |
invoice_no |
发票号码 |
date |
日期 |
taxi_no |
车号 |
boarding_time |
上车时间 |
landing_time |
下车时间 |
mileage |
里程 |
sum |
总计金额 |
price |
票面金额 |
oil |
燃油附加费 |
location |
发票所在地 |
exist_invoice_seal |
发票专用章存在性判断 |
Type_used_car_purchase_invoice:
Item List
字段名 |
中文描述 |
type |
类型 |
vehicle_invoice_auction_house |
经营、拍卖单位 |
vehicle_invoice_auction_house_addr |
经营、拍卖单位地址 |
vehicle_invoice_auction_house_bank_account |
经营、拍卖单位开户银行、账号 |
vehicle_invoice_auction_house_phone |
经营、拍卖单位电话 |
vehicle_invoice_auction_house_tax_id |
经营、拍卖单位纳税人识别号 |
vehicle_invoice_buyer |
买方单位/个人 |
vehicle_invoice_buyer_addr |
买方地址 |
vehicle_invoice_buyer_id |
买方单位代码/身份证号码 |
vehicle_invoice_buyer_phone |
买方电话号码 |
vehicle_invoice_car_model |
厂牌型号 |
vehicle_invoice_daima |
发票代码 |
vehicle_invoice_dmv |
转入地车辆管理所名称 |
vehicle_invoice_haoma |
发票号码 |
vehicle_invoice_issue_date |
开票日期 |
vehicle_invoice_market |
二手车市场 |
vehicle_invoice_market_addr |
二手车市场地址 |
vehicle_invoice_market_bank_acount |
二手车市场开户银行、账号 |
vehicle_invoice_market_phone |
二手车市场电话 |
vehicle_invoice_market_tax_id |
二手车市场纳税人识别号 |
vehicle_invoice_note |
备注 |
vehicle_invoice_plate_num |
车牌照号 |
vehicle_invoice_price_total_price |
车价合计 |
vehicle_invoice_qr_code |
二维码 |
vehicle_invoice_register_num |
登记证号 |
vehicle_invoice_seller |
卖方单位/个人 |
vehicle_invoice_seller_addr |
卖方地址 |
vehicle_invoice_seller_id |
卖方单位代码/身份证号码 |
vehicle_invoice_seller_phone |
卖方电话号码 |
vehicle_invoice_total_price_digits |
车价合计小写 |
vehicle_invoice_vehicle_type |
车辆类型 |
vehicle_invoice_vin |
车架号/车辆识别代码 |
exist_invoice_seal |
发票专用章存在性判断 |
vehicle_invoice_machine_id |
机器编号 |
vehicle_invoice_tax_code |
税控码 |
以下票据共用一个字段表:
Type_vat_transport_invoice:
Type_vat_roll_invoice:
Item List
字段名 |
中文描述 |
invoice_head |
发票票头 |
invoice_code |
发票代码 |
invoice_number |
发票号码 |
machine_number |
机器号码 |
machine_code |
机器编码 |
sold_name |
销方名称 |
sold_tax_number |
销方纳税人识别号 |
date_of_invoice |
开票日期 |
cashier_name |
收款员 |
buy_name |
购方名称 |
buy_tax_number |
购方纳税人识别号 |
goods_name_list |
项目名称明细 |
goods_unit_price_list |
项目单价明细 |
goods_number_list |
项目数量明细 |
goods_money_list |
项目金额明细 |
total_money |
合计金额(小写) |
total_money_big |
合计金额(大写) |
check_number |
校验码 |
exist_invoice_seal |
发票专用章存在性判断 |
vat_invoice_seller_id_invoice_seal |
销售方纳税人识别号-印章 |
以下票据共用一个字段表:
Type_blockchain_electronic_invoice:
Type_machine_printed_invoice:
Type_vat_common_invoice:
Type_vat_special_invoice:
Type_vat_electronic_invoice:
Type_vat_electronic_special_invoice:
Type_vat_electronic_invoice_new:
Type_vat_electronic_special_invoice_new:
Type_vat_electronic_toll_invoice:
Item List
字段名 |
中文描述 |
vat_invoice_cipher_field |
密码区 |
vat_invoice_correct_code |
校验码 |
vat_invoice_corrent_code_print |
打印校验码 |
vat_invoice_credit_memo |
红冲/非红冲 |
vat_invoice_dai_kai_flag |
代开(非代开条目为空) |
vat_invoice_daima |
发票代码 |
vat_invoice_daima_print |
打印发票代码 |
vat_invoice_daima_right_side |
右侧打印发票代码 |
vat_invoice_drawer |
开票人 |
vat_invoice_elec_payment_id |
购买方电子支付标识 |
vat_invoice_electrans_quantity |
数量 |
vat_invoice_electrans_unit |
单位 |
vat_invoice_electrans_unit_price |
单价 |
vat_invoice_goods_list |
货物或应税劳务、服务名称/项目名称 |
vat_invoice_goods_type_list |
类型 |
vat_invoice_haoma |
发票号码 |
vat_invoice_haoma_large_size |
增值税发票No号码 |
vat_invoice_haoma_right_side |
右侧打印发票号码 |
vat_invoice_headline_page_number |
标题发票联 |
vat_invoice_issue_date |
开票日期 |
vat_invoice_issue_date_print |
右侧打印开票日期 |
vat_invoice_license_plate_number |
车牌号 |
vat_invoice_machine_no |
机器编号 |
vat_invoice_note_correct_code |
备注校验码 |
vat_invoice_page_number |
发票联/抵扣联 |
vat_invoice_pass_end_date |
通行日期止 |
vat_invoice_pass_start_date |
通行日期起 |
vat_invoice_payee |
收款人 |
vat_invoice_payer_addr_tell |
购买方地址、电话 |
vat_invoice_payer_bank_account |
购买方开户行及账号 |
vat_invoice_payer_name |
购买方名称 |
vat_invoice_plate_specific |
规格型号 |
vat_invoice_price_list |
金额明细 |
vat_invoice_qr_code |
qr码 |
vat_invoice_rate_payer_id |
购买方纳税人识别号 |
vat_invoice_review |
复核 |
vat_invoice_seller_addr_tell |
销售方地址、电话 |
vat_invoice_seller_bank_account |
销售方开户行及账号 |
vat_invoice_seller_id |
销售方纳税人识别号 |
vat_invoice_seller_name |
销售方名称 |
vat_invoice_tax_list |
税额明细 |
vat_invoice_tax_rate |
税率 |
vat_invoice_tax_rate_list |
税率明细 |
vat_invoice_tax_total |
税额合计 |
vat_invoice_total |
合计 |
vat_invoice_total_cover_tax |
价税合计大写 |
vat_invoice_total_cover_tax_digits |
价税合计小写 |
vat_invoice_total_note |
备注 |
vat_invoice_total_print |
打印合计 |
exist_stample |
盖章存在性判断 |
exist_invoice_seal |
发票专用章存在性判断 |
vat_invoice_note_handwrite |
备注手写 |
vat_invoice_seller_id_invoice_seal |
销售方纳税人识别号-印章 |
vat_invoice_quandianfapiao_flag |
判断是否全电票 |
exist_manufacture_supervising_seal |
监制章存在性判断 |
digital_elec_invoice_number |
数电票号码 |
is_oil_products |
是否成品油 |
Type_vehicle_toll:
Item List
字段名 |
中文描述 |
toll_code |
车辆通行费代码 |
toll_number |
车辆通行费号码 |
money |
收费金额 |
date |
收费日期 |
time |
收费时间 |
exist_invoice_seal |
发票专用章存在性判断 |
location |
发票所在地 |
Type_other
JSON结构示例
json
{
"code": 0,
"message": "success",
"page_count": 1,
"pages": [
{
"page_number": 0,
"cost_time": 1234,
"result": {
"object_list": [
{
"image_angle": 0,
"rotated_image_width": 1000,
"rotated_image_height": 500,
"position": [0, 0, 1000, 0, 1000, 500, 0, 500],
"class": "vat_invoice",
"type": "vat_special_invoice",
"type_description": "增值税专用发票",
"kind": "service",
"kind_description": "服务",
"item_list": [
{
"key": "vat_invoice_daima",
"value": "12345678",
"position": [100, 100, 200, 100, 200, 200, 100, 200],
"description": "发票代码"
},
{
"key": "vat_invoice_haoma",
"value": "87654321",
"position": [300, 100, 400, 100, 400, 200, 300, 200],
"description": "发票号码"
}
],
"product_list": [
{
"key": "vat_invoice_goods",
"value": "商品名称",
"description": "货物或服务名称"
},
{
"key": "vat_invoice_price",
"value": "100.00",
"description": "金额明细"
}
]
}
]
}
}
]
}
错误码说明
错误码 |
描述 |
40101 |
x-ti-app-id 或 x-ti-secret-code 为空 |
40102 |
x-ti-app-id 或 x-ti-secret-code 无效,验证失败 |
40103 |
客户端IP不在白名单 |
40003 |
余额不足,请充值后再使用 |
40004 |
参数错误,请查看技术文档,检查传参 |
40007 |
机器人不存在或未发布 |
40008 |
机器人未开通,请至市场开通后重试 |
40301 |
图片类型不支持 |
40302 |
上传文件大小不符,文件大小不超过 30M |
40303 |
文件类型不支持 |
40304 |
图片尺寸不符,图像宽高须介于 20 和 10000(像素)之间 |
40305 |
识别文件未上传 |
30203 |
基础服务故障,请稍后重试 |
500 |
服务器内部错误 |