增值税发票识别 intsig API
开发环境
开发环境
POST
http[s]: //webapi.xfyun.cn/v1/service/v1/ocr/invoice
接口说明
#接口Demo
目前仅提供部分开发语言的demo,其他语言请参照下方接口文档进行开发。
也欢迎热心的开发者到 讯飞开放平台社区 分享你们的demo。
#接口要求
内容 | 说明 |
---|---|
请求协议 | http[s] (为提高安全性,强烈推荐https) |
请求地址 | http[s]: //webapi.xfyun.cn/v1/service/v1/ocr/invoice 注:服务器IP不固定,为保证您的接口稳定,请勿通过指定IP的方式调用接口,使用域名方式调用 |
请求方式 | POST |
接口鉴权 | 签名机制,见授权认证 |
字符编码 | UTF-8 |
响应格式 | 统一采用JSON格式 |
开发语言 | 任意,只要可以向讯飞云服务发起HTTP请求的均可 |
图片格式 | jpg/png/bmp |
图片属性 | 建议最短边至少15px,最长边最大4096px |
图片大小 | 图像数据按要求编码后(base64编码后进行urlencode)大小不超过4M |
#接口调用流程
1.
2.
3.
POST http[s]://webapi.xfyun.cn/v1/service/v1/ocr/invoice
#白名单
{
"code":"10105",
"desc":"illegal access|illegal client_ip",
"data":"",
"sid":"xxxxxx"
}
#接口请求参数
#请求头
#授权认证
参数 | 格式 | 说明 | 必须 |
---|---|---|---|
X-Appid | string | 讯飞开放平台注册申请应用的应用ID(appid) | 是 |
X-CurTime | string | 当前UTC时间戳 从1970年1月1日0点0 分0 秒开始到现在的秒数 | 是 |
X-Param | string | 相关参数JSON串经Base64编码后的字符串,详见业务参数 | 是 |
X-CheckSum | string | 令牌,计算方法:MD5(APIKey + X-CurTime + X-Param),三个值拼接的字符串,进行MD5哈希计算(32位小写) | 是 |
String APIKey="abcd1234";
String X-CurTime="1502607694";
String X-Param="eyAiYXVmIjogImF1ZGlvL0wxNjtyYXR...";
String X-CheckSum=MD5(apiKey + X-CurTime + X-Param);
#业务参数
参数 | 类型 | 必填 | 说明 | 示例 |
---|---|---|---|---|
engine_type | string | 是 | 识别类型 | invoice |
原始JSON串:
{
"engine_type":"invoice"
}
BASE64编码(即X-Param):
ewoJICAgICJsYW5ndWFnZSI6ICJlbiIsCgkgICAgInBvc2l0aW9uIjogImZhbHNlIgoJfQ==
#请求体
参数 | 类型 | 必须 | 说明 | 示例 |
---|---|---|---|---|
image | string | 是 | 图像数据 base64编码后进行urlencode,要求base64编码和urlencode后大小不超过4M 最短边至少15px,最长边最大4096px 支持jpg/png/bmp格式 | exSI6ICJ... |
一般基础类库会默认进行urlencode处理,请注意不要重复处理
调用示例
#视频教程
#常见问题
#集成增值税发票识别API时,对上传的图片有什么要求?
答:图片格式:jpg/png/bmp,图片属性:建议最短边至少15px,最长边最大4096px,图片大小:图像数据按要求编码后(base64编码后进行urlencode)大小不超过4M。 为提高识别率,增值税发票所在图片的位置需摆正,相对图片倾斜角度请勿过大,一般小于15度,否则导致识别错误。
#目前增值税发片识别支持哪些应用平台?
答:目前仅支持webai应用,暂不支持sdk应用接入。
#增值税发票识别的识别率是多少?
答:目前增值税发票识别识别准确率高达99.1%。
#按照规范上传的图片为什么识别不出增值税发票信息?
答:按照规范上传的图片还要注意图片的清晰度,否则也会对识别的结果产生影响。
#为什么我设置白名单之后还报10105( illegal client_ip)错误
答:用户的ip可能是多变的,多个IP都需要设置到白名单里面,最大数量是5个,超过这个ip量可申请线下取消ip白名单设置,同时注意下风险:请妥善保管您的appid和key, 否则一旦泄露任意终端(不受ip限制)都可使用您的服务。
#增值税发票识别的收费价格是多少?怎么购买?
答:每个账号免费领取一次3000服务量有效期90天,套餐一:1w次服务量/840元/年,套餐二:10w次服务量/8000元/年,套餐三:100w次服务量/50000元/年,可在控制台对应服务--->实时用量--->购买服务量,套餐详细说明页 。
请求示例请求示例
Shell
JavaScript
Java
Swift
curl --location -g --request POST 'http://dev-cn.your-api-server.comhttp[s]: //webapi.xfyun.cn/v1/service/v1/ocr/invoice'
响应示例响应示例
200 - 示例 1
{
"code": "string",
"data": {
"error_code": 0,
"error_msg": "string",
"time_cost": {
"preprocess": 0,
"recognize": 0
},
"type": "string",
"vat_invoice_correct_code": "string",
"vat_invoice_correct_code_pos": {
"height": 0,
"left": 0,
"top": 0,
"width": 0
},
"vat_invoice_daima": "string",
"vat_invoice_daima_pos": {
"height": 0,
"left": 0,
"top": 0,
"width": 0
},
"vat_invoice_goods_list": "string",
"vat_invoice_goods_list_pos": {
"height": 0,
"left": 0,
"top": 0,
"width": 0
},
"vat_invoice_haoma": "string",
"vat_invoice_haoma_pos": {
"height": 0,
"left": 0,
"top": 0,
"width": 0
},
"vat_invoice_issue_date": "string",
"vat_invoice_issue_date_pos": {
"height": 0,
"left": 0,
"top": 0,
"width": 0
},
"vat_invoice_payer_name": "string",
"vat_invoice_payer_name_pos": {
"height": 0,
"left": 0,
"top": 0,
"width": 0
},
"vat_invoice_price_list": "string",
"vat_invoice_price_list_pos": {
"height": 0,
"left": 0,
"top": 0,
"width": 0
},
"vat_invoice_rate_payer_id": "string",
"vat_invoice_rate_payer_id_pos": {
"height": 0,
"left": 0,
"top": 0,
"width": 0
},
"vat_invoice_seller_addr_tell": "string",
"vat_invoice_seller_addr_tell_pos": {
"height": 0,
"left": 0,
"top": 0,
"width": 0
},
"vat_invoice_seller_bank_account": "string",
"vat_invoice_seller_bank_account_pos": {
"height": 0,
"left": 0,
"top": 0,
"width": 0
},
"vat_invoice_seller_id": "string",
"vat_invoice_seller_id_pos": {
"height": 0,
"left": 0,
"top": 0,
"width": 0
},
"vat_invoice_seller_name": "string",
"vat_invoice_seller_name_pos": {
"height": 0,
"left": 0,
"top": 0,
"width": 0
},
"vat_invoice_tax_list": "string",
"vat_invoice_tax_list_pos": {
"height": 0,
"left": 0,
"top": 0,
"width": 0
},
"vat_invoice_tax_rate": "string",
"vat_invoice_tax_rate_list": "string",
"vat_invoice_tax_rate_list_pos": {
"height": 0,
"left": 0,
"top": 0,
"width": 0
},
"vat_invoice_tax_rate_pos": {
"height": 0,
"left": 0,
"top": 0,
"width": 0
},
"vat_invoice_tax_total": "string",
"vat_invoice_tax_total_pos": {
"height": 0,
"left": 0,
"top": 0,
"width": 0
},
"vat_invoice_total": "string",
"vat_invoice_total_cover_tax": "string",
"vat_invoice_total_cover_tax_digits": "string",
"vat_invoice_total_cover_tax_digits_pos": {
"height": 0,
"left": 0,
"top": 0,
"width": 0
},
"vat_invoice_total_cover_tax_pos": {
"height": 0,
"left": 0,
"top": 0,
"width": 0
},
"vat_invoice_total_pos": {
"height": 0,
"left": 0,
"top": 0,
"width": 0
},
"vat_invoice_type": "string",
"vat_invoice_zhuan_yong_flag": "string"
},
"desc": "string",
"sid": "string"
}
请求参数
无
返回响应
修改于 2023-12-19 10:20:10