> ## Documentation Index
> Fetch the complete documentation index at: https://docs.firecrawl.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# 介绍

> 通过一个 API 即可进行网页搜索、抓取任意页面并与之交互。

<Note>
  \*\*对于 AI 代理：\*\*在任意文档 URL 后附加 `.md` 即可获取 Markdown，例如 [introduction.md](/zh/introduction.md)。
</Note>

<div id="get-started">
  ## 开始使用
</div>

<CardGroup cols={2}>
  <Card title="获取你的 API 密钥" icon="key" href="https://www.firecrawl.dev/app/api-keys">
    注册并获取你的 API 密钥，开始使用 Firecrawl
  </Card>

  <Card title="在 Playground 中试用" icon="play" href="https://www.firecrawl.dev/playground">
    无需编写任何代码即可立即测试 API
  </Card>
</CardGroup>

<div id="use-firecrawl-with-ai-agents-recommended">
  ### 将 Firecrawl 与 AI 代理配合使用 (推荐)
</div>

Firecrawl 技能是让代理发现并使用 Firecrawl 的最快方式。否则，你的代理不会知道可以使用 Firecrawl。

```bash theme={null}
npx -y firecrawl-cli@latest init --all --browser
```

<Note>
  安装该 技能 后请重启代理。完整的配置流程请参见 [Skill + CLI](/zh/sdks/cli)。
</Note>

也可以使用 [MCP Server](/zh/mcp-server) 将 Firecrawl 直接连接到 Claude、Cursor、Windsurf、VS Code 等其他 AI 工具。

***

<div id="what-can-firecrawl-do">
  ## Firecrawl 可以做什么？
</div>

<CardGroup cols={3}>
  <Card title="搜索" icon="magnifying-glass" href="#search">
    进行网页搜索并从结果中获取完整页面内容
  </Card>

  <Card title="抓取" icon="file-lines" href="#scrape">
    从任意 URL 提取内容，支持 markdown、HTML 或结构化 JSON 格式
  </Card>

  <Card title="交互" icon="hand-pointer" href="#interact">
    继续处理任何已抓取的页面——点击、填写表单、提取动态内容
  </Card>
</CardGroup>

<div id="why-firecrawl">
  ### 为什么选择 Firecrawl？
</div>

* **适用于 LLM 的输出**：干净的 markdown、结构化 JSON、截图等。
* **应对复杂场景**：代理、反机器人机制、JavaScript 渲染以及动态内容。
* **可靠**：专为生产环境打造，具备高可用性和稳定一致的结果。
* **快速**：数秒内返回结果，并针对高吞吐量进行了优化。
* **MCP Server**：通过 [模型上下文协议](/zh/mcp-server) 将 Firecrawl 连接到任何 AI 工具。

***

<div id="search">
  ## 搜索
</div>

进行网页搜索，并在一次调用中获取搜索结果的完整页面内容。请参见 [Search 功能文档](/zh/features/search) 了解所有选项。

<CodeGroup>
  ```python Python theme={null}
  from firecrawl import Firecrawl

  firecrawl = Firecrawl(api_key="fc-YOUR-API-KEY")

  results = firecrawl.search(
      query="Firecrawl",
      limit=3,
  )
  print(results)
  ```

  ```js Node theme={null}
  import Firecrawl from '@mendable/firecrawl-js';

  const firecrawl = new Firecrawl({ apiKey: "fc-你的 API 密钥" });

  const results = await firecrawl.search('firecrawl', {
    limit: 3,
    scrapeOptions: { formats: ['markdown'] }
  });
  console.log(results);
  ```

  ```bash cURL theme={null}
  curl -s -X POST "https://api.firecrawl.dev/v2/search" \
    -H "Authorization: Bearer $FIRECRAWL_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
      "query": "firecrawl",
      "limit": 3
    }'
  ```

  ```bash CLI theme={null}
  # 搜索网络
  firecrawl search "firecrawl web scraping" --limit 5 --pretty
  ```
</CodeGroup>

