创建文档转换异步任务
curl --request POST \
--url https://adp.laiye.com/open/agentic_doc_processor/{tenant_name}/v1/doc/convert/create/task \
--header 'Content-Type: application/json' \
--header 'X-API-KEY: <api-key>' \
--data '
{
"file_url": "https://example.com/long-document.pdf",
"first_convert_page": 1,
"last_convert_page": 20
}
'const options = {
method: 'POST',
headers: {'X-API-KEY': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
file_url: 'https://example.com/long-document.pdf',
first_convert_page: 1,
last_convert_page: 20
})
};
fetch('https://adp.laiye.com/open/agentic_doc_processor/{tenant_name}/v1/doc/convert/create/task', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://adp.laiye.com/open/agentic_doc_processor/{tenant_name}/v1/doc/convert/create/task"
payload = {
"file_url": "https://example.com/long-document.pdf",
"first_convert_page": 1,
"last_convert_page": 20
}
headers = {
"X-API-KEY": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)HttpResponse<String> response = Unirest.post("https://adp.laiye.com/open/agentic_doc_processor/{tenant_name}/v1/doc/convert/create/task")
.header("X-API-KEY", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"file_url\": \"https://example.com/long-document.pdf\",\n \"first_convert_page\": 1,\n \"last_convert_page\": 20\n}")
.asString();const url = 'https://adp.laiye.com/open/agentic_doc_processor/{tenant_name}/v1/doc/convert/create/task';
const options = {
method: 'POST',
headers: {'X-API-KEY': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
file_url: 'https://example.com/long-document.pdf',
first_convert_page: 1,
last_convert_page: 20
})
};
fetch(url, options)
.then(res => res.json())
.then(json => console.log(json))
.catch(err => console.error(err));package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://adp.laiye.com/open/agentic_doc_processor/{tenant_name}/v1/doc/convert/create/task"
payload := strings.NewReader("{\n \"file_url\": \"https://example.com/long-document.pdf\",\n \"first_convert_page\": 1,\n \"last_convert_page\": 20\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-API-KEY", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}using RestSharp;
var options = new RestClientOptions("https://adp.laiye.com/open/agentic_doc_processor/{tenant_name}/v1/doc/convert/create/task");
var client = new RestClient(options);
var request = new RestRequest("");
request.AddHeader("X-API-KEY", "<api-key>");
request.AddJsonBody("{\n \"file_url\": \"https://example.com/long-document.pdf\",\n \"first_convert_page\": 1,\n \"last_convert_page\": 20\n}", false);
var response = await client.PostAsync(request);
Console.WriteLine("{0}", response.Content);
<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://adp.laiye.com/open/agentic_doc_processor/{tenant_name}/v1/doc/convert/create/task",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'file_url' => 'https://example.com/long-document.pdf',
'first_convert_page' => 1,
'last_convert_page' => 20
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-KEY: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}{
"code": "success",
"message": "",
"tips": null,
"data": {
"task_id": "task_abc123"
}
}文档转换
创建文档转换异步任务
创建文档转换任务并立即返回 task_id。当前队列消息保留约 1 小时,单任务消费超时约 180 秒,结果文件通常约 1 小时有效;这些时长尚未作为稳定 SLA。
创建失败仍可能表现为 HTTP 200、code=success、data=null,必须确认 data.task_id 非空。请使用查询接口轮询结果,并采用退避策略。
POST
/
open
/
agentic_doc_processor
/
{tenant_name}
/
v1
/
doc
/
convert
/
create
/
task
创建文档转换异步任务
curl --request POST \
--url https://adp.laiye.com/open/agentic_doc_processor/{tenant_name}/v1/doc/convert/create/task \
--header 'Content-Type: application/json' \
--header 'X-API-KEY: <api-key>' \
--data '
{
"file_url": "https://example.com/long-document.pdf",
"first_convert_page": 1,
"last_convert_page": 20
}
'const options = {
method: 'POST',
headers: {'X-API-KEY': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
file_url: 'https://example.com/long-document.pdf',
first_convert_page: 1,
last_convert_page: 20
})
};
fetch('https://adp.laiye.com/open/agentic_doc_processor/{tenant_name}/v1/doc/convert/create/task', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://adp.laiye.com/open/agentic_doc_processor/{tenant_name}/v1/doc/convert/create/task"
payload = {
"file_url": "https://example.com/long-document.pdf",
"first_convert_page": 1,
"last_convert_page": 20
}
headers = {
"X-API-KEY": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)HttpResponse<String> response = Unirest.post("https://adp.laiye.com/open/agentic_doc_processor/{tenant_name}/v1/doc/convert/create/task")
.header("X-API-KEY", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"file_url\": \"https://example.com/long-document.pdf\",\n \"first_convert_page\": 1,\n \"last_convert_page\": 20\n}")
.asString();const url = 'https://adp.laiye.com/open/agentic_doc_processor/{tenant_name}/v1/doc/convert/create/task';
const options = {
method: 'POST',
headers: {'X-API-KEY': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
file_url: 'https://example.com/long-document.pdf',
first_convert_page: 1,
last_convert_page: 20
})
};
fetch(url, options)
.then(res => res.json())
.then(json => console.log(json))
.catch(err => console.error(err));package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://adp.laiye.com/open/agentic_doc_processor/{tenant_name}/v1/doc/convert/create/task"
payload := strings.NewReader("{\n \"file_url\": \"https://example.com/long-document.pdf\",\n \"first_convert_page\": 1,\n \"last_convert_page\": 20\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-API-KEY", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}using RestSharp;
var options = new RestClientOptions("https://adp.laiye.com/open/agentic_doc_processor/{tenant_name}/v1/doc/convert/create/task");
var client = new RestClient(options);
var request = new RestRequest("");
request.AddHeader("X-API-KEY", "<api-key>");
request.AddJsonBody("{\n \"file_url\": \"https://example.com/long-document.pdf\",\n \"first_convert_page\": 1,\n \"last_convert_page\": 20\n}", false);
var response = await client.PostAsync(request);
Console.WriteLine("{0}", response.Content);
<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://adp.laiye.com/open/agentic_doc_processor/{tenant_name}/v1/doc/convert/create/task",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'file_url' => 'https://example.com/long-document.pdf',
'first_convert_page' => 1,
'last_convert_page' => 20
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-KEY: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}{
"code": "success",
"message": "",
"tips": null,
"data": {
"task_id": "task_abc123"
}
}授权
生产环境 API Key,可在 ADP 平台的「我的 API」中查看。请确保 API Key 有效且属于生产环境。
路径参数
租户名称,默认 laiye。
请求体
application/json