跳转到主要内容

Documentation Index

Fetch the complete documentation index at: https://firecrawl-mog-search-exclude-include-domains.mintlify.app/llms.txt

Use this file to discover all available pages before exploring further.

在爬取、批量抓取、提取或代理任务开始、进行或完成时立即收到通知。你无需主动轮询状态,只需提供一个 HTTPS 端点,Firecrawl 就会将事件实时投递到该端点。

支持的操作

操作事件
爬取started, page, completed
批量抓取started, page, completed
提取started, completed, failed
代理started, action, completed, failed, cancelled
请参见事件类型以查看完整的 payload 详情和示例。

配置

在你的请求中添加一个 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 会被标记为失败,不再进行后续尝试。