> ## Documentation Index
> Fetch the complete documentation index at: https://docs-claimagent.textin.com/llms.txt
> Use this file to discover all available pages before exploring further.

# 发票验真（财政票）

> 财政票据验真。直接调用底层验真 API，同步返回结果。支持医疗门诊/住院收费电子票据等财政票据。


mode 查验模式说明：

- **national**：全国版，走财政部全国网站查验，速度快，部分票据可能无明细，仅支持开票时间在一年内的电子票据

- **detail**：明细版，根据是否传入 id_card_last6 + payer_name 自动判断：两者都传则走地方版(各地区网站)；未传齐则走全国明细版(先全国再地方，确保返回明细)


默认 "national"

## 财政电子票据验真错误码

响应中 `data.result.code` 的含义如下：

| 错误码  | 说明                        |
| ---- | ------------------------- |
| 1000 | 成功                        |
| 999  | 其它错误                      |
| 1001 | 网站访问异常                    |
| 1002 | 超出该张票据最大查验次数              |
| 1003 | 验证码错误                     |
| 1006 | 未查询到当前发票数据                |
| 1007 | 当前地区维护中，请稍后               |
| 1008 | 开票日期超出范围，仅可查验最近一年内开具的电子票据 |
| 1009 | 局端请求异常                    |
| 1010 | 税局服务异常，建议 15-20 分钟后重试     |


## OpenAPI

````yaml POST /doc-agent/api/v1/capability/fiscal-bill/verify
openapi: 3.0.3
info:
  description: |-
    CapabilityService 独立子能力服务
     提供文件上传、图像质检、材料分类、材料抽取等独立能力，不依赖案件流程。
     通过 batch_id 和 material_id 串联各能力调用。

     ## 典型调用流程
     1. 上传文件 → UploadFiles，获得 batch_id 和 material_id 列表
     2. (可选)图像质检 → CheckImageQuality，可独立调用，也可用上传返回的 material_id
     3. (可选)材料分类 → ClassifyMaterial，可独立调用，也可用上传返回的 material_id
     4. 材料抽取 → ExtractMaterial，传入 material_id 列表，返回每个材料的状态和结果
     5. 轮询 → 重复调用 ExtractMaterial 直到所有材料完成，或等待 callback_url 回调
     注: 质检和分类可独立调用，不依赖抽取流程；抽取接口的 material_ids 必须来自上传接口。
     注: ExtractMaterial 幂等，已完成的材料不会重新抽取，失败的材料会自动重试。

     ## 错误响应
     所有接口错误均返回 HTTP 非 200 状态码，body 格式: {"code": 400, "msg": "错误描述"}
     常见错误码:
       400 — 参数校验失败(缺少必填字段、文件数超限等)
       403 — 认证失败(x-ti-app-id 或 x-ti-secret-code 缺失/无效)
       404 — 资源不存在(material_id / batch_id 无效)
       500 — 内部处理异常

     错误响应示例:
       {"code": 404, "msg": "material not found"}
       {"code": 404, "msg": "batch not found"}
       {"code": 400, "msg": "material_ids or batch_id is required"}
       {"code": 400, "msg": "material does not belong to the specified batch"}
       {"code": 400, "msg": "files or file_urls is required"}
       {"code": 400, "msg": "所有材料必须属于同一批次"}
       {"code": 403, "msg": "x-api-key 或 x-ti-app-id/x-ti-secret-code 不能为空"}
  title: CapabilityService API
  version: 0.0.1
servers:
  - url: https://agents.textin.com/
security: []
tags:
  - name: CapabilityService
