跳转到主要内容
Webhooks 让你在操作执行过程中实时接收通知,而无需轮询状态。

支持的操作

操作事件
Crawlstarted, page, completed
Batch Scrapestarted, page, completed
Extractstarted, completed, failed

配置

在你的请求中添加一个 webhook 对象:
JSON
{
  "webhook": {
    "url": "https://your-domain.com/webhook",
    "metadata": {
      "any_key": "any_value"
    },
    "events": ["started", "page", "completed", "failed"]
  }
}
字段类型必填描述
urlstring你的端点 URL(HTTPS)
headersobject要附带的自定义请求头
metadataobject包含在负载中的自定义数据
eventsarray要接收的事件类型(默认:全部)

用法

通过 Webhook 爬取

cURL
curl -X POST https://api.firecrawl.dev/v2/crawl \
    -H 'Content-Type: application/json' \
    -H 'Authorization: Bearer YOUR_API_KEY' \
    -d '{
      "url": "https://docs.firecrawl.dev",
      "limit": 100,
      "webhook": {
        "url": "https://your-domain.com/webhook",
        "metadata": {
          "any_key": "any_value"
        },
        "events": ["started", "page", "completed"]
      }
    }'

通过 Webhook 进行批量抓取

cURL
curl -X POST https://api.firecrawl.dev/v2/batch/scrape \
    -H 'Content-Type: application/json' \
    -H 'Authorization: Bearer YOUR_API_KEY' \
    -d '{
      "urls": [
        "https://example.com/page1",
        "https://example.com/page2",
        "https://example.com/page3"
      ],
      "webhook": {
        "url": "https://your-domain.com/webhook",
        "metadata": {
          "any_key": "any_value"
        },
        "events": ["started", "page", "completed"]
      }
    }'

超时与重试

你的 endpoint 必须在 10 秒 内返回 2xx 状态码。 如果发送失败(超时、非 2xx 状态码或网络错误),Firecrawl 会自动重试:
重试次数失败后的延迟时间
第 1 次1 分钟
第 2 次5 分钟
第 3 次15 分钟
在 3 次重试均失败后,该 webhook 会被标记为失败,不再进行后续尝试。