创建 Webhook
curl --request POST \
--url https://adp.laiye.com/open/agentic_doc_processor/{tenant_name}/v1/webhook/create \
--header 'Content-Type: application/json' \
--header 'X-API-KEY: <api-key>' \
--data '
{
"webhook_url": "https://hooks.example.com/adp",
"event_types": [
"doc_extract_completed"
],
"app_id": [
"app_abc123"
]
}
'const options = {
method: 'POST',
headers: {'X-API-KEY': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
webhook_url: 'https://hooks.example.com/adp',
event_types: ['doc_extract_completed'],
app_id: ['app_abc123']
})
};
fetch('https://adp.laiye.com/open/agentic_doc_processor/{tenant_name}/v1/webhook/create', 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/webhook/create"
payload = {
"webhook_url": "https://hooks.example.com/adp",
"event_types": ["doc_extract_completed"],
"app_id": ["app_abc123"]
}
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/webhook/create")
.header("X-API-KEY", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"webhook_url\": \"https://hooks.example.com/adp\",\n \"event_types\": [\n \"doc_extract_completed\"\n ],\n \"app_id\": [\n \"app_abc123\"\n ]\n}")
.asString();const url = 'https://adp.laiye.com/open/agentic_doc_processor/{tenant_name}/v1/webhook/create';
const options = {
method: 'POST',
headers: {'X-API-KEY': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
webhook_url: 'https://hooks.example.com/adp',
event_types: ['doc_extract_completed'],
app_id: ['app_abc123']
})
};
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/webhook/create"
payload := strings.NewReader("{\n \"webhook_url\": \"https://hooks.example.com/adp\",\n \"event_types\": [\n \"doc_extract_completed\"\n ],\n \"app_id\": [\n \"app_abc123\"\n ]\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/webhook/create");
var client = new RestClient(options);
var request = new RestRequest("");
request.AddHeader("X-API-KEY", "<api-key>");
request.AddJsonBody("{\n \"webhook_url\": \"https://hooks.example.com/adp\",\n \"event_types\": [\n \"doc_extract_completed\"\n ],\n \"app_id\": [\n \"app_abc123\"\n ]\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/webhook/create",
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([
'webhook_url' => 'https://hooks.example.com/adp',
'event_types' => [
'doc_extract_completed'
],
'app_id' => [
'app_abc123'
]
]),
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": "<string>",
"message": "<string>",
"tips": "<string>",
"data": {
"webhook_id": "<string>"
}
}{
"detail": [
{
"type": "greater_than",
"loc": [
"query",
"limit"
],
"msg": "Input should be greater than 0",
"input": 0,
"ctx": {
"gt": 0
}
}
]
}Webhook
创建 Webhook
创建 Webhook 配置。每个账号最多保留 5 个配置;app_id 省略、为 null 或空数组时,订阅当前账号下所有应用,传数组时只订阅指定应用。
回调使用 POST application/json,请求体为 {event_type, timestamp, data}。正式环境会发送 X-Webhook-Signature: sha256=... 和 X-Webhook-Timestamp;签名计算为 HMAC-SHA256(secret, timestamp + "." + raw_body)。
当前 OpenAPI 不返回、设置或轮换 secret,因此外部调用方无法独立完成验签;失败重试也没有公开 SLA。只可配置由你控制的公网 HTTPS 地址,接收端应快速返回 HTTP 200。
POST
/
open
/
agentic_doc_processor
/
{tenant_name}
/
v1
/
webhook
/
create
创建 Webhook
curl --request POST \
--url https://adp.laiye.com/open/agentic_doc_processor/{tenant_name}/v1/webhook/create \
--header 'Content-Type: application/json' \
--header 'X-API-KEY: <api-key>' \
--data '
{
"webhook_url": "https://hooks.example.com/adp",
"event_types": [
"doc_extract_completed"
],
"app_id": [
"app_abc123"
]
}
'const options = {
method: 'POST',
headers: {'X-API-KEY': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
webhook_url: 'https://hooks.example.com/adp',
event_types: ['doc_extract_completed'],
app_id: ['app_abc123']
})
};
fetch('https://adp.laiye.com/open/agentic_doc_processor/{tenant_name}/v1/webhook/create', 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/webhook/create"
payload = {
"webhook_url": "https://hooks.example.com/adp",
"event_types": ["doc_extract_completed"],
"app_id": ["app_abc123"]
}
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/webhook/create")
.header("X-API-KEY", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"webhook_url\": \"https://hooks.example.com/adp\",\n \"event_types\": [\n \"doc_extract_completed\"\n ],\n \"app_id\": [\n \"app_abc123\"\n ]\n}")
.asString();const url = 'https://adp.laiye.com/open/agentic_doc_processor/{tenant_name}/v1/webhook/create';
const options = {
method: 'POST',
headers: {'X-API-KEY': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
webhook_url: 'https://hooks.example.com/adp',
event_types: ['doc_extract_completed'],
app_id: ['app_abc123']
})
};
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/webhook/create"
payload := strings.NewReader("{\n \"webhook_url\": \"https://hooks.example.com/adp\",\n \"event_types\": [\n \"doc_extract_completed\"\n ],\n \"app_id\": [\n \"app_abc123\"\n ]\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/webhook/create");
var client = new RestClient(options);
var request = new RestRequest("");
request.AddHeader("X-API-KEY", "<api-key>");
request.AddJsonBody("{\n \"webhook_url\": \"https://hooks.example.com/adp\",\n \"event_types\": [\n \"doc_extract_completed\"\n ],\n \"app_id\": [\n \"app_abc123\"\n ]\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/webhook/create",
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([
'webhook_url' => 'https://hooks.example.com/adp',
'event_types' => [
'doc_extract_completed'
],
'app_id' => [
'app_abc123'
]
]),
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": "<string>",
"message": "<string>",
"tips": "<string>",
"data": {
"webhook_id": "<string>"
}
}{
"detail": [
{
"type": "greater_than",
"loc": [
"query",
"limit"
],
"msg": "Input should be greater than 0",
"input": 0,
"ctx": {
"gt": 0
}
}
]
}授权
生产环境 API Key,可在 ADP 平台的「我的 API」中查看。请确保 API Key 有效且属于生产环境。
路径参数
租户名称,默认 laiye。
请求体
application/json
由调用方控制的公网 HTTPS 回调地址。公共合同不接受 HTTP 或内网地址。
Maximum string length:
512Pattern:
^https://Minimum array length:
1可用选项:
doc_parse_completed, doc_extract_completed, collaboration_start, collaboration_success, collaboration_failed, collaboration_completed, collaboration_timeout 应用范围;省略、null 或空数组表示当前账号的全部应用。
Minimum string length:
1