跳转到主要内容
POST
/
api
/
v1
/
xparse
/
parse
/
async
创建异步解析任务
curl --request POST \
  --url https://api.textin.com/api/v1/xparse/parse/async \
  --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"
    }
  }
}' \
  --form webhook=https://your-server.com/webhook
{
  "code": 200,
  "message": "success",
  "data": {
    "job_id": "c020a1f03c994091a94d6763cdbe0684"
  }
}

授权

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

上传文档文件,与 file_url 二选一

file_url
string

文档 URL,与 file 二选一

config
object

解析参数配置

示例:
{
"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"
}
}
}
webhook
string

Webhook回调URL(可选),当任务完成或失败时会调用该URL。

Webhook请求格式:

  • Method: POST
  • Content-Type: application/json
  • Body: {"job_id": "xxx", "status": "completed", "result_url": "https://..."}
示例:

"https://your-server.com/webhook"

响应

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
message
string
必填

错误信息

示例:

"success"

data
object
必填