文档中心
API调试

功能描述

增值税发票

请求URL

https://api.textin.com/robot/v1.0/api/vat_invoice

HTTP请求方法

HTTP POST

请求头说明(Request Header)

请在HTTP请求中添加以下自定义Header。

header 名
x-ti-app-id 请登录后前往 “工作台-账号设置-开发者信息” 查看 x-ti-app-id
x-ti-secret-code 请登录后前往 “工作台-账号设置-开发者信息” 查看 x-ti-secret-code

请求体说明(Request Body)

Content-Type: application/octet-stream

要上传的图片,目前支持jpg, png, bmp, pdf(pdf只支持识别第一页), tiff, 单帧gif等大部分格式.

请注意,请求体的数据格式为文件的二进制流,非 FormData 或其他格式。文件大小不超过 10M,图像宽高须介于 20 和 10000(像素)之间。

响应体说明(Response Data)

Content-Type: application/json

JSON结构说明如下:

字段名 类型 描述
code integer 错误码,详见“错误码说明”
message string

错误信息

result object
+type string

票据类型, 当为other的时候,代表无法识别的图片

  • vat_special_invoice 增值税专用发票
  • vat_common_invoice 增值税普通发票
  • vat_electronic_invoice 增值税电子普通发票
  • vat_electronic_special_invoice 增值税电子专用发票
  • vat_electronic_toll_invoice 增值税电子普通发票(通行费)
  • blockchain_electronic_invoice 区块链电子发票
  • vat_electronic_invoice_new 电子发票(普通发票)
  • vat_electronic_special_invoice_new 电子发票(增值税专用发票)
  • other 其他
+type_description string

证件类型type中文描述

+image_angle integer

图片角度,指原图需要经过顺时针旋转多少度,才能得到正方向的图片

+rotated_image_width integer

正方向时图片的宽

+rotated_image_height integer

正方向时图片高

+kind string

票据用途

  • vehicle: 用车
  • education: 教育
  • traffic: 交通
  • office: 办公
  • daily: 日用
  • digital_appliance: 数码电器
  • rent_decoration: 房租装饰
  • communication: 通讯
  • lodging: 住宿
  • post: 邮寄
  • medical_treatment: 医疗
  • repast: 餐饮
  • foodstuff: 食品
  • raiment: 服饰
  • service: 服务
+kind_description string

票据用途中文描述

+item_list array
   ++key string

识别的字段

   ++value string

识别的字段的值

   ++description string

识别的字段中文描述

   ++position array

识别的value在原图中的坐标, 是个长度为8的数组 [0,1,2,3,4,5,6,7]

  • (0, 1) 左上角坐标
  • (2, 3) 右上角坐标
  • (4, 5) 左下角坐标
  • (6, 7) 右下角坐标

item_list 中识别字段的说明

字段名 描述
type 类型
exist_manufacture_supervising_seal 监制章存在性判断
exist_invoice_seal 发票专用章存在性判断
digital_elec_invoice_number 数电票号码
vat_invoice_cipher_field 密码区
vat_invoice_correct_code 校验码
vat_invoice_corrent_code_print 打印校验码
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_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_machine_no 机器编号
vat_invoice_note_correct_code 备注校验码
vat_invoice_page_number 抵扣联/发票联
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 打印合计
vat_invoice_type 发票类型
vat_invoice_zhuan_yong_flag 专票/普票
exist_stample 盖章存在性判断
vat_invoice_quandianfapiao_flag 判断是否全电票

JSON结构示例

{
  "code": 200,
  "message": "success",
  "result": {
    "item_list": [
      {
        "key": ""
      }
    ]
  }
}

错误码说明

错误码 描述
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 上传文件大小不符,文件大小不超过 10M
40303 文件类型不支持
40304 图片尺寸不符,图像宽高须介于 20 和 10000(像素)之间
40305 识别文件未上传
30203 基础服务故障,请稍后重试
500 服务器内部错误
官方社群
体验中心

联系我们