> ## 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 Search API Reference

> DeepSeek Search API reference and playground: /v1/tools/search parameters, search operators, response structure and error codes.

> [!NOTE]
>
> Try it in the Playground on the right: put `Bearer sk-your-api-key` (a key in the `default` or `svip` group) in **Authorization**.
> The default example is filled in; click send to see results. Each successful call is billed once.
> `localization` takes **the user's IP address** (e.g. `8.8.8.8`); a locale code such as `en-US` returns 400.

> [!TIP]
>
> Pricing, test data and the things you need to know are in the [Overview](/en/api-capabilities/deepseek-search-fetch/overview).

## Parameter reference

| Parameter | Type | Required | Description |
| - | - | - | - |
| `query` | string | ✓ | 1–128 characters, not all whitespace. Supports `site:`, `-site:`, `"..."`, `lang:`, `after:`, `before:` and other operators |
| `count` | int | | 1–50, default 10. Does not affect the price |
| `need_content` | bool | | Default `false`; when `true` each result includes the page body |
| `ori_question` | string | | The user's original question, 1–128 characters |
| `localization` | string | | **The user's IP address** (not a locale code), used for localized ranking |

The request body does not need a `model` field; unknown fields are ignored.

## Response highlights

```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://..."
    }
  ]
}
```

* Give `summary` to models and show `snippet` to people. For full text, either turn on `need_content` or pick a few results and use [Fetch](/en/api-capabilities/deepseek-search-fetch/fetch-api)
* `rerank_score` ≥ 1.5 and `authority` ≥ 3 mark high-quality results and make good filter thresholds
* With `count=50` the response is about 180 KB, and `need_content` more than doubles it; set your client timeout accordingly

## Error codes

| HTTP | Example message | Cause and fix | Billed |
| - | - | - | - |
| 400 | `'count' must be between 1 and 50` | `count` out of range | No |
| 400 | `'query' must not be empty` / `missing field 'query'` | `query` missing or empty | No |
| 400 | `'localization' must be a valid IP address` | A locale code was passed; send an IP or drop the field | No |
| 401 | `Invalid token.` | Invalid API key or missing `Authorization` header | No |
| 429 | — | Upstream rate limit (100 QPS) exceeded; wait and retry | No |
| 503 | `no available channels for model deepseek-search` | The key's group does not have this API (e.g. ClaudeCode); use a `default` / `svip` key | No |
| 5xx / 504 | — | Upstream internal error or timeout; retry later | No |

The `type` in the error body is always `shell_api_error`; branch on the HTTP status code.


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