paths:
  /doc-agent/api/v1/capability/fiscal-bill/verify:
    post:
      tags:
        - CapabilityService
      description: >-
        财政票据验真。直接调用底层验真 API，同步返回结果。支持医疗门诊/住院收费电子票据等财政票据。



        mode 查验模式说明：


        - **national**：全国版，走财政部全国网站查验，速度快，部分票据可能无明细，仅支持开票时间在一年内的电子票据


        - **detail**：明细版，根据是否传入 id_card_last6 + payer_name
        自动判断：两者都传则走地方版(各地区网站)；未传齐则走全国明细版(先全国再地方，确保返回明细)



        默认 "national"
      operationId: CapabilityService_VerifyFiscalBill
      parameters:
        - in: header
          name: x-ti-app-id
          required: true
          schema:
            type: string
        - in: header
          name: x-ti-secret-code
          required: true
          schema:
            type: string
      requestBody:
        content:
          application/json:
            example:
              bill_amount: '20.00'
              bill_code: '51060123'
              bill_date: '20230411'
              bill_no: '0272000001'
              check_code: 7ffdbe
              id_card_last6: '083411'
              mode: detail
              payer_name: 张某某
            schema:
              $ref: '#/components/schemas/capability.v1.VerifyFiscalBillRequest'
        required: true
      responses:
        '200':
          content:
            application/json:
              example:
                code: 200
                data:
                  result:
                    accounting_status: ''
                    bill_code: '51060123'
                    bill_date: '2023-04-11'
                    bill_name: 四川省医疗门诊收费票据(电子)
                    bill_no: '0272000001'
                    bill_status: '01'
                    check_code: 7ffdbe
                    code: 1000
                    collector: 工行自助机
                    file_type: pdf
                    file_url: http://example.com/archive/xxxxx.pdf
                    fiscal_seal: ''
                    fiscal_seal_no: ''
                    item_details:
                      - amount: '1.0000'
                        code: ''
                        index: 1
                        name: ●挂号费
                        paid_amount: ''
                        paid_amount_rate: ''
                        quantity: '1.0'
                        remark: ''
                        standard: ''
                        type: ''
                        unit: 次
                      - amount: '19.0000'
                        code: ''
                        index: 2
                        name: 材料费
                        paid_amount: ''
                        paid_amount_rate: ''
                        quantity: '1.0'
                        remark: ''
                        standard: ''
                        type: ''
                        unit: 次
                    item_list:
                      - amount: '1.00'
                        code: ''
                        index: 1
                        name: 挂号费
                        paid_amount: ''
                        paid_amount_rate: ''
                        quantity: ''
                        remark: ''
                        standard: ''
                        type: ''
                        unit: ''
                      - amount: '19.00'
                        code: ''
                        index: 2
                        name: 其他门急诊收费项目
                        paid_amount: ''
                        paid_amount_rate: ''
                        quantity: ''
                        remark: ''
                        standard: ''
                        type: ''
                        unit: ''
                    message: 处理成功
                    other_info:
                      - en_value: ''
                        key: ywlsh
                        label: 业务流水号
                        value: MZ20230411XXXXXXXX
                      - en_value: ''
                        key: mzh
                        label: 门诊号
                        value: '23031500000'
                      - en_value: ''
                        key: jzrq
                        label: 就诊日期
                        value: '20230411'
                      - en_value: ''
                        key: yljglx
                        label: 医疗机构类型
                        value: 中医医院
                      - en_value: ''
                        key: yblx
                        label: 医保类型
                        value: ''
                      - en_value: ''
                        key: grxjzf
                        label: 个人现金支付
                        value: '20.00'
                    payee: 某某骨科医院
                    payer: 张某某
                    payer_tax_id: 513124********3411
                    print_status: ''
                    query_count: 1
                    remark: ''
                    reviewer: 工行自助机
                    supplementary_info: ''
                    time: '2026-05-06 11:47:17'
                    total_amount: '20.00'
                    total_amount_cn: 贰拾元整
                    void_date: ''
                    void_reason: ''
                    void_time: ''
                message: OK
              schema:
                properties:
                  code:
                    description: 业务状态码
                    example: 200
                    type: integer
                  data:
                    $ref: >-
                      #/components/schemas/capability.v1.VerifyFiscalBillResponse
                  message:
                    description: 状态说明
                    example: OK
                    type: string
                type: object
          description: OK
