> ## 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 Web 検索 API リファレンス

> DeepSeek 検索 API のリファレンスとプレイグラウンド：/v1/tools/search パラメータ、検索演算子、レスポンス構造、エラーコード。

> [!NOTE]
>
> 右側のPlaygroundでお試しいただけます：**Authorization** に `Bearer sk-your-api-key`（`default` または `svip` グループのキー）を入力してください。
> デフォルトのサンプルが入力されています。送信をクリックして結果をご確認ください。呼び出しが成功するごとに1回課金されます。
> `localization` には**ユーザーのIPアドレス**（例: `8.8.8.8`）を指定します。`en-US` などのロケールコードを指定すると400が返されます。

> [!TIP]
>
> 料金、テストデータ、および注意事項については[概要](/ja/api-capabilities/deepseek-search-fetch/overview)に記載されています。

## パラメーターリファレンス

| パラメーター | 型 | 必須 | 説明 |
| - | - | - | - |
| `query` | string | ✓ | 1〜128文字、空白文字のみは不可。`site:`、`-site:`、`"..."`、`lang:`、`after:`、`before:`などの演算子をサポートします |
| `count` | int | | 1〜50、デフォルトは10。価格には影響しません |
| `need_content` | bool | | デフォルトは`false`。`true`の場合、各結果にページ本文が含まれます |
| `ori_question` | string | | ユーザーの元の質問、1〜128文字 |
| `localization` | string | | **ユーザーのIPアドレス**（ロケールコードではありません）。地域に応じたランキングに使用されます |

リクエストボディに`model`フィールドを含める必要はありません。不明なフィールドは無視されます。

## レスポンスのハイライト

```json theme={null}
{
  "results": [
    {
      "title": "...",
      "url": "https://...",
      "snippet": "short summary, about 100–200 characters",
      "summary": "long summary, about 600–800 characters",
      "content": "",
      "rerank_score": 2.1,
      "authority": 3,
      "date": "2026-10-20T08:00:00Z",
      "site_name": "...",
      "site_icon": "https://..."
    }
  ]
}
```

* モデルには`summary`を渡し、人には`snippet`を表示します。全文が必要な場合は、`need_content`を有効にするか、いくつかの結果を選択して[Fetch](/ja/api-capabilities/deepseek-search-fetch/fetch-api)を使用してください。
* `rerank_score` ≥ 1.5 および `authority` ≥ 3 は高品質な結果を示しており、フィルターのしきい値として適しています。
* `count=50`を指定した場合、レスポンスは約180 KBとなり、`need_content`ではその2倍以上になります。それに応じてクライアントのタイムアウトを設定してください。

## エラーコード

| HTTP | メッセージ例 | 原因と対処法 | 課金 |
| - | - | - | - |
| 400 | `'count' must be between 1 and 50` | `count`が範囲外です | なし |
| 400 | `'query' must not be empty` / `missing field 'query'` | `query`が未指定または空です | なし |
| 400 | `'localization' must be a valid IP address` | ロケールコードが渡されました。IPを送信するか、フィールドを削除してください | なし |
| 401 | `Invalid token.` | 無効なAPIキー、または`Authorization`ヘッダーが不足しています | なし |
| 429 | — | アップストリームのレート制限（100 QPS）を超過しました。待機してから再試行してください | なし |
| 503 | `no available channels for model deepseek-search` | キーのグループにこのAPIがありません（例: ClaudeCode）。`default` / `svip`キーを使用してください | なし |
| 5xx / 504 | — | アップストリームの内部エラーまたはタイムアウトです。後ほど再試行してください | なし |

エラー本文の`type`は常に`shell_api_error`です。HTTPステータスコードで分岐処理を行ってください。


## OpenAPI

