> ## Documentation Index
> Fetch the complete documentation index at: https://firecrawl-abimaelmartell-agent-default-model.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# 快速上手

> Firecrawl 可将整站内容转换为适配 LLM 的 Markdown

<div id="scrape-your-first-website">
  ## 抓取你的第一个网站
</div>

只需一次 API 调用，就能将任意网站转换为干净、适配 LLM 的数据。

<CardGroup cols={2}>
  <Card title="获取你的 API 密钥" icon="key" href="https://www.firecrawl.dev/app/api-keys">
    注册并获取你的 API 密钥，开始抓取
  </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 后请重启代理。完整的配置流程请参见 [Skill + CLI](/zh/sdks/cli)。
</Note>

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

<div id="make-your-first-request">
  ### 发出你的第一个请求
</div>

复制下方的代码，将 `fc-YOUR-API-KEY` 替换为你的 API 密钥，然后运行：

<CodeGroup>
  ```bash cURL theme={null}
  curl -X POST 'https://api.firecrawl.dev/v2/scrape' \
    -H 'Authorization: Bearer fc-YOUR-API-KEY' \
    -H 'Content-Type: application/json' \
    -d '{"url": "https://example.com"}'
  ```

  ```python Python theme={null}
  # pip install firecrawl-py
  from firecrawl import Firecrawl

  app = Firecrawl(api_key="fc-YOUR-API-KEY")
  result = app.scrape("https://example.com")
  print(result)
  ```

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

  const app = new Firecrawl({ apiKey: "fc-YOUR-API-KEY" });
  const result = await app.scrape("https://example.com");
  console.log(result);
  ```

  ```bash CLI theme={null}
  firecrawl https://example.com
  ```
</CodeGroup>

<Accordion title="示例响应">
  ```json theme={null}
  {
    "success": true,
    "data": {
      "markdown": "# Example Domain\n\nThis domain is for use in illustrative examples...",
      "metadata": {
        "title": "Example Domain",
        "sourceURL": "https://example.com"
      }
    }
  }
  ```
</Accordion>

***

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

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

  <Card title="搜索" icon="magnifying-glass" href="#search">
    搜索全网并获取搜索结果的完整页面内容
  </Card>

  <Card title="智能体" icon="robot" href="#agent">
    由 AI 驱动的自动化 Web 数据采集
  </Card>

  <Card title="浏览器" icon="browser" href="#browser">
    为交互式 Web 工作流提供安全的沙箱浏览器会话
  </Card>
</CardGroup>

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

* **适用于 LLM 的输出**：获取干净的 markdown、结构化 JSON、截图等多种格式
* **处理好繁琐细节**：代理、反机器人/反爬机制、JavaScript 渲染和动态内容
* **可靠**：为生产环境打造，高可用且结果稳定一致
* **快速**：数秒内返回结果，并针对高吞吐场景进行了优化
* **浏览器沙箱**：为智能体提供全托管浏览器环境，零配置，可按任意规模扩展
* **MCP Server**：通过 [Model Context Protocol](/zh/mcp-server) 将 Firecrawl 连接到任意 AI 工具

***

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

抓取任意 URL，并以 markdown、HTML 或其他 formats 形式获取其内容。所有选项请参阅 [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
      }
    }
  }
  ```
</Accordion>

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

Firecrawl 的搜索 API 支持你进行网页搜索，并可在一次操作中可选地抓取搜索结果。

* 选择特定输出格式 (Markdown、HTML、链接、截图)
* 选择特定来源 (网页、新闻、图片)
* 通过可自定义参数 (如位置等) 进行网页搜索

