跳转到主要内容
POST
/
api
/
xparse
/
parse
/
sync
同步文档解析
curl --request POST \
  --url https://api.textin.com/api/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 'config={"provider": "textin", "parse_mode": "auto"}'
{
  "code": 200,
  "msg": "success",
  "data": {
    "file_id": "xxx",
    "status": "completed",
    "result": {
      "elements": [
        {
          "element_id": "13a9939f23e485ca20a16c741658bcf64efd82309a6f0a8cf35679a65b2fd0dc",
          "type": "NarrativeText",
          "metadata": {
            "filename": "example.pdf",
            "filetype": "application/pdf",
            "last_modified": "1758624866230",
            "page_number": 1,
            "page_width": 1191,
            "page_height": 1684,
            "coordinates": [
              0.1822,
              0.2316,
              0.6717,
              0.2316,
              0.6717,
              0.2732,
              0.1822,
              0.2732
            ]
          },
          "text": "这是解析出的文本内容"
        }
      ]
    }
  }
}

授权

x-ti-app-id
string
header
必填

登录Textin后前往 "工作台-账号设置-开发者信息" 查看 x-ti-app-id

x-ti-secret-code
string
header
必填

登录Textin后前往 "工作台-账号设置-开发者信息" 查看 x-ti-secret-code

请求体

multipart/form-data
file
file
必填

需要处理的文档文件(支持 PDF、WORD、EXCEL、PPT、图片等多种格式

config
string

Parse配置的 JSON 字符串(可选),与Pipeline Parse节点配置一致。

如果未提供,将使用默认配置(provider: "textin")。

配置格式参考文档解析 - Parse

示例:

"{\"provider\": \"textin\", \"parse_mode\": \"auto\"}"

响应

200 - application/json

解析结果

code
enum<integer>
默认值:200
必填

状态码

  • 200: Success
  • 40101: x-ti-app-id 或 x-ti-secret-code 为空
  • 40102: x-ti-app-id 或 x-ti-secret-code 无效,验证失败
  • 40004: 参数错误,请查看技术文档,检查传参
  • 500: 服务器内部错误

更多详细错误信息参考错误码说明

可用选项:
200,
40101,
40102,
40004,
500
msg
string
必填

错误信息

示例:

"success"

data
object
必填