{
    "openapi": "3.0.0",
    "info": {
        "title": "发票识别 - API文档",
        "version": "1.0.0",
        "description": "增值税专票及普票快速识别，支持图片和PDF文件。其中imgdata应该传递图片的base64编码、imgurl应该为没有防盗链限制且带宽质量稳定的图片的url地址、pdfdata和ofddata应该为文件的base64编码。以上方式任选其一，文件不超过6M。"
    },
    "servers": [
        {
            "url": "https:\/\/apis.tianapi.com"
        }
    ],
    "paths": {
        "\/ocrinvoice\/index": {
            "post": {
                "summary": "发票识别",
                "tags": [
                    "发票识别"
                ],
                "description": "增值税发票识别，支持图片和PDF及OFD文件",
                "requestBody": {
                    "content": {
                        "application\/x-www-form-urlencoded": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "key": {
                                        "type": "string",
                                        "description": "API密钥"
                                    },
                                    "imgurl": {
                                        "type": "string",
                                        "example": "https:\/\/www.tianapi.com\/static\/img\/ocr\/invoice.jpg",
                                        "description": "图片url地址"
                                    },
                                    "imgdata": {
                                        "type": "string",
                                        "example": "img_base64",
                                        "description": "图片base64（与imgurl、pdfdata、ofddata四选一）"
                                    },
                                    "ofddata": {
                                        "type": "string",
                                        "example": "ofd_base64",
                                        "description": "ofd文件base64"
                                    },
                                    "pagenum": {
                                        "type": "string",
                                        "example": "1",
                                        "description": "pdf或ofd文件页码"
                                    },
                                    "pdfdata": {
                                        "type": "string",
                                        "example": "pdf_base64",
                                        "description": "pdf文件base64"
                                    }
                                },
                                "required": [
                                    "key",
                                    "imgdata"
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "成功响应",
                        "content": {
                            "application\/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "code": {
                                            "type": "string",
                                            "example": "044001505111",
                                            "description": "发票代码"
                                        },
                                        "date": {
                                            "type": "string",
                                            "example": "2020年06月18日",
                                            "description": "开票日期"
                                        },
                                        "type": {
                                            "type": "string",
                                            "example": "电子普通发票",
                                            "description": "发票类型"
                                        },
                                        "++num": {
                                            "type": "string",
                                            "example": "18",
                                            "description": "数量"
                                        },
                                        "payee": {
                                            "type": "string",
                                            "example": "刘晓敏",
                                            "description": "收款人"
                                        },
                                        "++name": {
                                            "type": "string",
                                            "example": "*信息技术服务*超级会员",
                                            "description": "货物名称"
                                        },
                                        "++unit": {
                                            "type": "string",
                                            "example": "月",
                                            "description": "单位"
                                        },
                                        "number": {
                                            "type": "string",
                                            "example": "93299183",
                                            "description": "发票号码"
                                        },
                                        "xftype": {
                                            "type": "string",
                                            "example": "服务",
                                            "description": "发票消费类型"
                                        },
                                        "++price": {
                                            "type": "string",
                                            "example": "8.33333333",
                                            "description": "单价"
                                        },
                                        "checker": {
                                            "type": "string",
                                            "example": "周旭寰",
                                            "description": "复核"
                                        },
                                        "remarks": {
                                            "type": "string",
                                            "description": "备注"
                                        },
                                        "typeorg": {
                                            "type": "string",
                                            "example": "广东增值税电子普通发票",
                                            "description": "发票名称"
                                        },
                                        "++taxfee": {
                                            "type": "string",
                                            "example": "9.00",
                                            "description": "税额"
                                        },
                                        "itemlist": {
                                            "type": "array",
                                            "items": {
                                                "type": "object"
                                            },
                                            "description": "价税详情"
                                        },
                                        "password": {
                                            "type": "string",
                                            "example": "37*2\/-3><2*65742041303357*9--",
                                            "description": "发票密码区"
                                        },
                                        "++taxrate": {
                                            "type": "string",
                                            "example": "6%",
                                            "description": "税率"
                                        },
                                        "checkcode": {
                                            "type": "string",
                                            "example": "72338486701337770072",
                                            "description": "校验码"
                                        },
                                        "total_fee": {
                                            "type": "string",
                                            "example": "159.00",
                                            "description": "价税合计(小写)"
                                        },
                                        "total_tax": {
                                            "type": "string",
                                            "example": "9.00",
                                            "description": "合计税额"
                                        },
                                        "++totalfee": {
                                            "type": "string",
                                            "example": "150.00",
                                            "description": "金额"
                                        },
                                        "notedrawer": {
                                            "type": "string",
                                            "example": "李维",
                                            "description": "开票人"
                                        },
                                        "page_count": {
                                            "type": "string",
                                            "example": "1",
                                            "description": "文件总页数"
                                        },
                                        "machinecode": {
                                            "type": "string",
                                            "example": "661616328900",
                                            "description": "机器编号"
                                        },
                                        "seller_bank": {
                                            "type": "string",
                                            "example": "交通银行珠海分行吉大支行...",
                                            "description": "销售方开户行及账号"
                                        },
                                        "seller_name": {
                                            "type": "string",
                                            "example": "珠海金山办公软件有限公司",
                                            "description": "销售方名称"
                                        },
                                        "total_feecn": {
                                            "type": "string",
                                            "example": "壹佰伍拾玖圆整",
                                            "description": "价税合计(大写)"
                                        },
                                        "total_amount": {
                                            "type": "string",
                                            "example": "150.00",
                                            "description": "合计金额"
                                        },
                                        "purchaser_bank": {
                                            "type": "string",
                                            "description": "购方开户行及账号"
                                        },
                                        "purchaser_name": {
                                            "type": "string",
                                            "example": "上海觉克信息科技有限公司",
                                            "description": "购方名称"
                                        },
                                        "seller_address": {
                                            "type": "string",
                                            "example": "珠海市高新区唐家湾镇前岛环路321号...",
                                            "description": "销售方地址及电话"
                                        },
                                        "purchaser_address": {
                                            "type": "string",
                                            "description": "购方地址及电话"
                                        },
                                        "Seller_registernum": {
                                            "type": "string",
                                            "example": "91440400696437955B",
                                            "description": "销售方纳税人识别号"
                                        },
                                        "purchaser_registernum": {
                                            "type": "string",
                                            "example": "91310114MA1GTG89XA",
                                            "description": "购方纳税人识别号"
                                        }
                                    }
                                },
                                "example": {
                                    "msg": "success",
                                    "code": 200,
                                    "result": {
                                        "code": "044001505111",
                                        "date": "2020年06月18日",
                                        "type": "电子普通发票",
                                        "payee": "刘晓敏",
                                        "number": "93299183",
                                        "xftype": "服务",
                                        "checker": "周旭寰",
                                        "remarks": "",
                                        "typeorg": "广东增值税电子普通发票",
                                        "itemlist": [
                                            {
                                                "num": "18",
                                                "name": "*信息技术服务*超级会员",
                                                "unit": "月",
                                                "price": "8.33333333",
                                                "taxfee": "9.00",
                                                "taxrate": "6%",
                                                "totalfee": "150.00"
                                            }
                                        ],
                                        "password": "37*2\/-3><2*65742041303357*9--<<2\/1*113+097++99\/9305-183+\/9677+>\/\/-11*-57046603*0+4685<9*>247\/353-\/138<38-0<2",
                                        "checkcode": "72338486701337770072",
                                        "total_fee": "159.00",
                                        "total_tax": "9.00",
                                        "notedrawer": "李维",
                                        "machinecode": "661616328900",
                                        "seller_bank": "交通银行珠海分行吉大支行444000096018170053943",
                                        "seller_name": "珠海金山办公软件有限公司",
                                        "total_feecn": "壹佰伍拾玖圆整",
                                        "total_amount": "150.00",
                                        "purchaser_bank": "",
                                        "purchaser_name": "上海觉克信息科技有限公司",
                                        "seller_address": "珠海市高新区唐家湾镇前岛环路321号金山软件园5号楼0756-3335688",
                                        "purchaser_address": "",
                                        "Seller_registernum": "91440400696437955B",
                                        "purchaser_registernum": "91310114MA1GTG89XA"
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}