````yaml api-reference/deepseek-search-openapi-en.yaml POST /v1/tools/search
openapi: 3.1.0
info:
  title: DeepSeek Web Search API
  description: >
    `deepseek-search` — DeepSeek's native web search API. Returns structured
    search results for a query, built for agents and RAG.


    - Not a chat model and consumes no tokens: **billed per successful
    request**; `count` and `need_content` do not affect the price

    - Parameter errors such as 400 are not billed

    - Upstream rate limit: 100 QPS

    - Available in the `default` / `svip` groups; ClaudeCode group keys cannot
    call it


    **Authentication**: header `Authorization: Bearer YOUR_API_KEY`


    **Get an API key**: create one in the APIYI console at `api.apiyi.com/token`
  version: 1.0.0
servers:
  - url: https://api.apiyi.com
    description: Primary endpoint
security:
  - bearerAuth: []
paths:
  /v1/tools/search:
    post:
      tags:
        - Search & Fetch
      summary: 'Web search: deepseek-search'
      description: >
        Send a query, get 1–50 web search results. The request body does not
        need a `model` field.


        `query` supports search operators: `site:` (join several with `OR`),
        `-site:`, `"..."`, `-"..."`, `-keyword`, `lang:zh,en`, `after:`,
        `before:`.
      operationId: deepseekToolsSearch
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SearchRequest'
            example:
              query: DeepSeek V4 release
              count: 5
      responses:
        '200':
          description: Search succeeded (billed once)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SearchResponse'
              example:
                results:
                  - title: DeepSeek V4 released
                    url: https://example.com/news/deepseek-v4
                    snippet: A short snippet of about 100–200 characters...
                    summary: A long summary of about 600–800 characters...
                    content: ''
                    rerank_score: 2.1
                    authority: 3
                    date: '2026-10-20T08:00:00Z'
                    site_name: Example News
                    site_icon: https://example.com/favicon.ico
        '400':
          description: >-
            Invalid parameters, not billed: `count` outside 1–50, empty or
            missing `query`, `localization` not an IP address, etc.
        '401':
          description: Invalid API key
        '429':
          description: Upstream rate limit exceeded (100 QPS); wait and retry
        '503':
          description: >-
            This API is not enabled for the key's group (e.g. ClaudeCode); use a
            default / svip group key
      security:
        - bearerAuth: []
components:
  schemas:
    SearchRequest:
      type: object
      required:
        - query
      properties:
        query:
          type: string
          description: >-
            Search query, 1–128 characters, not all whitespace. Supports site: /
            lang: / after: and other operators
          example: DeepSeek V4 release
        count:
          type: integer
          minimum: 1
          maximum: 50
          default: 10
          description: Number of results, 1–50. Does not affect the price
          example: 5
        need_content:
          type: boolean
          default: false
          description: >-
            Whether to return the page body. When false, content is always an
            empty string
        ori_question:
          type: string
          description: >-
            The user's original question that triggered this search, 1–128
            characters
        localization:
          type: string
          description: >-
            The user's IP address, used to prioritize localized results. **Not a
            locale code**: passing ja-JP returns 400
          example: 8.8.8.8
    SearchResponse:
      type: object
      properties:
        results:
          type: array
          items:
            type: object
            properties:
              title:
                type: string
              url:
                type: string
              snippet:
                type: string
                description: Short snippet, about 100–200 characters, for display
              summary:
                type: string
                description: Long summary, about 600–800 characters, for models
              content:
                type: string
                description: Page body; empty string when need_content is false
              rerank_score:
                type: number
                description: Relevance score 0–3; 1.5 or higher is high quality
              authority:
                type: integer
                description: >-
                  Site authority 0–4, -1 = unknown; 3 or higher is highly
                  authoritative
              date:
                type:
                  - string
                  - 'null'
                description: Publication time, UTC RFC 3339
              site_name:
                type:
                  - string
                  - 'null'
              site_icon:
                type:
                  - string
                  - 'null'
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: 'Add Authorization: Bearer YOUR_API_KEY to the request headers'

````

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