接口文档· 更新于 2026-11-26
异步接口-红字信息表下载
POST
/openapi/invoice/hsy/red/downloadRedInvoiceInfo发票外部服务转发接口;上游原始路径:/hsy/red/downloadRedInvoiceInfo;来源 Controller:HsyController;上游鉴权:SignatureInterceptor:sign=MD5(appkey + 客户号/企业号 + timestamp),source 控制明密文
请求地址
生产环境
https://open.gch168.com/openapi/invoice/hsy/red/downloadRedInvoiceInfo- 请求方式
- POST
- 内容类型
- application/json
- 传输安全
- TLS 1.2 及以上
支持的鉴权方式
查看接入认证说明 →以下任一鉴权方式通过即可调用,签名细节与凭证获取请查看接入说明。
Header 签名(普通开放接口)API_KEY
通过 ApiKey、客户号或企业号识别租户,并对时间戳、随机串进行 MD5 签名校验,适用于绝大多数普通开放接口。
Sign = MD5(secretKey + timestamp + nonceStr),签名比较忽略大小写
请求头
公共请求头 →| 请求头 | 必填 | 类型 | 示例值 | 说明 |
|---|---|---|---|---|
| appkey | 必填 | String | invoice-app-key | 调用方应用密钥,发票转发层读取该请求头做签名归属;Hsy/DirectNuoNuo 上游拦截器读取同名 Query 参数 |
| timestamp | 必填 | String | 1710000000000 | 请求时间戳,5 分钟内有效,发票转发层读取该请求头做签名归属;Hsy/DirectNuoNuo 上游拦截器读取同名 Query 参数 |
| sign | 必填 | String |
请求参数
| 参数名 | 位置 | 类型 | 必填 | 示例值 | 说明 |
|---|---|---|---|---|---|
appkey | QUERY | String | 必填 | invoice-app-key | 调用方应用密钥,Hsy/DirectNuoNuo 上游 SignatureInterceptor 读取该 Query 参数 |
timestamp | QUERY | String | 必填 | 1710000000000 | 请求时间戳,5 分钟内有效,Hsy/DirectNuoNuo 上游 SignatureInterceptor 读取该 Query 参数 |
param | BODY | String | 必填 | {"accessKey":"accessKeyValue","secretKey":"secretKeyValue","xSerialToken":"xSerialTokenValue","xRegisterIdToken":"xRegisterIdTokenValue","userTax":"91330000123456789X","deviceNo":"deviceNoValue","invoiceType":1,"applicationNo":"applicationNoValue","startDate":"2026-05-27 12:00:00","endDate":"2026-05-27 12:00:00"} | 发票服务拦截器读取的业务参数;source=pb 时为明文 JSON 字符串,其他来源为 AES 密文。子级为解密后的业务 JSON 字段。 |
accessKey | BODY | String | 选填 | accessKeyValue | 令牌,自己处理得到的token @NotEmpty(message = "令牌不能为空") @JSONField(serialize = false) private String xAccessToken; /** * ISV token调用接口时为必填,填写内容为操作公司的税号 */ @JSONField(serialize = false) private String xTaxToken; 对应X-Access-Token;@JSONField(serialize=false),上游用于内部转换或请求头映射 |
secretKey | BODY | String | 选填 | secretKeyValue | secretKey;@JSONField(serialize=false),上游用于内部转换或请求头映射 |
xSerialToken | BODY | String | 选填 | xSerialTokenValue | 流水号,您可根据自己实际需求选填该信息,若填写则接口及回调将在serialNo字段返回该参数;@JSONField(serialize=false),上游用于内部转换或请求头映射 |
xRegisterIdToken | BODY | String | 选填 | xRegisterIdTokenValue | 登记信息身份证号,指定操作人员,ISV 级别密钥支持传入指定数电账户;@JSONField(serialize=false),上游用于内部转换或请求头映射 |
userTax | BODY | String | 选填 | 91330000123456789X | 用户税号--额外字段,必传,对应X-Tax-Token @NotEmpty(message = "商户税号不能为空");@JSONField(serialize=false),上游用于内部转换或请求头映射 |
deviceNo | BODY | String | 必填 | deviceNoValue | 销方设备号(税盘编号) |
invoiceType | BODY | Integer | 必填 | 1 | 发票类型 1增值税专用发票, 4 增值税电子专用发票 |
applicationNo | BODY | String | 选填 | applicationNoValue | 红字信息表编号 使用税控服务器时该参数为必填 |
startDate | BODY | String | 选填 | 2026-05-27 12:00:00 | startDate |
endDate | BODY | String | 选填 | 2026-05-27 12:00:00 | 红字信息表填开结束日期 |
响应参数
业务成功时返回 code = 200,其余状态码见下方接口状态码与全局状态码。
| 字段名 | 类型 | 示例值 | 说明 |
|---|---|---|---|
code | Integer | 200 | 业务响应码 |
msg | String | success | 响应消息 |
data | Object | {"id":1001,"serialNo":1001,"applicationNo":"applicationNoValue","changeType":1,"applicationRole":1001,"deductFlag":1,"applicationReason":1001,"invoiceType":1,"invoiceCode":"invoiceCodeValue","invoiceNo":"invoiceNoValue"} | 响应业务数据;source=pb 时为明文 JSON,非 pb 来源可能为 AES 加密字符串。子级为源码中可追踪到的业务字段。 |
id | Integer | 1001 | id |
serialNo | Integer | 1001 | serialNo |
applicationNo | String | applicationNoValue | applicationNo |
changeType | Integer | 1 | changeType |
applicationRole | Integer | 1001 | applicationRole |
deductFlag | Integer | 1 | deductFlag |
applicationReason | Integer | 1001 | applicationReason |
invoiceType | Integer | 1 | invoiceType |
invoiceCode | String | invoiceCodeValue | invoiceCode |
invoiceNo | String | invoiceNoValue | invoiceNo |
purchaserName | String | purchaserNameValue | purchaserName |
purchaserTaxNo | String | 91330000123456789X | purchaserTaxNo |
sellerName | String | sellerNameValue | sellerName |
sellerTaxNo | String | 91330000123456789X | sellerTaxNo |
status | Integer | 1001 | status |
machineNo | String | machineNoValue | machineNo |
applyTime | String | 2026-05-27 12:00:00 | applyTime |
createUserName | String | createUserNameValue | createUserName |
amount | Number | 100.00 | amount |
amountWithTax | Number | 100.00 | amountWithTax |
taxAmount | Number | 100.00 | taxAmount |
uploadType | Integer | 1 | uploadType |
redApplicationDetailModelList | Array | [] | redApplicationDetailModelList |
goodsName | String | goodsNameValue | goodsName |
shortName | String | shortNameValue | shortName |
categoryName | String | categoryNameValue | categoryName |
goodsCode | String | goodsCodeValue | goodsCode |
specification | String | specificationValue | specification |
unit | String | unitValue | unit |
quantity | Number | 100.00 | quantity |
unitPrice | Number | 100.00 | unitPrice |
amount | Number | 100.00 | amount |
amountWithTax | Number | 100.00 | amountWithTax |
taxRate | Number | 100.00 | taxRate |
deduction | Number | 100.00 | deduction |
discountAmount | Number | 100.00 | discountAmount |
taxAmount | Number | 100.00 | taxAmount |
invoiceLineType | Integer | 1 | invoiceLineType |
revenueCode | String | revenueCodeValue | revenueCode |
revenueVersion | Number | 100.00 | revenueVersion |
taxPre | Integer | 1001 | taxPre |
taxPreType | Integer | 1 | taxPreType |
zeroTax | Integer | 1001 | zeroTax |
createUserName | String | createUserNameValue | createUserName |
状态码
全局状态码 →| 状态码 | 说明 |
|---|---|
| 200 | 调用成功 |
请求与响应示例
请求示例
请求示例
POST /openapi/invoice/hsy/red/downloadRedInvoiceInfo?appkey=invoice-app-key×tamp=1710000000000
appkey: invoice-app-key
timestamp: 1710000000000
sign: A1234567890123456789012345678901
source: pb
{"param":"{\"accessKey\":\"accessKeyValue\",\"secretKey\":\"secretKeyValue\",\"xSerialToken\":\"xSerialTokenValue\",\"xRegisterIdToken\":\"xRegisterIdTokenValue\",\"userTax\":\"91330000123456789X\",\"deviceNo\":\"deviceNoValue\",\"invoiceType\":1,\"applicationNo\":\"applicationNoValue\",\"startDate\":\"2026-05-27 12:00:00\",\"endDate\":\"2026-05-27 12:00:00\"}"}
响应示例
响应示例
{
"code": 200,
"msg": "success",
"data": {
"id": 1001,
"serialNo": 1001,
"applicationNo": "applicationNoValue",
"changeType": 1,
"applicationRole": 1001,
"deductFlag": 1,
"applicationReason": 1001,
"invoiceType": 1,
"invoiceCode": "invoiceCodeValue",
"invoiceNo": "invoiceNoValue"
}
}