<Accordion title="响应">
  SDK 会直接返回数据对象。cURL 会返回完整的 payload。

  ```json JSON theme={null}
  {
    "success": true,
    "data": {
      "web": [
        {
          "url": "https://www.firecrawl.dev/",
          "title": "Firecrawl - 面向 AI 的 Web 数据 API",
          "description": "用于 AI 的网页爬取、抓取与搜索 API。为规模而建。Firecrawl 将整个互联网送达 AI 代理与开发者。",
          "position": 1
        },
        {
          "url": "https://github.com/firecrawl/firecrawl",
          "title": "mendableai/firecrawl：将整站转换为可供 LLM 使用的内容 - GitHub",
          "description": "Firecrawl 是一项 API 服务，接收一个 URL，对其进行爬取，并将其转换为干净的 Markdown 或结构化数据。",
          "position": 2
        },
        ...
      ],
      "images": [
        {
          "title": "快速上手 | Firecrawl",
          "imageUrl": "https://mintlify.s3.us-west-1.amazonaws.com/firecrawl/logo/logo.png",
          "imageWidth": 5814,
          "imageHeight": 1200,
          "url": "https://docs.firecrawl.dev/",
          "position": 1
        },
        ...
      ],
      "news": [
        {
          "title": "Y Combinator 创业公司 Firecrawl 准备出资 100 万美元雇用三名 AI 代理作为员工",
          "url": "https://techcrunch.com/2025/05/17/y-combinator-startup-firecrawl-is-ready-to-pay-1m-to-hire-three-ai-agents-as-employees/",
          "snippet": "目前它在 YC 的招聘板发布了三则"仅限 AI 代理"的新职位，并为此预留了总计 100 万美元的预算。",
          "date": "3 个月前",
          "position": 1
        },
        ...
      ]
    }
  }
  ```
</Accordion>

<div id="scrape">
  ## 抓取
</div>

抓取任意 URL，并以 markdown、HTML 或其他格式获取其内容。请参见 [Scrape 功能文档](/zh/features/scrape) 了解所有选项。

<CodeGroup>
  ```python Python theme={null}
  from firecrawl import Firecrawl

  firecrawl = Firecrawl(api_key="fc-YOUR-API-KEY")

  # 抓取网站：
  doc = firecrawl.scrape("https://firecrawl.dev", formats=["markdown", "html"])
  print(doc)
  ```

  ```js Node theme={null}
  import Firecrawl from '@mendable/firecrawl-js';

  const firecrawl = new Firecrawl({ apiKey: "fc-YOUR-API-KEY" });

  // 抓取网站：
  const doc = await firecrawl.scrape('https://firecrawl.dev', { formats: ['markdown', 'html'] });
  console.log(doc);
  ```

  ```bash cURL theme={null}
  curl -s -X POST "https://api.firecrawl.dev/v2/scrape" \
    -H "Authorization: Bearer $FIRECRAWL_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
      "url": "https://firecrawl.dev",
      "formats": ["markdown", "html"]
    }'
  ```

  ```bash CLI theme={null}
  # Scrape a URL and get markdown
  firecrawl https://firecrawl.dev

  # 使用多种格式(返回 JSON)
  firecrawl https://firecrawl.dev --format markdown,html,links --pretty
  ```
</CodeGroup>

<Accordion title="响应">
  各 SDK 将直接返回数据对象。cURL 将按下方所示原样返回有效载荷。

  ```json theme={null}
  {
    "success": true,
    "data" : {
      "markdown": "Launch Week I 开始了！[查看我们第 2 天的发布 🚀](https://www.firecrawl.dev/blog/launch-week-i-day-2-doubled-rate-limits)[💥 获享 2 个月免费...",
      "html": "<!DOCTYPE html><html lang=\"en\" class=\"light\" style=\"color-scheme: light;\"><body class=\"__variable_36bd41 __variable_d7dc5d font-inter ...",
      "metadata": {
        "title": "首页 - Firecrawl",
        "description": "Firecrawl 可抓取并将任何网站转换为干净的 Markdown。",
        "language": "en",
        "keywords": "Firecrawl,Markdown,Data,Mendable,Langchain",
        "robots": "follow, index",
        "ogTitle": "Firecrawl",
        "ogDescription": "将任意网站转换为可直接用于 LLM 的数据。",
        "ogUrl": "https://www.firecrawl.dev/",
        "ogImage": "https://www.firecrawl.dev/og.png?123",
        "ogLocaleAlternate": [],
        "ogSiteName": "Firecrawl",
        "sourceURL": "https://firecrawl.dev",
        "statusCode": 200,
        "contentType": "text/html"
      }
    }
  }
  ```
</Accordion>

<div id="interact">
  ## 交互
</div>

抓取页面后，继续与其交互——点击按钮、填写表单、提取动态内容，或继续深入导航。你可以用简单的英文描述你的需求，或编写代码以实现完全控制。请参见 [Interact 功能文档](/zh/features/interact) 了解所有选项。

