suggest
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseSuggest / Autocomplete
建议/自动补全
Requires API Key: Get one at https://api.search.brave.comPlan: Included in the Suggest plan. See https://api-dashboard.search.brave.com/app/subscriptions/subscribe
需要API Key: 前往https://api.search.brave.com获取套餐: 包含在Suggest套餐中。查看https://api-dashboard.search.brave.com/app/subscriptions/subscribe
Quick Start (cURL)
快速开始(cURL)
Basic Suggestions
基础建议
bash
curl -s "https://api.search.brave.com/res/v1/suggest/search?q=how+to+" \
-H "Accept: application/json" \
-H "X-Subscription-Token: ${BRAVE_SEARCH_API_KEY}"bash
curl -s "https://api.search.brave.com/res/v1/suggest/search?q=how+to+" \
-H "Accept: application/json" \
-H "X-Subscription-Token: ${BRAVE_SEARCH_API_KEY}"With All Parameters
包含所有参数
bash
curl -s "https://api.search.brave.com/res/v1/suggest/search" \
-H "Accept: application/json" \
-H "X-Subscription-Token: ${BRAVE_SEARCH_API_KEY}" \
-G \
--data-urlencode "q=albert" \
--data-urlencode "country=US" \
--data-urlencode "lang=en" \
--data-urlencode "count=10" \
--data-urlencode "rich=true"bash
curl -s "https://api.search.brave.com/res/v1/suggest/search" \
-H "Accept: application/json" \
-H "X-Subscription-Token: ${BRAVE_SEARCH_API_KEY}" \
-G \
--data-urlencode "q=albert" \
--data-urlencode "country=US" \
--data-urlencode "lang=en" \
--data-urlencode "count=10" \
--data-urlencode "rich=true"Endpoint
接口地址
http
GET https://api.search.brave.com/res/v1/suggest/searchAuthentication: header
X-Subscription-Token: <API_KEY>Optional Headers:
- — Enable response compression
Accept-Encoding: gzip
http
GET https://api.search.brave.com/res/v1/suggest/search身份验证: 请求头
X-Subscription-Token: <API_KEY>可选请求头:
- — 启用响应压缩
Accept-Encoding: gzip
Parameters
参数
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| string | Yes | — | Suggest search query (1-400 chars, max 50 words) |
| string | No | | Language preference (2+ char language code, e.g. |
| string | No | | Search country (2-letter country code or |
| int | No | | Number of suggestions (1-20). Actual results may be fewer |
| bool | No | | Enhance with entity info (title, description, image). Paid Search plan required |
| 参数 | 类型 | 是否必填 | 默认值 | 描述 |
|---|---|---|---|---|
| 字符串 | 是 | — | 建议搜索查询词(1-400字符,最多50个单词) |
| 字符串 | 否 | | 语言偏好(2个及以上字符的语言代码,例如 |
| 字符串 | 否 | | 搜索国家(2字母国家代码或 |
| 整数 | 否 | | 建议结果数量(1-20)。实际返回结果可能更少 |
| 布尔值 | 否 | | 附带实体信息(标题、描述、图片)。需要付费Search套餐 |
Response Fields
响应字段
| Field | Type | Description |
|---|---|---|
| string | Always |
| string | The original suggest search query |
| array | List of suggestions (may be empty) |
| string | Suggested query completion |
| bool? | Whether the suggested enriched query is an entity (rich only) |
| string? | The suggested query enriched title (rich only) |
| string? | The suggested query enriched description (rich only) |
| string? | The suggested query enriched image URL (rich only) |
Fields with values are excluded from the response. Non-rich results contain only the field.
nullquery| 字段 | 类型 | 描述 |
|---|---|---|
| 字符串 | 固定为 |
| 字符串 | 原始的建议搜索查询词 |
| 数组 | 建议结果列表(可能为空) |
| 字符串 | 建议的查询词补全结果 |
| 布尔值(可选) | 该增强建议查询词是否为实体(仅rich模式下返回) |
| 字符串(可选) | 增强建议查询词的标题(仅rich模式下返回) |
| 字符串(可选) | 增强建议查询词的描述(仅rich模式下返回) |
| 字符串(可选) | 增强建议查询词的图片URL(仅rich模式下返回) |
值为的字段不会包含在响应中。非rich模式的结果仅包含字段。
nullqueryRich Response Example (rich=true
)
rich=trueRich模式响应示例(rich=true
)
rich=truejson
{
"type": "suggest",
"query": { "original": "albert" },
"results": [
{
"query": "albert einstein",
"is_entity": true,
"title": "Albert Einstein",
"description": "German-born theoretical physicist",
"img": "https://imgs.search.brave.com/..."
},
{ "query": "albert einstein quotes", "is_entity": false }
]
}json
{
"type": "suggest",
"query": { "original": "albert" },
"results": [
{
"query": "albert einstein",
"is_entity": true,
"title": "Albert Einstein",
"description": "German-born theoretical physicist",
"img": "https://imgs.search.brave.com/..."
},
{ "query": "albert einstein quotes", "is_entity": false }
]
}Use Cases
使用场景
- Search-as-you-type UI: Real-time autocomplete dropdown. Debounce 150-300ms.
- Query refinement for RAG: Expand partial/ambiguous queries before calling or
web-search.llm-context - Entity detection: Use to detect entities with title, description, and image for preview cards.
rich=true - Typo-tolerant input: Get clean suggestions from misspelled input without separate spellcheck.
- 随输随搜UI: 实时自动补全下拉框。设置150-300毫秒的防抖。
- RAG的查询优化: 在调用或
web-search之前,扩展部分/模糊查询词。llm-context - 实体检测: 使用检测实体并获取标题、描述和图片,用于预览卡片。
rich=true - 拼写容错输入: 从拼写错误的输入中获取清晰的建议,无需单独的拼写检查。
Notes
注意事项
- Latency: Designed for <100ms response times
- Country/lang: Hints for suggestion relevance, not strict filters
- Typo handling: Suggestions handle common typos without separate spellcheck
- 延迟: 设计目标为响应时间<100毫秒
- 国家/语言: 用于提示建议相关性,而非严格过滤
- 拼写处理: 建议功能可处理常见拼写错误,无需单独的拼写检查