创建异步解析任务
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",
"remove_watermark": true,
"crop_dewarp": true
},
"scope": {
"page_range": "1-2"
},
"config": {
"force_engine": "textin",
"engine_params": {
"parse_mode": "scan",
"formula_level": 0,
"image_output_type": "url",
"recognize_chemical": true
}
}
}' \
--form webhook=https://your-server.com/webhookimport requests
url = "https://api.textin.com/api/v1/xparse/parse/async"
files = { "file": ("example-file", open("example-file", "rb")) }
payload = {
"file_url": "<string>",
"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\",
\"remove_watermark\": true,
\"crop_dewarp\": true
},
\"scope\": {
\"page_range\": \"1-2\"
},
\"config\": {
\"force_engine\": \"textin\",
\"engine_params\": {
\"parse_mode\": \"scan\",
\"formula_level\": 0,
\"image_output_type\": \"url\",
\"recognize_chemical\": true
}
}
}",
"webhook": "https://your-server.com/webhook"
}
headers = {
"x-ti-app-id": "<api-key>",
"x-ti-secret-code": "<api-key>"
}
response = requests.post(url, data=payload, files=files, headers=headers)
print(response.text)const form = new FormData();
form.append('file', '<string>');
form.append('file_url', '<string>');
form.append('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",
"remove_watermark": true,
"crop_dewarp": true
},
"scope": {
"page_range": "1-2"
},
"config": {
"force_engine": "textin",
"engine_params": {
"parse_mode": "scan",
"formula_level": 0,
"image_output_type": "url",
"recognize_chemical": true
}
}
}');
form.append('webhook', 'https://your-server.com/webhook');
const options = {
method: 'POST',
headers: {'x-ti-app-id': '<api-key>', 'x-ti-secret-code': '<api-key>'}
};
options.body = form;
fetch('https://api.textin.com/api/v1/xparse/parse/async', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.textin.com/api/v1/xparse/parse/async",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file_url\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"config\"\r\n\r\n{\r\n \"document\": {\r\n \"password\": \"example-pdf-password\"\r\n },\r\n \"capabilities\": {\r\n \"include_hierarchy\": true,\r\n \"include_inline_objects\": true,\r\n \"include_char_details\": true,\r\n \"include_image_data\": true,\r\n \"include_table_structure\": true,\r\n \"pages\": true,\r\n \"title_tree\": true,\r\n \"table_view\": \"html\",\r\n \"remove_watermark\": true,\r\n \"crop_dewarp\": true\r\n },\r\n \"scope\": {\r\n \"page_range\": \"1-2\"\r\n },\r\n \"config\": {\r\n \"force_engine\": \"textin\",\r\n \"engine_params\": {\r\n \"parse_mode\": \"scan\",\r\n \"formula_level\": 0,\r\n \"image_output_type\": \"url\",\r\n \"recognize_chemical\": true\r\n }\r\n }\r\n}\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"webhook\"\r\n\r\nhttps://your-server.com/webhook\r\n-----011000010111000001101001--",
CURLOPT_HTTPHEADER => [
"Content-Type: multipart/form-data",
"x-ti-app-id: <api-key>",
"x-ti-secret-code: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.textin.com/api/v1/xparse/parse/async"
payload := strings.NewReader("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file_url\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"config\"\r\n\r\n{\r\n \"document\": {\r\n \"password\": \"example-pdf-password\"\r\n },\r\n \"capabilities\": {\r\n \"include_hierarchy\": true,\r\n \"include_inline_objects\": true,\r\n \"include_char_details\": true,\r\n \"include_image_data\": true,\r\n \"include_table_structure\": true,\r\n \"pages\": true,\r\n \"title_tree\": true,\r\n \"table_view\": \"html\",\r\n \"remove_watermark\": true,\r\n \"crop_dewarp\": true\r\n },\r\n \"scope\": {\r\n \"page_range\": \"1-2\"\r\n },\r\n \"config\": {\r\n \"force_engine\": \"textin\",\r\n \"engine_params\": {\r\n \"parse_mode\": \"scan\",\r\n \"formula_level\": 0,\r\n \"image_output_type\": \"url\",\r\n \"recognize_chemical\": true\r\n }\r\n }\r\n}\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"webhook\"\r\n\r\nhttps://your-server.com/webhook\r\n-----011000010111000001101001--")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-ti-app-id", "<api-key>")
req.Header.Add("x-ti-secret-code", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.textin.com/api/v1/xparse/parse/async")
.header("x-ti-app-id", "<api-key>")
.header("x-ti-secret-code", "<api-key>")
.body("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file_url\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"config\"\r\n\r\n{\r\n \"document\": {\r\n \"password\": \"example-pdf-password\"\r\n },\r\n \"capabilities\": {\r\n \"include_hierarchy\": true,\r\n \"include_inline_objects\": true,\r\n \"include_char_details\": true,\r\n \"include_image_data\": true,\r\n \"include_table_structure\": true,\r\n \"pages\": true,\r\n \"title_tree\": true,\r\n \"table_view\": \"html\",\r\n \"remove_watermark\": true,\r\n \"crop_dewarp\": true\r\n },\r\n \"scope\": {\r\n \"page_range\": \"1-2\"\r\n },\r\n \"config\": {\r\n \"force_engine\": \"textin\",\r\n \"engine_params\": {\r\n \"parse_mode\": \"scan\",\r\n \"formula_level\": 0,\r\n \"image_output_type\": \"url\",\r\n \"recognize_chemical\": true\r\n }\r\n }\r\n}\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"webhook\"\r\n\r\nhttps://your-server.com/webhook\r\n-----011000010111000001101001--")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.textin.com/api/v1/xparse/parse/async")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-ti-app-id"] = '<api-key>'
request["x-ti-secret-code"] = '<api-key>'
request.body = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file_url\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"config\"\r\n\r\n{\r\n \"document\": {\r\n \"password\": \"example-pdf-password\"\r\n },\r\n \"capabilities\": {\r\n \"include_hierarchy\": true,\r\n \"include_inline_objects\": true,\r\n \"include_char_details\": true,\r\n \"include_image_data\": true,\r\n \"include_table_structure\": true,\r\n \"pages\": true,\r\n \"title_tree\": true,\r\n \"table_view\": \"html\",\r\n \"remove_watermark\": true,\r\n \"crop_dewarp\": true\r\n },\r\n \"scope\": {\r\n \"page_range\": \"1-2\"\r\n },\r\n \"config\": {\r\n \"force_engine\": \"textin\",\r\n \"engine_params\": {\r\n \"parse_mode\": \"scan\",\r\n \"formula_level\": 0,\r\n \"image_output_type\": \"url\",\r\n \"recognize_chemical\": true\r\n }\r\n }\r\n}\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"webhook\"\r\n\r\nhttps://your-server.com/webhook\r\n-----011000010111000001101001--"
response = http.request(request)
puts response.read_body{
"code": 200,
"message": "success",
"data": {
"job_id": "c020a1f03c994091a94d6763cdbe0684"
}
}智能文档解析-新版
异步解析
创建异步文档解析任务,立即返回job_id,通过job_id查询处理状态和结果。
适用于处理大文件或批量文件,避免HTTP超时限制。
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",
"remove_watermark": true,
"crop_dewarp": true
},
"scope": {
"page_range": "1-2"
},
"config": {
"force_engine": "textin",
"engine_params": {
"parse_mode": "scan",
"formula_level": 0,
"image_output_type": "url",
"recognize_chemical": true
}
}
}' \
--form webhook=https://your-server.com/webhookimport requests
url = "https://api.textin.com/api/v1/xparse/parse/async"
files = { "file": ("example-file", open("example-file", "rb")) }
payload = {
"file_url": "<string>",
"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\",
\"remove_watermark\": true,
\"crop_dewarp\": true
},
\"scope\": {
\"page_range\": \"1-2\"
},
\"config\": {
\"force_engine\": \"textin\",
\"engine_params\": {
\"parse_mode\": \"scan\",
\"formula_level\": 0,
\"image_output_type\": \"url\",
\"recognize_chemical\": true
}
}
}",
"webhook": "https://your-server.com/webhook"
}
headers = {
"x-ti-app-id": "<api-key>",
"x-ti-secret-code": "<api-key>"
}
response = requests.post(url, data=payload, files=files, headers=headers)
print(response.text)const form = new FormData();
form.append('file', '<string>');
form.append('file_url', '<string>');
form.append('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",
"remove_watermark": true,
"crop_dewarp": true
},
"scope": {
"page_range": "1-2"
},
"config": {
"force_engine": "textin",
"engine_params": {
"parse_mode": "scan",
"formula_level": 0,
"image_output_type": "url",
"recognize_chemical": true
}
}
}');
form.append('webhook', 'https://your-server.com/webhook');
const options = {
method: 'POST',
headers: {'x-ti-app-id': '<api-key>', 'x-ti-secret-code': '<api-key>'}
};
options.body = form;
fetch('https://api.textin.com/api/v1/xparse/parse/async', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.textin.com/api/v1/xparse/parse/async",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file_url\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"config\"\r\n\r\n{\r\n \"document\": {\r\n \"password\": \"example-pdf-password\"\r\n },\r\n \"capabilities\": {\r\n \"include_hierarchy\": true,\r\n \"include_inline_objects\": true,\r\n \"include_char_details\": true,\r\n \"include_image_data\": true,\r\n \"include_table_structure\": true,\r\n \"pages\": true,\r\n \"title_tree\": true,\r\n \"table_view\": \"html\",\r\n \"remove_watermark\": true,\r\n \"crop_dewarp\": true\r\n },\r\n \"scope\": {\r\n \"page_range\": \"1-2\"\r\n },\r\n \"config\": {\r\n \"force_engine\": \"textin\",\r\n \"engine_params\": {\r\n \"parse_mode\": \"scan\",\r\n \"formula_level\": 0,\r\n \"image_output_type\": \"url\",\r\n \"recognize_chemical\": true\r\n }\r\n }\r\n}\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"webhook\"\r\n\r\nhttps://your-server.com/webhook\r\n-----011000010111000001101001--",
CURLOPT_HTTPHEADER => [
"Content-Type: multipart/form-data",
"x-ti-app-id: <api-key>",
"x-ti-secret-code: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.textin.com/api/v1/xparse/parse/async"
payload := strings.NewReader("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file_url\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"config\"\r\n\r\n{\r\n \"document\": {\r\n \"password\": \"example-pdf-password\"\r\n },\r\n \"capabilities\": {\r\n \"include_hierarchy\": true,\r\n \"include_inline_objects\": true,\r\n \"include_char_details\": true,\r\n \"include_image_data\": true,\r\n \"include_table_structure\": true,\r\n \"pages\": true,\r\n \"title_tree\": true,\r\n \"table_view\": \"html\",\r\n \"remove_watermark\": true,\r\n \"crop_dewarp\": true\r\n },\r\n \"scope\": {\r\n \"page_range\": \"1-2\"\r\n },\r\n \"config\": {\r\n \"force_engine\": \"textin\",\r\n \"engine_params\": {\r\n \"parse_mode\": \"scan\",\r\n \"formula_level\": 0,\r\n \"image_output_type\": \"url\",\r\n \"recognize_chemical\": true\r\n }\r\n }\r\n}\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"webhook\"\r\n\r\nhttps://your-server.com/webhook\r\n-----011000010111000001101001--")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-ti-app-id", "<api-key>")
req.Header.Add("x-ti-secret-code", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.textin.com/api/v1/xparse/parse/async")
.header("x-ti-app-id", "<api-key>")
.header("x-ti-secret-code", "<api-key>")
.body("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file_url\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"config\"\r\n\r\n{\r\n \"document\": {\r\n \"password\": \"example-pdf-password\"\r\n },\r\n \"capabilities\": {\r\n \"include_hierarchy\": true,\r\n \"include_inline_objects\": true,\r\n \"include_char_details\": true,\r\n \"include_image_data\": true,\r\n \"include_table_structure\": true,\r\n \"pages\": true,\r\n \"title_tree\": true,\r\n \"table_view\": \"html\",\r\n \"remove_watermark\": true,\r\n \"crop_dewarp\": true\r\n },\r\n \"scope\": {\r\n \"page_range\": \"1-2\"\r\n },\r\n \"config\": {\r\n \"force_engine\": \"textin\",\r\n \"engine_params\": {\r\n \"parse_mode\": \"scan\",\r\n \"formula_level\": 0,\r\n \"image_output_type\": \"url\",\r\n \"recognize_chemical\": true\r\n }\r\n }\r\n}\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"webhook\"\r\n\r\nhttps://your-server.com/webhook\r\n-----011000010111000001101001--")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.textin.com/api/v1/xparse/parse/async")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-ti-app-id"] = '<api-key>'
request["x-ti-secret-code"] = '<api-key>'
request.body = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file_url\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"config\"\r\n\r\n{\r\n \"document\": {\r\n \"password\": \"example-pdf-password\"\r\n },\r\n \"capabilities\": {\r\n \"include_hierarchy\": true,\r\n \"include_inline_objects\": true,\r\n \"include_char_details\": true,\r\n \"include_image_data\": true,\r\n \"include_table_structure\": true,\r\n \"pages\": true,\r\n \"title_tree\": true,\r\n \"table_view\": \"html\",\r\n \"remove_watermark\": true,\r\n \"crop_dewarp\": true\r\n },\r\n \"scope\": {\r\n \"page_range\": \"1-2\"\r\n },\r\n \"config\": {\r\n \"force_engine\": \"textin\",\r\n \"engine_params\": {\r\n \"parse_mode\": \"scan\",\r\n \"formula_level\": 0,\r\n \"image_output_type\": \"url\",\r\n \"recognize_chemical\": true\r\n }\r\n }\r\n}\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"webhook\"\r\n\r\nhttps://your-server.com/webhook\r\n-----011000010111000001101001--"
response = http.request(request)
puts response.read_body{
"code": 200,
"message": "success",
"data": {
"job_id": "c020a1f03c994091a94d6763cdbe0684"
}
}授权
请求体
multipart/form-data
上传文档文件,与 file_url 二选一
文档 URL,与 file 二选一
解析参数配置
Show child attributes
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",
"remove_watermark": true,
"crop_dewarp": true
},
"scope": { "page_range": "1-2" },
"config": {
"force_engine": "textin",
"engine_params": {
"parse_mode": "scan",
"formula_level": 0,
"image_output_type": "url",
"recognize_chemical": true
}
}
}
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
任务创建成功
此页面对您有帮助吗?
⌘I