<CodeGroup>
  ```python Python theme={null}
  from firecrawl import Firecrawl

  app = Firecrawl(api_key="fc-YOUR-API-KEY")

  # 1. 抓取 Amazon 首页
  result = app.scrape("https://www.amazon.com", formats=["markdown"])
  scrape_id = result.metadata.scrape_id

  # 2. 交互 — 搜索商品并获取价格
  app.interact(scrape_id, prompt="Search for iPhone 16 Pro Max")
  response = app.interact(scrape_id, prompt="Click on the first result and tell me the price")
  print(response.output)

  # 3. 停止会话
  app.stop_interaction(scrape_id)
  ```

  ```js Node theme={null}
  import Firecrawl from '@mendable/firecrawl-js';

  const app = new Firecrawl({ apiKey: 'fc-YOUR-API-KEY' });

  // 1. 抓取 Amazon 首页
  const result = await app.scrape('https://www.amazon.com', { formats: ['markdown'] });
  const scrapeId = result.metadata?.scrapeId;

  // 2. 交互 — 搜索商品并获取价格
  await app.interact(scrapeId, { prompt: 'Search for iPhone 16 Pro Max' });
  const response = await app.interact(scrapeId, { prompt: 'Click on the first result and tell me the price' });
  console.log(response.output);

  // 3. 停止会话
  await app.stopInteraction(scrapeId);
  ```

  ```bash cURL theme={null}
  # 1. 抓取 Amazon 首页
  RESPONSE=$(curl -s -X POST "https://api.firecrawl.dev/v2/scrape" \
    -H "Authorization: Bearer $FIRECRAWL_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{"url": "https://www.amazon.com", "formats": ["markdown"]}')

  SCRAPE_ID=$(echo $RESPONSE | jq -r '.data.metadata.scrapeId')

  # 2. 交互 — 搜索商品并获取价格
  curl -s -X POST "https://api.firecrawl.dev/v2/scrape/$SCRAPE_ID/interact" \
    -H "Authorization: Bearer $FIRECRAWL_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{"prompt": "Search for iPhone 16 Pro Max"}'

  curl -s -X POST "https://api.firecrawl.dev/v2/scrape/$SCRAPE_ID/interact" \
    -H "Authorization: Bearer $FIRECRAWL_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{"prompt": "Click on the first result and tell me the price"}'

  # 3. 停止会话
  curl -s -X DELETE "https://api.firecrawl.dev/v2/scrape/$SCRAPE_ID/interact" \
    -H "Authorization: Bearer $FIRECRAWL_API_KEY"
  ```

  ```bash CLI theme={null}
  # 1. 抓取 Amazon 首页（scrape ID 自动保存）
  firecrawl scrape https://www.amazon.com

  # 2. 交互 — 搜索商品并获取价格
  firecrawl interact "Search for iPhone 16 Pro Max"
  firecrawl interact "Click on the first result and tell me the price"

  # 3. 停止会话
  firecrawl interact stop
  ```
</CodeGroup>

<Accordion title="响应">
  ```json Response theme={null}
  {
    "success": true,
    "liveViewUrl": "https://liveview.firecrawl.dev/...",
    "interactiveLiveViewUrl": "https://liveview.firecrawl.dev/...",
    "output": "The iPhone 16 Pro Max (256GB) is priced at $1,199.00.",
    "exitCode": 0,
    "killed": false
  }
  ```
</Accordion>

***

<div id="more-capabilities">
  ## 更多功能
</div>

<CardGroup cols={4}>
  <Card title="代理" icon="robot" href="/zh/features/agent">
    由 AI 驱动的自主网页数据采集
  </Card>

  <Card title="浏览器沙箱" icon="browser" href="/zh/features/browser">
    适用于交互式工作流的托管浏览器会话
  </Card>

  <Card title="Map" icon="map" href="/zh/features/map">
    发现网站上的所有 URL
  </Card>

  <Card title="Crawl" icon="spider-web" href="/zh/features/crawl">
    递归采集整个站点的内容
  </Card>
</CardGroup>

***

<div id="resources">
  ## 资源
</div>

<CardGroup cols={2}>
  <Card title="API Reference" icon="code" href="/zh/api-reference/v2-introduction">
    完整的 API 参考文档，包含交互式示例
  </Card>

  <Card title="SDKs" icon="boxes-stacked" href="/zh/sdks/overview">
    Python、Node.js、CLI 以及社区 SDK
  </Card>

  <Card title="Open Source" icon="github" href="/zh/contributing/open-source-or-cloud">
    自行托管 Firecrawl 或为项目做出贡献
  </Card>

  <Card title="Integrations" icon="puzzle-piece" href="/zh/developer-guides/llm-sdks-and-frameworks/openai">
    LangChain、LlamaIndex、OpenAI 等
  </Card>
</CardGroup>