详见[Search Endpoint API Reference](/zh/api-reference/endpoint/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 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="agent">
  ## 智能体
</div>

Firecrawl 的智能体是一个自动化的网页数据采集工具。你只需描述你需要的数据，它就会在整个网络中进行搜索、导航，并从中提取这些数据。请查看 [Agent 功能文档](/zh/features/agent) 以了解所有选项。

<CodeGroup>
  ```bash cURL theme={null}
  curl -X POST 'https://api.firecrawl.dev/v2/agent' \
    -H 'Authorization: Bearer fc-YOUR-API-KEY' \
    -H 'Content-Type: application/json' \
    -d '{
      "prompt": "Find the pricing plans for Notion"
    }'
  ```

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

  app = Firecrawl(api_key="fc-YOUR-API-KEY")
  result = app.agent("Find the pricing plans for Notion")
  print(result)
  ```

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

  const app = new Firecrawl({ apiKey: "fc-YOUR-API-KEY" });
  const result = await app.agent("Find the pricing plans for Notion");
  console.log(result);
  ```
</CodeGroup>

<Accordion title="示例响应">
  ```json theme={null}
  {
    "success": true,
    "data": {
      "result": "Notion offers the following pricing plans:\n\n1. **Free** - $0/month - For individuals...\n2. **Plus** - $10/seat/month - For small teams...\n3. **Business** - $18/seat/month - For companies...\n4. **Enterprise** - Custom pricing - For large organizations...",
      "sources": [
        "https://www.notion.so/pricing"
      ]
    }
  }
  ```
</Accordion>

<div id="browser">
  ## 浏览器
</div>

Firecrawl 浏览器沙箱为您的智能体提供安全的浏览器环境，以便与 Web 交互。可填写表单、点击按钮、进行身份验证等。无需本地配置或安装 Chromium。完整文档请参阅 [Browser 功能文档](/zh/features/browser)。

<CodeGroup>
  ```bash cURL theme={null}
  # 1. 启动会话
  curl -X POST "https://api.firecrawl.dev/v2/browser" \
    -H "Authorization: Bearer $FIRECRAWL_API_KEY" \
    -H "Content-Type: application/json"

  # 2. 执行代码
  curl -X POST "https://api.firecrawl.dev/v2/browser/YOUR_SESSION_ID/execute" \
    -H "Authorization: Bearer $FIRECRAWL_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
      "code": "await page.goto(\"https://news.ycombinator.com\")\ntitle = await page.title()\nprint(title)"
    }'

  # 3. 关闭会话
  curl -X DELETE "https://api.firecrawl.dev/v2/browser/YOUR_SESSION_ID" \
    -H "Authorization: Bearer $FIRECRAWL_API_KEY"
  ```

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

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

  // 1. 启动会话
  const session = await firecrawl.browser();
  console.log(session.cdpUrl); // wss://cdp-proxy.firecrawl.dev/cdp/...

  // 2. Execute code
  const result = await firecrawl.browserExecute(session.id, {
    code: `
      await page.goto("https://news.ycombinator.com");
      const title = await page.title();
      console.log(title);
    `,
    language: "node",
  });
  console.log(result.result); // "Hacker News"

  // 3. Close
  await firecrawl.deleteBrowser(session.id);
  ```

  ```python Python theme={null}
  # pip install firecrawl
  from firecrawl import Firecrawl

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

  # 1. 启动会话
  session = app.browser()
  print(session.cdp_url)  # wss://cdp-proxy.firecrawl.dev/cdp/...

  # 2. Execute code
  result = app.browser_execute(
      session.id,
      code='await page.goto("https://news.ycombinator.com")\ntitle = await page.title()\nprint(title)',
      language="python",
  )
  print(result.result)  # "Hacker News"

  # 3. Close
  app.delete_browser(session.id)
  ```

  ```bash CLI theme={null}
  # Install the Firecrawl CLI
  npm install -g firecrawl-cli

  # 简写方式 - 自动启动会话,无需 "execute"
  firecrawl browser "open https://news.ycombinator.com"
  firecrawl browser "snapshot"
  firecrawl browser "scrape"

  # Close when done
  firecrawl browser close
  ```
</CodeGroup>

<Accordion title="示例响应">
  ```json theme={null}
  {
    "success": true,
    "id": "550e8400-e29b-41d4-a716-446655440000",
    "cdpUrl": "wss://cdp-proxy.firecrawl.dev/cdp/550e8400-...",
    "liveViewUrl": "https://liveview.firecrawl.dev/550e8400-...",
    "interactiveLiveViewUrl": "https://liveview.firecrawl.dev/550e8400-...?interactive=true"
  }
  ```
</Accordion>

***

<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>
