Skip to content

列出投递记录

GET /v1/webhooks/deliveries

列出已认证用户最近的 Webhook 投递记录。返回按最新排序的投递日志,便于您监控 Webhook 是否成功接收事件。

试一试

Swagger UI 中交互式测试此端点。

需要认证

Authorization 头中包含您的 API 密钥。

请求

请求头

必需
AuthorizationBearer <token>

查询参数

参数类型默认值描述
webhookIdstring--按特定 Webhook ID 筛选投递记录。
limitnumber50返回的最大结果数(1--100)。

代码示例

bash
curl "https://api.docmap.io/v1/webhooks/deliveries?limit=10" \
  -H "Authorization: Bearer dm_live_abc123def456ghi789jkl012mno345"
typescript
const apiKey = process.env.DOCMAP_API_KEY

const response = await fetch(
  'https://api.docmap.io/v1/webhooks/deliveries?limit=10',
  { headers: { 'Authorization': `Bearer ${apiKey}` } },
)

const { data } = await response.json()

for (const delivery of data) {
  console.log(`${delivery.event} → ${delivery.url} — ${delivery.status} (${delivery.durationMs}ms)`)
}
python
import requests

api_key = "dm_live_abc123def456ghi789jkl012mno345"

response = requests.get(
    "https://api.docmap.io/v1/webhooks/deliveries",
    headers={"Authorization": f"Bearer {api_key}"},
    params={"limit": 10},
)

deliveries = response.json()["data"]

for d in deliveries:
    print(f"{d['event']}{d['url']}{d['status']} ({d['durationMs']}ms)")

响应

状态码:200 OK

响应体包含一个 data 数组,由投递日志对象组成。

字段

数组中每个对象包含:

字段类型描述
idstring投递记录的唯一标识符。
userIdstring拥有该 Webhook 的用户 ID。
webhookIdstring目标 Webhook 的 ID。
extractionIdstring触发此投递的提取 ID。
eventstring事件名称:extraction.completedextraction.failed
urlstring投递时的 Webhook URL。
statusstring端点返回 2xx 状态码时为 success,否则为 failed
httpStatusnumber | nullHTTP 响应状态码。如果请求在收到响应前失败(例如网络错误、超时),则为 null
errorstring | null投递失败时的错误信息。成功时为 null
durationMsnumber投递尝试的往返时间(毫秒)。
createdAtstring投递尝试时间的 ISO 8601 时间戳。

示例

json
{
  "data": [
    {
      "id": "abc123def456",
      "userId": "uid_a1b2c3d4e5f6",
      "webhookId": "webhook-abc123def456",
      "extractionId": "extract-xyz789",
      "event": "extraction.completed",
      "url": "https://your-app.com/webhooks/docmap",
      "status": "success",
      "httpStatus": 200,
      "error": null,
      "durationMs": 342,
      "createdAt": "2025-01-20T14:30:04.000Z"
    },
    {
      "id": "def456ghi789",
      "userId": "uid_a1b2c3d4e5f6",
      "webhookId": "webhook-abc123def456",
      "extractionId": "extract-uvw456",
      "event": "extraction.failed",
      "url": "https://your-app.com/webhooks/docmap",
      "status": "failed",
      "httpStatus": null,
      "error": "The operation was aborted due to timeout",
      "durationMs": 10003,
      "createdAt": "2025-01-20T12:15:00.000Z"
    }
  ]
}

错误

状态码错误码描述
401UNAUTHORIZED缺少、无效或已过期的 API 密钥/令牌。

DocMap API 文档