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

# DeepSeek 網頁抓取 API 參考

> DeepSeek Fetch API 參考與線上除錯：/v1/tools/fetch 端點把任意網頁抓成 Markdown 正文，含引數、響應結構與錯誤碼對照。

> [!NOTE]
>
> 右側 Playground 可直接除錯：在 **Authorization** 填 `Bearer sk-your-api-key`（`default` 或 `svip` 分組的令牌），
> 填入任意網址後傳送即可。只有成功抓到正文才扣費。

> [!TIP]
>
> 定價、實測資料與必須知道的幾件事見 [概覽](/zh-Hant/api-capabilities/deepseek-search-fetch/overview)。

## 引數說明速查

| 引數 | 型別 | 必填 | 說明 |
| - | - | - | - |
| `url` | string | ✓ | HTTP / HTTPS 網址，必須帶域名，最長 8192 個字元，不能帶使用者名稱密碼 |

請求體不需要 `model` 欄位；未識別的欄位會被忽略。

## 響應要點

```json theme={null}
{
  "title": "網頁搜尋與抓取",
  "content": "# 網頁搜尋與抓取\n\n正文已轉成 Markdown……"
}
```

* `content` 是提取後的正文 Markdown，導航欄、廣告等頁面框架大多已去掉
* 網頁沒有標題時 `title` 為空字串
* 實測一篇文件頁約 6400 字、1.6 秒；部分站點較慢，建議客戶端超時設 30 秒以上

## 錯誤碼對照

| HTTP | 錯誤資訊示例 | 原因與處理 | 扣費 |
| - | - | - | - |
| 400 | `'url' must be a valid HTTP or HTTPS URL` | 網址格式不對 | 否 |
| 400 | `missing field 'url'` | 缺 `url` | 否 |
| 401 | `Invalid token.` | API Key 無效或未帶 `Authorization` 頭 | 否 |
| 404 | `failed to fetch URL` | 抓不到可用內容：目標頁 404、域名不存在、內網地址、目標站拒絕訪問、型別不支援等。換一個網址 | 否 |
| 429 | — | 超出上游限流（25 QPS，同一目標域名另有限制），等待後重試 | 否 |
| 503 | `no available channels for model deepseek-fetch` | 令牌所在分組沒有開通本介面（如 ClaudeCode 分組），換 `default` / `svip` 令牌 | 否 |
| 5xx / 504 | — | 上游內部錯誤或抓取超時，稍後重試 | 否 |

> [!WARNING]
>
> **「軟 404」照常扣費**：有些網站對不存在的頁面不返回 404，而是返回首頁或提示頁，
> Fetch 會把它當成功抓取。呼叫前請自行確認網址有效。

錯誤體的 `type` 統一為 `shell_api_error`，請以 HTTP 狀態碼判斷錯誤種類。


## OpenAPI

````yaml api-reference/deepseek-fetch-openapi.yaml POST /v1/tools/fetch
openapi: 3.1.0
info:
  title: DeepSeek 网页抓取 API
  description: |
    `deepseek-fetch` —— DeepSeek 原生网页抓取接口，把任意网页抓成 Markdown 正文。

    - 不是对话模型，不消耗 token，**按成功请求次数计费**
    - 抓取失败（404）、参数错误（400）不扣费
    - 上游限流 25 QPS，同一目标域名另有限制
    - `default` / `svip` 分组可用，ClaudeCode 分组令牌不可用

    **认证方式**：请求头 `Authorization: Bearer YOUR_API_KEY`

    **获取 API Key**：访问 API易控制台 `api.apiyi.com/token` 创建令牌
  version: 1.0.0
servers:
  - url: https://api.apiyi.com
    description: 主要端点
security:
  - bearerAuth: []
paths:
  /v1/tools/fetch:
    post:
      tags:
        - 搜索与抓取
      summary: 网页抓取：deepseek-fetch
      description: |
        传入一个网址，返回网页标题和 Markdown 正文。请求体不需要 `model` 字段。
      operationId: deepseekToolsFetch
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/FetchRequest'
            example:
              url: https://docs.apiyi.com/
      responses:
        '200':
          description: 抓取成功（计费一次）
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/FetchResponse'
              example:
                title: API易 文档中心
                content: |-
                  # API易 文档中心

                  正文已转成 Markdown……
        '400':
          description: 参数错误，不扣费：网址格式不对或缺少 url
        '401':
          description: API Key 无效
        '404':
          description: 抓不到可用内容，不扣费：目标页 404、域名不存在、内网地址、目标站拒绝访问等。错误信息为 failed to fetch URL
        '429':
          description: 超出上游限流（25 QPS），等待后重试
        '503':
          description: 令牌所在分组没有开通本接口（如 ClaudeCode 分组），请换 default / svip 分组令牌
      security:
        - bearerAuth: []
components:
  schemas:
    FetchRequest:
      type: object
      required:
        - url
      properties:
        url:
          type: string
          description: HTTP / HTTPS 网址，必须带域名，最长 8192 个字符，不能带用户名密码
          example: https://docs.apiyi.com/
    FetchResponse:
      type: object
      properties:
        title:
          type: string
          description: 网页标题，没有时为空字符串
        content:
          type: string
          description: 提取后的正文，Markdown 格式
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: '在请求头中添加 Authorization: Bearer YOUR_API_KEY'

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.