curl --request POST \
--url https://api.textin.com/api/v1/xparse/parse/sync \
--header 'Content-Type: multipart/form-data' \
--header 'x-ti-app-id: <api-key>' \
--header 'x-ti-secret-code: <api-key>' \
--form file='@example-file' \
--form 'file_url=<string>' \
--form 'config={
"document": {
"password": "example-pdf-password"
},
"capabilities": {
"include_hierarchy": true,
"include_inline_objects": true,
"include_char_details": true,
"include_image_data": true,
"include_table_structure": true,
"pages": true,
"title_tree": true,
"table_view": "html"
},
"scope": {
"page_range": "1-2"
},
"config": {
"force_engine": "textin",
"engine_params": {
"formula_level": 0,
"image_output_type": "url"
}
}
}'{
"code": 200,
"message": "success",
"data": {
"schema_version": "1.3.0",
"file_id": "doc_7f3a2b",
"job_id": "job_x9k2m",
"success_count": 2,
"metadata": {
"filename": "quarterly_report.pdf",
"filetype": "application/pdf",
"page_count": 2,
"data_source": {
"record_locator": {
"protocol": "file",
"remote_file_path": "/projects/demo/quarterly_report.pdf"
},
"url": "file:///projects/demo/quarterly_report.pdf"
}
},
"markdown": "# 检验结果\n\n<table>\n <thead>\n <tr><th>项目</th><th>公式项</th><th>参考范围</th></tr>\n </thead>\n <tbody>\n <tr><td>空腹血糖</td><td>x^2+1</td><td>3.9-6.1</td></tr>\n </tbody>\n</table>\n\n乙方签字:李四\n\n设违约金函数f(x)=x^2+1。\n该违约金函数适用于逾期超过30日的场景。",
"elements": [
{
"element_id": "el_001",
"type": "Title",
"text": "检验结果",
"page_number": 1,
"coordinates": [
0.1,
0.12,
0.32,
0.12,
0.32,
0.16,
0.1,
0.16
],
"metadata": {
"category_depth": 0,
"children_ids": [
"el_002",
"el_003",
"el_004",
"el_005"
],
"is_continuation": false,
"data_source": {
"record_locator": {
"protocol": "file",
"remote_file_path": "/projects/demo/quarterly_report.pdf"
},
"url": "file:///projects/demo/quarterly_report.pdf"
}
}
},
{
"element_id": "el_002",
"type": "Table",
"text": "项目 公式项 参考范围\n空腹血糖 x^2+1 3.9-6.1",
"page_number": 1,
"coordinates": [
0.1,
0.2,
0.82,
0.2,
0.82,
0.36,
0.1,
0.36
],
"metadata": {
"parent_id": "el_001",
"ref_element_id": "el_001",
"is_continuation": false,
"data_source": {
"record_locator": {
"protocol": "file",
"remote_file_path": "/projects/demo/quarterly_report.pdf"
},
"url": "file:///projects/demo/quarterly_report.pdf"
}
},
"table_structure": {
"rows": 2,
"cols": 3,
"cells": [
{
"cell_id": "tbl_001_r1_c1",
"row": 1,
"col": 1,
"row_span": 1,
"col_span": 1,
"content_type": "text",
"text": "项目",
"coordinates": [
0.1,
0.2,
0.26,
0.2,
0.26,
0.24,
0.1,
0.24
]
},
{
"cell_id": "tbl_001_r2_c2",
"row": 2,
"col": 2,
"row_span": 1,
"col_span": 1,
"content_type": "formula",
"text": "x^2+1",
"coordinates": [
0.33,
0.24,
0.52,
0.24,
0.52,
0.28,
0.33,
0.28
],
"char_details": [
{
"index": 0,
"text": "x",
"coordinates": [
0.33,
0.24,
0.34,
0.24,
0.34,
0.28,
0.33,
0.28
],
"recognition": {
"confidence": 0.998,
"candidates": [
{
"text": "8",
"confidence": 0.998
}
]
}
}
]
}
]
}
},
{
"element_id": "el_003",
"type": "Image",
"sub_type": "diagram",
"text": "",
"page_number": 1,
"coordinates": [
0.56,
0.2,
0.8,
0.2,
0.8,
0.34,
0.56,
0.34
],
"image_data": {
"image_url": "https://example.com/fig-1.png",
"mime_type": "image/png",
"ocr_text": "签署流程",
"description": "一张展示签署流程的流程图"
},
"metadata": {
"parent_id": "el_001",
"width": 640,
"height": 360,
"data_source": {
"record_locator": {
"protocol": "file",
"remote_file_path": "/projects/demo/quarterly_report.pdf"
},
"url": "file:///projects/demo/quarterly_report.pdf"
}
}
},
{
"element_id": "el_004",
"type": "NarrativeText",
"text": "乙方签字:李四",
"page_number": 1,
"coordinates": [
0.1,
0.4,
0.3,
0.4,
0.3,
0.46,
0.1,
0.46
],
"metadata": {
"parent_id": "el_001",
"has_inline_objects": true,
"inline_object_types": [
"handwriting"
],
"is_continuation": false,
"data_source": {
"record_locator": {
"protocol": "file",
"remote_file_path": "/projects/demo/quarterly_report.pdf"
},
"url": "file:///projects/demo/quarterly_report.pdf"
}
},
"objects": [
{
"object_id": "obj_001",
"type": "handwriting",
"text": "李四",
"text_range": [
5,
7
],
"coordinates": [
0.18,
0.4,
0.26,
0.4,
0.26,
0.46,
0.18,
0.46
],
"metadata": {}
}
],
"char_details": [
{
"index": 0,
"text": "乙",
"coordinates": [
0.1,
0.4,
0.11,
0.4,
0.11,
0.46,
0.1,
0.46
],
"recognition": {
"confidence": 0.997,
"candidates": [
{
"text": "乙",
"confidence": 0.997
}
]
}
}
]
},
{
"element_id": "el_005",
"type": "NarrativeText",
"text": "设违约金函数f(x)=x^2+1。",
"page_number": 1,
"coordinates": [
0.1,
0.48,
0.36,
0.48,
0.36,
0.54,
0.1,
0.54
],
"metadata": {
"parent_id": "el_001",
"is_continuation": false,
"has_inline_objects": true,
"inline_object_types": [
"formula"
],
"data_source": {
"record_locator": {
"protocol": "file",
"remote_file_path": "/projects/demo/quarterly_report.pdf"
},
"url": "file:///projects/demo/quarterly_report.pdf"
}
},
"objects": [
{
"object_id": "obj_002",
"type": "formula",
"text": "x^2+1",
"text_range": [
11,
16
],
"coordinates": [
0.22,
0.48,
0.3,
0.48,
0.3,
0.54,
0.22,
0.54
],
"metadata": {
"display_mode": "inline"
}
}
],
"char_details": [
{
"index": 0,
"text": "设",
"coordinates": [
0.1,
0.48,
0.11,
0.48,
0.11,
0.54,
0.1,
0.54
],
"recognition": {
"confidence": 0.999,
"candidates": [
{
"text": "设",
"confidence": 0.999
}
]
}
}
]
},
{
"element_id": "el_006",
"type": "NarrativeText",
"text": "该违约金函数适用于逾期超过30日的场景。",
"page_number": 2,
"coordinates": [
0.1,
0.1,
0.44,
0.1,
0.44,
0.16,
0.1,
0.16
],
"metadata": {
"is_continuation": true,
"continuation_of": "el_005",
"data_source": {
"record_locator": {
"protocol": "file",
"remote_file_path": "/projects/demo/quarterly_report.pdf"
},
"url": "file:///projects/demo/quarterly_report.pdf"
}
}
}
],
"title_tree": [
{
"element_id": "el_001",
"title": "检验结果",
"level": 1,
"page_number": 1,
"children": []
}
],
"pages": [
{
"page_number": 1,
"page_width": 1576,
"page_height": 1683,
"page_image_url": "https://example.com/page-1.jpg",
"element_ids": [
"el_001",
"el_002",
"el_003",
"el_004",
"el_005"
],
"dpi": 144,
"angle": 0,
"status": "Success"
},
{
"page_number": 2,
"page_width": 1576,
"page_height": 1683,
"page_image_url": "https://example.com/page-2.jpg",
"element_ids": [
"el_006"
],
"dpi": 144,
"angle": 0,
"status": "Success"
}
],
"summary": {
"duration_ms": 812
}
}
}将非结构化文档(image/pdf/word/html/excel/ppt/txt等)解析为 AI 友好的结构化数据(JSON、Markdown),包含丰富的元数据(可追溯、可解释、可验证)
curl --request POST \
--url https://api.textin.com/api/v1/xparse/parse/sync \
--header 'Content-Type: multipart/form-data' \
--header 'x-ti-app-id: <api-key>' \
--header 'x-ti-secret-code: <api-key>' \
--form file='@example-file' \
--form 'file_url=<string>' \
--form 'config={
"document": {
"password": "example-pdf-password"
},
"capabilities": {
"include_hierarchy": true,
"include_inline_objects": true,
"include_char_details": true,
"include_image_data": true,
"include_table_structure": true,
"pages": true,
"title_tree": true,
"table_view": "html"
},
"scope": {
"page_range": "1-2"
},
"config": {
"force_engine": "textin",
"engine_params": {
"formula_level": 0,
"image_output_type": "url"
}
}
}'{
"code": 200,
"message": "success",
"data": {
"schema_version": "1.3.0",
"file_id": "doc_7f3a2b",
"job_id": "job_x9k2m",
"success_count": 2,
"metadata": {
"filename": "quarterly_report.pdf",
"filetype": "application/pdf",
"page_count": 2,
"data_source": {
"record_locator": {
"protocol": "file",
"remote_file_path": "/projects/demo/quarterly_report.pdf"
},
"url": "file:///projects/demo/quarterly_report.pdf"
}
},
"markdown": "# 检验结果\n\n<table>\n <thead>\n <tr><th>项目</th><th>公式项</th><th>参考范围</th></tr>\n </thead>\n <tbody>\n <tr><td>空腹血糖</td><td>x^2+1</td><td>3.9-6.1</td></tr>\n </tbody>\n</table>\n\n乙方签字:李四\n\n设违约金函数f(x)=x^2+1。\n该违约金函数适用于逾期超过30日的场景。",
"elements": [
{
"element_id": "el_001",
"type": "Title",
"text": "检验结果",
"page_number": 1,
"coordinates": [
0.1,
0.12,
0.32,
0.12,
0.32,
0.16,
0.1,
0.16
],
"metadata": {
"category_depth": 0,
"children_ids": [
"el_002",
"el_003",
"el_004",
"el_005"
],
"is_continuation": false,
"data_source": {
"record_locator": {
"protocol": "file",
"remote_file_path": "/projects/demo/quarterly_report.pdf"
},
"url": "file:///projects/demo/quarterly_report.pdf"
}
}
},
{
"element_id": "el_002",
"type": "Table",
"text": "项目 公式项 参考范围\n空腹血糖 x^2+1 3.9-6.1",
"page_number": 1,
"coordinates": [
0.1,
0.2,
0.82,
0.2,
0.82,
0.36,
0.1,
0.36
],
"metadata": {
"parent_id": "el_001",
"ref_element_id": "el_001",
"is_continuation": false,
"data_source": {
"record_locator": {
"protocol": "file",
"remote_file_path": "/projects/demo/quarterly_report.pdf"
},
"url": "file:///projects/demo/quarterly_report.pdf"
}
},
"table_structure": {
"rows": 2,
"cols": 3,
"cells": [
{
"cell_id": "tbl_001_r1_c1",
"row": 1,
"col": 1,
"row_span": 1,
"col_span": 1,
"content_type": "text",
"text": "项目",
"coordinates": [
0.1,
0.2,
0.26,
0.2,
0.26,
0.24,
0.1,
0.24
]
},
{
"cell_id": "tbl_001_r2_c2",
"row": 2,
"col": 2,
"row_span": 1,
"col_span": 1,
"content_type": "formula",
"text": "x^2+1",
"coordinates": [
0.33,
0.24,
0.52,
0.24,
0.52,
0.28,
0.33,
0.28
],
"char_details": [
{
"index": 0,
"text": "x",
"coordinates": [
0.33,
0.24,
0.34,
0.24,
0.34,
0.28,
0.33,
0.28
],
"recognition": {
"confidence": 0.998,
"candidates": [
{
"text": "8",
"confidence": 0.998
}
]
}
}
]
}
]
}
},
{
"element_id": "el_003",
"type": "Image",
"sub_type": "diagram",
"text": "",
"page_number": 1,
"coordinates": [
0.56,
0.2,
0.8,
0.2,
0.8,
0.34,
0.56,
0.34
],
"image_data": {
"image_url": "https://example.com/fig-1.png",
"mime_type": "image/png",
"ocr_text": "签署流程",
"description": "一张展示签署流程的流程图"
},
"metadata": {
"parent_id": "el_001",
"width": 640,
"height": 360,
"data_source": {
"record_locator": {
"protocol": "file",
"remote_file_path": "/projects/demo/quarterly_report.pdf"
},
"url": "file:///projects/demo/quarterly_report.pdf"
}
}
},
{
"element_id": "el_004",
"type": "NarrativeText",
"text": "乙方签字:李四",
"page_number": 1,
"coordinates": [
0.1,
0.4,
0.3,
0.4,
0.3,
0.46,
0.1,
0.46
],
"metadata": {
"parent_id": "el_001",
"has_inline_objects": true,
"inline_object_types": [
"handwriting"
],
"is_continuation": false,
"data_source": {
"record_locator": {
"protocol": "file",
"remote_file_path": "/projects/demo/quarterly_report.pdf"
},
"url": "file:///projects/demo/quarterly_report.pdf"
}
},
"objects": [
{
"object_id": "obj_001",
"type": "handwriting",
"text": "李四",
"text_range": [
5,
7
],
"coordinates": [
0.18,
0.4,
0.26,
0.4,
0.26,
0.46,
0.18,
0.46
],
"metadata": {}
}
],
"char_details": [
{
"index": 0,
"text": "乙",
"coordinates": [
0.1,
0.4,
0.11,
0.4,
0.11,
0.46,
0.1,
0.46
],
"recognition": {
"confidence": 0.997,
"candidates": [
{
"text": "乙",
"confidence": 0.997
}
]
}
}
]
},
{
"element_id": "el_005",
"type": "NarrativeText",
"text": "设违约金函数f(x)=x^2+1。",
"page_number": 1,
"coordinates": [
0.1,
0.48,
0.36,
0.48,
0.36,
0.54,
0.1,
0.54
],
"metadata": {
"parent_id": "el_001",
"is_continuation": false,
"has_inline_objects": true,
"inline_object_types": [
"formula"
],
"data_source": {
"record_locator": {
"protocol": "file",
"remote_file_path": "/projects/demo/quarterly_report.pdf"
},
"url": "file:///projects/demo/quarterly_report.pdf"
}
},
"objects": [
{
"object_id": "obj_002",
"type": "formula",
"text": "x^2+1",
"text_range": [
11,
16
],
"coordinates": [
0.22,
0.48,
0.3,
0.48,
0.3,
0.54,
0.22,
0.54
],
"metadata": {
"display_mode": "inline"
}
}
],
"char_details": [
{
"index": 0,
"text": "设",
"coordinates": [
0.1,
0.48,
0.11,
0.48,
0.11,
0.54,
0.1,
0.54
],
"recognition": {
"confidence": 0.999,
"candidates": [
{
"text": "设",
"confidence": 0.999
}
]
}
}
]
},
{
"element_id": "el_006",
"type": "NarrativeText",
"text": "该违约金函数适用于逾期超过30日的场景。",
"page_number": 2,
"coordinates": [
0.1,
0.1,
0.44,
0.1,
0.44,
0.16,
0.1,
0.16
],
"metadata": {
"is_continuation": true,
"continuation_of": "el_005",
"data_source": {
"record_locator": {
"protocol": "file",
"remote_file_path": "/projects/demo/quarterly_report.pdf"
},
"url": "file:///projects/demo/quarterly_report.pdf"
}
}
}
],
"title_tree": [
{
"element_id": "el_001",
"title": "检验结果",
"level": 1,
"page_number": 1,
"children": []
}
],
"pages": [
{
"page_number": 1,
"page_width": 1576,
"page_height": 1683,
"page_image_url": "https://example.com/page-1.jpg",
"element_ids": [
"el_001",
"el_002",
"el_003",
"el_004",
"el_005"
],
"dpi": 144,
"angle": 0,
"status": "Success"
},
{
"page_number": 2,
"page_width": 1576,
"page_height": 1683,
"page_image_url": "https://example.com/page-2.jpg",
"element_ids": [
"el_006"
],
"dpi": 144,
"angle": 0,
"status": "Success"
}
],
"summary": {
"duration_ms": 812
}
}
}上传文档文件,与 file_url 二选一
文档 URL,与 file 二选一
解析参数配置
Show child attributes
{
"document": { "password": "example-pdf-password" },
"capabilities": {
"include_hierarchy": true,
"include_inline_objects": true,
"include_char_details": true,
"include_image_data": true,
"include_table_structure": true,
"pages": true,
"title_tree": true,
"table_view": "html"
},
"scope": { "page_range": "1-2" },
"config": {
"force_engine": "textin",
"engine_params": {
"formula_level": 0,
"image_output_type": "url"
}
}
}解析结果
状态码
200, 40101, 40102, 40103, 40003, 40004, 40007, 40008, 40301, 40302, 40303, 40304, 40305, 40422, 40423, 40424, 40425, 40427, 40428, 40429, 50207, 40400, 30203, 500 200
状态信息
"success"
错误定位信息,仅在解析错误时返回
Show child attributes
Show child attributes
此页面对您有帮助吗?