curl --request POST \
--url https://agents.textin.com/doc-agent/api/v1/capability/material/extract \
--header 'Content-Type: application/json' \
--header 'x-ti-app-id: <x-ti-app-id>' \
--header 'x-ti-secret-code: <x-ti-secret-code>' \
--data '
{
"material_ids": [
"c0b6cdaa-ab06-4d67-bef2-3ea14de665be"
],
"with_verification": true
}
'
{
"code": 200,
"data": {
"materials": [
{
"category": "费用与结算",
"extract_result": {
"extract_fields": [
{
"key": "单据标题名称",
"position": [
{
"page": 0,
"vertices": [
702,
73,
1597,
73,
1597,
156,
702,
156
]
}
],
"value": "上海市医疗门诊收费票据(电子)"
},
{
"key": "票据代码",
"position": [
{
"page": 0,
"vertices": [
305,
241,
457,
241,
457,
280,
305,
280
]
}
],
"value": "31060125"
},
{
"key": "票据号码",
"position": [
{
"page": 0,
"vertices": [
1632,
239,
1818,
239,
1818,
278,
1632,
278
]
}
],
"value": "0290479045"
},
{
"key": "开票日期",
"position": [
{
"page": 0,
"vertices": [
1629,
349,
1818,
349,
1818,
388,
1629,
388
]
}
],
"value": "2025-08-04"
},
{
"key": "发票金额合计",
"position": [
{
"page": 0,
"vertices": [
1402,
987,
1629,
987,
1629,
1033,
1402,
1033
]
}
],
"value": "250.00"
},
{
"key": "收款单位",
"position": [
{
"page": 0,
"vertices": [
126,
1450,
1042,
1450,
1042,
1510,
126,
1510
]
}
],
"value": "XX中医药大学附属XX医院"
},
{
"key": "交款人",
"position": [
{
"page": 0,
"vertices": [
135,
344,
305,
344,
305,
388,
135,
388
]
}
],
"value": "张*"
}
],
"tables": [
{
"items": [
{
"values": [
{
"key": "项目名称",
"value": "诊察费"
},
{
"key": "金额",
"value": "250.00"
},
{
"key": "数量",
"value": "1.00"
}
]
}
],
"table_name": "Table1",
"table_type": ""
}
]
},
"fiscal_verify_result": {
"bill_code": "31060125",
"bill_date": "20250804",
"bill_name": "上海市医疗门诊收费票据(电子)",
"bill_no": "0290479045",
"check_code": "519d23",
"code": 1000,
"message": "处理成功",
"payee": "XX中医药大学附属XX医院",
"payer": "张*",
"query_count": 1,
"time": "2026-05-07 10:03:40",
"total_amount": "250.00"
},
"material_id": "c0b6cdaa-ab06-4d67-bef2-3ea14de665be",
"material_type": "医疗门诊收费票据(电子)",
"status": 3
}
]
},
"message": "OK"
}
文件与材料处理
材料抽取
材料抽取(幂等) 传入 material_id 列表,按需创建抽取任务:
- 未处理的材料:创建抽取任务,返回 PENDING 状态
- 处理中/失败的材料:直接返回当前状态,不重复处理
- 已完成的材料:直接返回抽取结果 支持重复调用直到所有材料终态(COMPLETED/FAILED),或等待 callback_url 回调
POST
/
doc-agent
/
api
/
v1
/
capability
/
material
/
extract
curl --request POST \
--url https://agents.textin.com/doc-agent/api/v1/capability/material/extract \
--header 'Content-Type: application/json' \
--header 'x-ti-app-id: <x-ti-app-id>' \
--header 'x-ti-secret-code: <x-ti-secret-code>' \
--data '
{
"material_ids": [
"c0b6cdaa-ab06-4d67-bef2-3ea14de665be"
],
"with_verification": true
}
'
{
"code": 200,
"data": {
"materials": [
{
"category": "费用与结算",
"extract_result": {
"extract_fields": [
{
"key": "单据标题名称",
"position": [
{
"page": 0,
"vertices": [
702,
73,
1597,
73,
1597,
156,
702,
156
]
}
],
"value": "上海市医疗门诊收费票据(电子)"
},
{
"key": "票据代码",
"position": [
{
"page": 0,
"vertices": [
305,
241,
457,
241,
457,
280,
305,
280
]
}
],
"value": "31060125"
},
{
"key": "票据号码",
"position": [
{
"page": 0,
"vertices": [
1632,
239,
1818,
239,
1818,
278,
1632,
278
]
}
],
"value": "0290479045"
},
{
"key": "开票日期",
"position": [
{
"page": 0,
"vertices": [
1629,
349,
1818,
349,
1818,
388,
1629,
388
]
}
],
"value": "2025-08-04"
},
{
"key": "发票金额合计",
"position": [
{
"page": 0,
"vertices": [
1402,
987,
1629,
987,
1629,
1033,
1402,
1033
]
}
],
"value": "250.00"
},
{
"key": "收款单位",
"position": [
{
"page": 0,
"vertices": [
126,
1450,
1042,
1450,
1042,
1510,
126,
1510
]
}
],
"value": "XX中医药大学附属XX医院"
},
{
"key": "交款人",
"position": [
{
"page": 0,
"vertices": [
135,
344,
305,
344,
305,
388,
135,
388
]
}
],
"value": "张*"
}
],
"tables": [
{
"items": [
{
"values": [
{
"key": "项目名称",
"value": "诊察费"
},
{
"key": "金额",
"value": "250.00"
},
{
"key": "数量",
"value": "1.00"
}
]
}
],
"table_name": "Table1",
"table_type": ""
}
]
},
"fiscal_verify_result": {
"bill_code": "31060125",
"bill_date": "20250804",
"bill_name": "上海市医疗门诊收费票据(电子)",
"bill_no": "0290479045",
"check_code": "519d23",
"code": 1000,
"message": "处理成功",
"payee": "XX中医药大学附属XX医院",
"payer": "张*",
"query_count": 1,
"time": "2026-05-07 10:03:40",
"total_amount": "250.00"
},
"material_id": "c0b6cdaa-ab06-4d67-bef2-3ea14de665be",
"material_type": "医疗门诊收费票据(电子)",
"status": 3
}
]
},
"message": "OK"
}
Body
application/json
批次ID(material_ids 为空时必传;material_ids 非空时可选,不传则自动从材料关联)
结果回调 URL(所有材料处理完成后,系统会向该 URL 发送 POST 请求) body 为 JSON:{"material_ids": ["id1", "id2"], "status": 3},status=3 表示已完成
手动指定分类(非空时自动跳过分类步骤,每个元素通过 material_id 与 material_ids 中的材料对应)
Show child attributes
Show child attributes
材料 ID 列表(与 batch_id 二选一) 传 material_ids:处理指定材料,所有材料必须属于同一批次 不传 material_ids:必须传 batch_id,处理该批次下所有材料
是否对发票类材料执行验真(支持增值税发票、医疗门诊/住院电子发票) 为 true 时,抽取完成后根据分类结果自动判断是否需要验真
⌘I