cURL
curl --request POST \
--url https://agents.textin.com/doc-agent/api/v1/capability/vat-invoice/verify \
--header 'Content-Type: application/json' \
--header 'x-ti-app-id: <x-ti-app-id>' \
--header 'x-ti-secret-code: <x-ti-secret-code>' \
--data '
{
"invoice_code": "",
"invoice_date": "20260202",
"invoice_no": "26330000009400012345",
"invoice_sum": "7282.03",
"verify_code": ""
}
'import requests
url = "https://agents.textin.com/doc-agent/api/v1/capability/vat-invoice/verify"
payload = {
"invoice_code": "",
"invoice_date": "20260202",
"invoice_no": "26330000009400012345",
"invoice_sum": "7282.03",
"verify_code": ""
}
headers = {
"x-ti-app-id": "<x-ti-app-id>",
"x-ti-secret-code": "<x-ti-secret-code>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'x-ti-app-id': '<x-ti-app-id>',
'x-ti-secret-code': '<x-ti-secret-code>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
invoice_code: '',
invoice_date: '20260202',
invoice_no: '26330000009400012345',
invoice_sum: '7282.03',
verify_code: ''
})
};
fetch('https://agents.textin.com/doc-agent/api/v1/capability/vat-invoice/verify', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://agents.textin.com/doc-agent/api/v1/capability/vat-invoice/verify",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'invoice_code' => '',
'invoice_date' => '20260202',
'invoice_no' => '26330000009400012345',
'invoice_sum' => '7282.03',
'verify_code' => ''
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-ti-app-id: <x-ti-app-id>",
"x-ti-secret-code: <x-ti-secret-code>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://agents.textin.com/doc-agent/api/v1/capability/vat-invoice/verify"
payload := strings.NewReader("{\n \"invoice_code\": \"\",\n \"invoice_date\": \"20260202\",\n \"invoice_no\": \"26330000009400012345\",\n \"invoice_sum\": \"7282.03\",\n \"verify_code\": \"\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-ti-app-id", "<x-ti-app-id>")
req.Header.Add("x-ti-secret-code", "<x-ti-secret-code>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://agents.textin.com/doc-agent/api/v1/capability/vat-invoice/verify")
.header("x-ti-app-id", "<x-ti-app-id>")
.header("x-ti-secret-code", "<x-ti-secret-code>")
.header("Content-Type", "application/json")
.body("{\n \"invoice_code\": \"\",\n \"invoice_date\": \"20260202\",\n \"invoice_no\": \"26330000009400012345\",\n \"invoice_sum\": \"7282.03\",\n \"verify_code\": \"\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://agents.textin.com/doc-agent/api/v1/capability/vat-invoice/verify")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-ti-app-id"] = '<x-ti-app-id>'
request["x-ti-secret-code"] = '<x-ti-secret-code>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"invoice_code\": \"\",\n \"invoice_date\": \"20260202\",\n \"invoice_no\": \"26330000009400012345\",\n \"invoice_sum\": \"7282.03\",\n \"verify_code\": \"\"\n}"
response = http.request(request)
puts response.read_body{
"code": 200,
"data": {
"result": {
"code": "001",
"data": {
"all_tax": "436.92",
"all_valorem_tax": "7718.95",
"check_code": "26330000009400012345",
"cyjgxx": "查验成功发票一致",
"detail_list": [
{
"all_tax": "436.92",
"detail_amount": "7282.03",
"detail_no": "1",
"goods_name": "*企业管理服务*市场管理",
"row_no": "1",
"tax_classify_code": "3040801990000000000",
"tax_rate": "6"
}
],
"inspection_amount": "5",
"invalid_mark": "N",
"invoice_code": "",
"invoice_date": "20260202",
"invoice_money": "7282.03",
"invoice_number": "26330000009400012345",
"invoice_type": "31",
"machine_code": "",
"note": "购方开户银行:招商银行股份有限公司某某支行 银行账号:120919530XXXXXX",
"purchaser_bank_and_number": "购方开户银行:招商银行股份有限公司某某支行 银行账号:120919530XXXXXX",
"purchaser_name": "某某互联网科技有限公司",
"purchaser_taxpayer_number": "91440101MAXXXXXXX3",
"saler_address_or_phone": "浙江省杭州市滨江区某某路1750号某某中心2005室 138****8845",
"saler_bank_and_number": "销方开户银行:杭州银行股份有限公司滨江支行 银行账号:330104106000XXXXXXX",
"saler_name": "某某贸易有限公司",
"saler_taxpayer_number": "91330108MAXXXXXXX7",
"seller_unit_or_individual": "某某贸易有限公司"
},
"invalid_mark": "N",
"invoice_code": "",
"invoice_date": "20260202",
"invoice_number": "26330000009400012345",
"invoice_type": "31",
"message": "成功",
"purchaser_taxpayer_number": "91440101MAXXXXXXX3"
}
},
"message": "OK"
}发票验真
发票验真(税票)
增值税发票验真。直接调用底层验真 API,同步返回结果。
POST
/
doc-agent
/
api
/
v1
/
capability
/
vat-invoice
/
verify
cURL
curl --request POST \
--url https://agents.textin.com/doc-agent/api/v1/capability/vat-invoice/verify \
--header 'Content-Type: application/json' \
--header 'x-ti-app-id: <x-ti-app-id>' \
--header 'x-ti-secret-code: <x-ti-secret-code>' \
--data '
{
"invoice_code": "",
"invoice_date": "20260202",
"invoice_no": "26330000009400012345",
"invoice_sum": "7282.03",
"verify_code": ""
}
'import requests
url = "https://agents.textin.com/doc-agent/api/v1/capability/vat-invoice/verify"
payload = {
"invoice_code": "",
"invoice_date": "20260202",
"invoice_no": "26330000009400012345",
"invoice_sum": "7282.03",
"verify_code": ""
}
headers = {
"x-ti-app-id": "<x-ti-app-id>",
"x-ti-secret-code": "<x-ti-secret-code>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'x-ti-app-id': '<x-ti-app-id>',
'x-ti-secret-code': '<x-ti-secret-code>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
invoice_code: '',
invoice_date: '20260202',
invoice_no: '26330000009400012345',
invoice_sum: '7282.03',
verify_code: ''
})
};
fetch('https://agents.textin.com/doc-agent/api/v1/capability/vat-invoice/verify', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://agents.textin.com/doc-agent/api/v1/capability/vat-invoice/verify",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'invoice_code' => '',
'invoice_date' => '20260202',
'invoice_no' => '26330000009400012345',
'invoice_sum' => '7282.03',
'verify_code' => ''
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-ti-app-id: <x-ti-app-id>",
"x-ti-secret-code: <x-ti-secret-code>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://agents.textin.com/doc-agent/api/v1/capability/vat-invoice/verify"
payload := strings.NewReader("{\n \"invoice_code\": \"\",\n \"invoice_date\": \"20260202\",\n \"invoice_no\": \"26330000009400012345\",\n \"invoice_sum\": \"7282.03\",\n \"verify_code\": \"\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-ti-app-id", "<x-ti-app-id>")
req.Header.Add("x-ti-secret-code", "<x-ti-secret-code>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://agents.textin.com/doc-agent/api/v1/capability/vat-invoice/verify")
.header("x-ti-app-id", "<x-ti-app-id>")
.header("x-ti-secret-code", "<x-ti-secret-code>")
.header("Content-Type", "application/json")
.body("{\n \"invoice_code\": \"\",\n \"invoice_date\": \"20260202\",\n \"invoice_no\": \"26330000009400012345\",\n \"invoice_sum\": \"7282.03\",\n \"verify_code\": \"\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://agents.textin.com/doc-agent/api/v1/capability/vat-invoice/verify")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-ti-app-id"] = '<x-ti-app-id>'
request["x-ti-secret-code"] = '<x-ti-secret-code>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"invoice_code\": \"\",\n \"invoice_date\": \"20260202\",\n \"invoice_no\": \"26330000009400012345\",\n \"invoice_sum\": \"7282.03\",\n \"verify_code\": \"\"\n}"
response = http.request(request)
puts response.read_body{
"code": 200,
"data": {
"result": {
"code": "001",
"data": {
"all_tax": "436.92",
"all_valorem_tax": "7718.95",
"check_code": "26330000009400012345",
"cyjgxx": "查验成功发票一致",
"detail_list": [
{
"all_tax": "436.92",
"detail_amount": "7282.03",
"detail_no": "1",
"goods_name": "*企业管理服务*市场管理",
"row_no": "1",
"tax_classify_code": "3040801990000000000",
"tax_rate": "6"
}
],
"inspection_amount": "5",
"invalid_mark": "N",
"invoice_code": "",
"invoice_date": "20260202",
"invoice_money": "7282.03",
"invoice_number": "26330000009400012345",
"invoice_type": "31",
"machine_code": "",
"note": "购方开户银行:招商银行股份有限公司某某支行 银行账号:120919530XXXXXX",
"purchaser_bank_and_number": "购方开户银行:招商银行股份有限公司某某支行 银行账号:120919530XXXXXX",
"purchaser_name": "某某互联网科技有限公司",
"purchaser_taxpayer_number": "91440101MAXXXXXXX3",
"saler_address_or_phone": "浙江省杭州市滨江区某某路1750号某某中心2005室 138****8845",
"saler_bank_and_number": "销方开户银行:杭州银行股份有限公司滨江支行 银行账号:330104106000XXXXXXX",
"saler_name": "某某贸易有限公司",
"saler_taxpayer_number": "91330108MAXXXXXXX7",
"seller_unit_or_individual": "某某贸易有限公司"
},
"invalid_mark": "N",
"invoice_code": "",
"invoice_date": "20260202",
"invoice_number": "26330000009400012345",
"invoice_type": "31",
"message": "成功",
"purchaser_taxpayer_number": "91440101MAXXXXXXX3"
}
},
"message": "OK"
}支持的发票类型
| 类型代码 | 发票类型 |
|---|---|
| 01 | 增值税专用发票 |
| 02 | 货运运输业增值税专用发票 |
| 03 | 机动车销售统一发票 |
| 04 | 增值税普通发票 |
| 10 | 增值税普通发票(电子) |
| 11 | 增值税普通发票(卷式) |
| 14 | 增值税普通发票(通行费) |
| 15 | 二手车销售统一发票 |
| 20 | 增值税电子专用发票 |
| 31 | 电子发票(增值税专用发票) |
| 32 | 电子发票(增值税普通发票) |
| 51 | 电子发票(铁路电子客票) |
| 61 | 电子发票(航空运输电子客票行程单) |
| 83 | 电子发票(机动车销售统一发票) |
| 84 | 电子发票(二手车销售统一发票) |
| 85 | 全电发票(纸质专用发票) |
| 86 | 数电纸质发票(普通发票) |
| 87 | 电子发票(通行费) |
参数必填规则
invoice_code(发票代码)
全电发票(类型代码 31, 32, 51, 61, 83, 84, 87)时非必填,其他发票类型必填。invoice_sum(金额)
发票类型代码为 01, 03, 15, 20, 31, 32, 51, 61, 83, 84, 85, 87 时必填,填写内容因类型而异:| 适用类型代码 | 填写内容 |
|---|---|
| 01, 03, 20, 85 | 不含税金额 |
| 15, 84 | 车价合计 |
| 31, 32, 51, 61, 83, 87 | 含税金额 |
verify_code(校验码)
发票类型代码为 04, 10, 11, 14, 86 时必填,取后六位。其中类型 86 填写密码区数电票号码后六位。作废标志(invalid_mark)
| 标志 | 含义 |
|---|---|
| N | 正常 |
| Y | 已作废 |
| H | 红冲 |
| 7 | 部分红冲 |
| 8 | 全额红冲 |
验证状态码与扣费说明
响应中data.result.code 的含义如下:
| 错误码 | 说明 | 是否扣费 |
|---|---|---|
| 001 | 成功,验证为真 | 是 |
| 002 | 此发票今日查询次数已达上限(5次),请次日查询 | 否 |
| 005 | 请求不合法,请核对验真参数 | 否 |
| 006 | 发票信息不一致,请核对发票信息 | 是 |
| 009 | 查无此票,请核对发票信息 | 是 |
| 104 | 已超过最大查验量 | 否 |
| 105 | 查询发票不规范,请核对发票信息 | 否 |
| 106 | 查验异常,国税局/发票查验地区升级维护,请稍后重试 | 否 |
| 107 | 鉴权失败 | 否 |
| 108 | 参数不为空 | 否 |
| 109 | 参数长度不正确 | 否 |
| 110 | 参数 invoice_code 的格式或取值范围错误 | 否 |
| 111 | 参数 invoice_sum 的格式或取值范围错误 | 否 |
| 112 | 参数 verify_code 的格式或取值范围错误 | 否 |
| 113 | 参数 invoice_no 的格式或取值范围错误 | 否 |
| 114 | 校验码不正确,应为后六位 | 否 |
| 115 | 超过服务有效期限限制 | 否 |
| 116 | 此发票今日查询次数已达上限(5次),请次日查询 | 否 |
| 1005 | 请核对验真参数是否符合发票规范 | 是 |
| 1010 | 日期格式不正确(YYYYMMDD) | 否 |
| 1011 | 请求参数不完整 | 否 |
| 1021 | 查验异常,国税局/发票查验地区升级维护,请稍后重试 | 否 |
| 10014 | 日期当天不能查验 | 否 |
| 10015 | 开票金额:不合法的格式 | 否 |
| 10016 | 检验码:不能为空 | 否 |
| 10017 | 超过五年的不能查验 | 否 |
| 10018 | 检验码:不合法的长度 | 否 |
| 10020 | 没有查验权限 | 否 |
Body
application/json
发票代码,全电发票(发票类型代码为 31, 32, 51, 61, 83, 84, 87)时非必填,其他发票类型必填
开票日期(必填,格式: yyyyMMdd,如 "20190203")
发票号码(必填)
金额,非必填。发票类型代码为 01, 03, 15, 20, 31, 32, 51, 61, 85, 83, 84, 87 时必填:
- 为 01, 03, 20, 85 时填写发票不含税金额
- 为 15, 84 时填写发票车价合计
- 为 31, 32, 51, 61, 83, 87 时填写含税金额
- 其它可为空
机器验证码,非必填,取后六位。发票类型代码为 04, 10, 11, 14, 86 时必填(填写密码区数电票号码后六位), 发票类型代码为 86 时填写密码区数电票号码后六位,其他发票种类可为空
⌘I