# Doubao Search (Custom)

> Common

Submit a Doubao Search (Custom) request. `model` is fixed to `doubao-web-search-custom`;
all other fields are Doubao native parameters (PascalCase), forwarded as-is.

## Endpoint

`POST https://api.modelverse.cn/v1/web_search`

## Request Body

## Responses

- **200** — Doubao Custom native response. Success requires HTTP 200 and an empty `ResponseMetadata.Error.Code`.
- **default** — Error response (gateway-side parameter/auth error or upstream non-200).

## OpenAPI Definition

```json
{
  "openapi": "3.1.0",
  "x-language": "en-US",
  "info": {
    "title": "ModelVerse Doubao Search (Custom) API",
    "version": "1.0.0",
    "description": "Self-contained OpenAPI 3.1 schema for the ModelVerse **Doubao Search (Custom)** web search model.\nUnified endpoint `POST /v1/web_search`; the `model` field in the body selects the provider\n(stripped before forwarding). All other fields are Doubao Search native parameters (PascalCase),\nforwarded and returned as-is without normalization. The response is non-streaming.\nBilling: each successful call counts as 1; HTTP 200 with a non-empty `ResponseMetadata.Error.Code`\nis a business failure and is not billed.\n"
  },
  "servers": [
    {
      "url": "https://api.modelverse.cn",
      "description": "ModelVerse API endpoint."
    }
  ],
  "tags": [
    {
      "name": "Web Search",
      "description": "Doubao Search (Custom) web search."
    }
  ],
  "security": [
    {
      "bearerAuth": []
    }
  ],
  "paths": {
    "/v1/web_search": {
      "post": {
        "tags": [
          "Web Search"
        ],
        "operationId": "createDoubaoWebSearchCustom",
        "summary": "Doubao Search (Custom)",
        "description": "Submit a Doubao Search (Custom) request. `model` is fixed to `doubao-web-search-custom`;\nall other fields are Doubao native parameters (PascalCase), forwarded as-is.\n",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DoubaoCustomRequest"
              },
              "examples": {
                "webSearch": {
                  "summary": "Web search with query rewriting enabled",
                  "value": {
                    "model": "doubao-web-search-custom",
                    "Query": "latest Beijing travel guide",
                    "SearchType": "web",
                    "Count": 10,
                    "Filter": {
                      "NeedContent": false,
                      "NeedUrl": true,
                      "TimeRange": "OneYear"
                    },
                    "QueryControl": {
                      "QueryRewrite": true
                    },
                    "ContentFormats": "markdown"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Doubao Custom native response. Success requires HTTP 200 and an empty `ResponseMetadata.Error.Code`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DoubaoCustomResponse"
                },
                "examples": {
                  "success": {
                    "summary": "Success response (excerpt)",
                    "value": {
                      "ResponseMetadata": {
                        "RequestId": "...",
                        "Error": {
                          "Code": "",
                          "Message": ""
                        }
                      },
                      "Result": {
                        "ResultCount": 10,
                        "WebResults": [
                          {
                            "Title": "...",
                            "Url": "https://...",
                            "Snippet": "...",
                            "Content": "...",
                            "Position": 1
                          }
                        ],
                        "ImageResults": [],
                        "SearchContext": {
                          "OriginQuery": "latest Beijing travel guide",
                          "SearchType": "web"
                        },
                        "TimeCost": 123,
                        "LogId": "..."
                      }
                    }
                  }
                }
              }
            }
          },
          "default": {
            "description": "Error response (gateway-side parameter/auth error or upstream non-200).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WebSearchErrorResponse"
                },
                "examples": {
                  "error": {
                    "$ref": "#/components/examples/WebSearchError"
                  }
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "bearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "API key",
        "description": "Platform API Key, passed via `Authorization: Bearer <API Key>`."
      }
    },
    "schemas": {
      "DoubaoCustomRequest": {
        "type": "object",
        "additionalProperties": true,
        "required": [
          "model",
          "Query",
          "SearchType"
        ],
        "properties": {
          "model": {
            "type": "string",
            "const": "doubao-web-search-custom",
            "description": "Routing identifier, fixed to `doubao-web-search-custom`; stripped before forwarding."
          },
          "Query": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100,
            "description": "Search query, 1–100 characters."
          },
          "SearchType": {
            "type": "string",
            "enum": [
              "web",
              "image"
            ],
            "description": "Search type."
          },
          "Count": {
            "type": "integer",
            "description": "Number of results; web ≤ 50 / image ≤ 5, default 10."
          },
          "Filter": {
            "$ref": "#/components/schemas/DoubaoCustomFilter"
          },
          "QueryControl": {
            "$ref": "#/components/schemas/DoubaoCustomQueryControl"
          },
          "ContentFormats": {
            "type": "string",
            "enum": [
              "text",
              "markdown"
            ],
            "description": "Content format."
          },
          "Industry": {
            "type": "string",
            "enum": [
              "finance",
              "game",
              "health",
              "gov"
            ],
            "description": "Vertical industry search."
          }
        }
      },
      "DoubaoCustomFilter": {
        "type": "object",
        "additionalProperties": true,
        "properties": {
          "NeedContent": {
            "type": "boolean",
            "description": "Whether to return the web page body."
          },
          "NeedUrl": {
            "type": "boolean",
            "description": "Whether to return the result URL."
          },
          "Sites": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Site allowlist."
          },
          "BlockHosts": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Site blocklist."
          },
          "TimeRange": {
            "type": "string",
            "description": "Time range: `OneDay` / `OneWeek` / `OneMonth` / `OneYear`, or a date range."
          }
        }
      },
      "DoubaoCustomQueryControl": {
        "type": "object",
        "additionalProperties": true,
        "properties": {
          "QueryRewrite": {
            "type": "boolean",
            "description": "Whether to enable LLM rewriting of the query to improve recall."
          }
        }
      },
      "DoubaoCustomResponse": {
        "type": "object",
        "additionalProperties": true,
        "properties": {
          "ResponseMetadata": {
            "$ref": "#/components/schemas/DoubaoResponseMetadata"
          },
          "Result": {
            "$ref": "#/components/schemas/DoubaoCustomResult"
          }
        }
      },
      "DoubaoResponseMetadata": {
        "type": "object",
        "additionalProperties": true,
        "properties": {
          "RequestId": {
            "type": "string",
            "description": "Unique request identifier."
          },
          "Error": {
            "$ref": "#/components/schemas/DoubaoError"
          }
        }
      },
      "DoubaoError": {
        "type": "object",
        "additionalProperties": true,
        "properties": {
          "Code": {
            "type": "string",
            "description": "Business error code; empty string on success."
          },
          "Message": {
            "type": "string",
            "description": "Business error message; empty string on success."
          }
        }
      },
      "DoubaoCustomResult": {
        "type": "object",
        "additionalProperties": true,
        "properties": {
          "ResultCount": {
            "type": "integer",
            "description": "Number of returned results."
          },
          "WebResults": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/DoubaoWebItem"
            },
            "description": "Web result list (returned when SearchType=web)."
          },
          "ImageResults": {
            "type": "array",
            "items": {
              "type": "object",
              "additionalProperties": true
            },
            "description": "Image result list (returned when SearchType=image)."
          },
          "SearchContext": {
            "type": "object",
            "additionalProperties": true,
            "description": "Search context, includes OriginQuery, SearchType."
          },
          "TimeCost": {
            "type": "integer",
            "description": "Upstream latency (milliseconds)."
          },
          "LogId": {
            "type": "string",
            "description": "Upstream log ID."
          }
        }
      },
      "DoubaoWebItem": {
        "type": "object",
        "additionalProperties": true,
        "properties": {
          "Title": {
            "type": "string",
            "description": "Web page title."
          },
          "Url": {
            "type": "string",
            "format": "uri",
            "description": "Web page URL."
          },
          "Snippet": {
            "type": "string",
            "description": "Snippet excerpt."
          },
          "Content": {
            "type": "string",
            "description": "Web page body (returned when Filter.NeedContent=true)."
          },
          "Position": {
            "type": "integer",
            "description": "Result ranking position."
          }
        }
      },
      "WebSearchErrorResponse": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "error"
        ],
        "properties": {
          "error": {
            "$ref": "#/components/schemas/WebSearchError"
          }
        }
      },
      "WebSearchError": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "message",
          "type",
          "code",
          "param"
        ],
        "properties": {
          "message": {
            "type": "string",
            "description": "Error description."
          },
          "type": {
            "type": "string",
            "description": "Error type.",
            "examples": [
              "invalid_request_error"
            ]
          },
          "code": {
            "type": "string",
            "description": "Machine-readable error code.",
            "examples": [
              "error_code"
            ]
          },
          "param": {
            "type": "string",
            "description": "Request ID, for feedback or troubleshooting."
          }
        }
      }
    },
    "examples": {
      "WebSearchError": {
        "summary": "Standard JSON error response",
        "value": {
          "error": {
            "message": "error description",
            "type": "invalid_request_error",
            "code": "error_code",
            "param": "<request ID, for feedback or troubleshooting>"
          }
        }
      }
    }
  }
}
```