components:
  schemas:
    capability.v1.VerifyFiscalBillRequest:
      properties:
        bill_amount:
          description: 票据金额
          type: string
        bill_code:
          description: 票据代码
          type: string
        bill_date:
          description: '开票日期(格式: yyyyMMdd，如 "20240226")'
          type: string
        bill_no:
          description: 票据号码
          type: string
        check_code:
          description: 校验码
          type: string
        id_card_last6:
          description: 身份证后六位（明细版中用于路由判断：传了则走地方版，部分地区票据必填）
          type: string
        mode:
          description: |-
            查验模式:
             - "national": 全国版，走财政部全国网站查验，速度快，部分票据可能无明细，仅支持开票时间在一年内的电子票据
             - "detail": 明细版，根据是否传入 id_card_last6 + payer_name 自动判断走地方版或全国明细版
             默认 "national"
          type: string
        payer_name:
          description: 交款人（明细版中用于路由判断：传了则走地方版，部分票据必填）
          type: string
      type: object
    capability.v1.VerifyFiscalBillResponse:
      properties:
        result:
          allOf:
            - $ref: '#/components/schemas/common.FiscalBillVerifyResult'
          description: 财政票据验真结果
      type: object
    common.FiscalBillVerifyResult:
      description: |-
        财政电子票据验真结果

         错误码说明：
         1000  成功
         999   其它错误
         1001  网站访问异常
         1002  超出该张票据最大查验次数
         1003  验证码错误
         1006  未查询到当前发票数据
         1007  当前地区维护中，请稍后
         1008  开票日期超出范围，仅可查验最近一年内开具的电子票据
         1009  局端请求异常
         1010  税局服务异常，建议 15-20 分钟后重试
      properties:
        accounting_status:
          description: 入账状态("01"=未入账，"02"=已入账)
          type: string
        bill_code:
          description: 票据代码
          type: string
        bill_date:
          description: 开票日期(格式 YYYYMMDD)
          type: string
        bill_name:
          description: 票据名称
          type: string
        bill_no:
          description: 票据号码
          type: string
        bill_status:
          description: 票据状态("01"=正常，"02"=冲红)
          type: string
        check_code:
          description: 校验码
          type: string
        code:
          description: 验真返回码(1000=成功，详见错误码说明)
          format: int32
          type: integer
        collector:
          description: 收款人(与收款单位不同，指具体经办人)
          type: string
        file_type:
          description: 文件类型(如 "pdf")
          type: string
        file_url:
          description: 文件 URL(票据 PDF 下载链接)
          type: string
        fiscal_seal:
          description: 财政编码印章
          type: string
        fiscal_seal_no:
          description: 财政编码印章编号
          type: string
        item_details:
          description: 项目明细
          items:
            $ref: '#/components/schemas/common.FiscalBillItem'
          type: array
        item_list:
          description: 项目清单
          items:
            $ref: '#/components/schemas/common.FiscalBillItem'
          type: array
        message:
          description: 返回信息
          type: string
        other_info:
          description: 其它信息(业务流水号、门诊号、就诊日期、医疗机构类型、医保类型等)
          items:
            $ref: '#/components/schemas/common.FiscalBillExtraInfo'
          type: array
        payee:
          description: 收款单位
          type: string
        payer:
          description: 缴款人
          type: string
        payer_tax_id:
          description: 缴款人纳税人识别号
          type: string
        print_status:
          description: 打印状态("01"=未打印，"02"=已打印)
          type: string
        query_count:
          description: 查验次数
          format: int32
          type: integer
        remark:
          description: 备注
          type: string
        reviewer:
          description: 复核人
          type: string
        supplementary_info:
          description: 票据左上角补充信息(如"门特慢")
          type: string
        time:
          description: 查验时间
          type: string
        total_amount:
          description: 金额合计
          type: string
        total_amount_cn:
          description: 金额合计大写
          type: string
        void_date:
          description: 冲红日期
          type: string
        void_reason:
          description: 冲红原因
          type: string
        void_time:
          description: 冲红时间
          type: string
      type: object
    common.FiscalBillItem:
      description: 财政票据项目明细/清单条目(xmmx 和 xmqd 结构相同)
      properties:
        amount:
          description: 金额
          type: string
        code:
          description: 项目编号
          type: string
        index:
          description: 项目序号
          format: int32
          type: integer
        name:
          description: 项目名称
          type: string
        paid_amount:
          description: 支付金额
          type: string
        paid_amount_rate:
          description: 支付金额税率
          type: string
        quantity:
          description: 数量
          type: string
        remark:
          description: 备注
          type: string
        standard:
          description: 规格标准
          type: string
        type:
          description: 类型(如"甲")
          type: string
        unit:
          description: 单位
          type: string
      type: object
    common.FiscalBillExtraInfo:
      description: 财政票据其它信息条目
      properties:
        en_value:
          description: 英文值
          type: string
        key:
          description: 字段英文名(如 "ywlsh"、"mzh"、"jzrq")
          type: string
        label:
          description: 字段中文名(如 "业务流水号"、"门诊号"、"就诊日期")
          type: string
        value:
          description: 值
          type: string
      type: object

````