Web Search
Requires API Key: Get one at https://api.search.brave.com
Plan: Included in the Search plan. See https://api-dashboard.search.brave.com/app/subscriptions/subscribe
Quick Start (cURL)
Basic Search
curl -s "https://api.search.brave.com/res/v1/web/search?q=python+web+frameworks" \
-H "Accept: application/json" \
-H "X-Subscription-Token: ${BRAVE_SEARCH_API_KEY}"
With Parameters
curl -s "https://api.search.brave.com/res/v1/web/search" \
-H "Accept: application/json" \
-H "X-Subscription-Token: ${BRAVE_SEARCH_API_KEY}" \
-G \
--data-urlencode "q=rust programming tutorials" \
--data-urlencode "country=US" \
--data-urlencode "search_lang=en" \
--data-urlencode "count=10" \
--data-urlencode "safesearch=moderate" \
--data-urlencode "freshness=pm"
Endpoint
GET https://api.search.brave.com/res/v1/web/search
POST https://api.search.brave.com/res/v1/web/search
Note: Both GET and POST methods are supported. POST is useful for long queries or complex Goggles.
Authentication: X-Subscription-Token: <API_KEY> header
Optional Headers:
Accept-Encoding: gzip — Enable gzip compression
When to Use Web Search
| Feature |
Web Search (this) |
LLM Context (llm-context) |
Answers (answers) |
| Output |
Structured results (links, snippets, metadata) |
Pre-extracted page content for LLMs |
End-to-end AI answers with citations |
| Result types |
Web, news, videos, discussions, FAQ, infobox, locations, rich |
Extracted text chunks, tables, code |
Synthesized answer + source list |
| Unique features |
Goggles, structured data (schemas), rich callbacks |
Token budget control, threshold modes |
Multi-iteration search, streaming, OpenAI SDK compatible |
| Speed |
Fast (~0.5-1s) |
Fast (<1s) |
Slower (~30-180s) |
| Best for |
Search UIs, data extraction, custom ranking |
RAG pipelines, AI agents, grounding |
Chat interfaces, thorough research |
Parameters
| Parameter |
Type |
Required |
Default |
Description |
q |
string |
Yes |
- |
Search query (1-400 chars, max 50 words) |
country |
string |
No |
US |
Search country (2-letter country code or ALL) |
search_lang |
string |
No |
en |
Language preference (2+ char language code) |
ui_lang |
string |
No |
en-US |
UI language (e.g., "en-US") |
count |
int |
No |
20 |
Max results per page (1-20) |
offset |
int |
No |
0 |
Page offset for pagination (0-9) |
safesearch |
string |
No |
moderate |
Adult content filter (off/moderate/strict) |
freshness |
string |
No |
- |
Time filter (pd/pw/pm/py or date range) |
text_decorations |
bool |
No |
true |
Include highlight markers |
spellcheck |
bool |
No |
true |
Auto-correct query |
result_filter |
string |
No |
- |
Filter result types (comma-separated) |
goggles |
string |
No |
- |
Custom ranking filter (URL or inline) |
extra_snippets |
bool |
No |
- |
Get up to 5 extra snippets per result |
operators |
bool |
No |
true |
Apply search operators |
units |
string |
No |
- |
Measurement units (metric/imperial) |
enable_rich_callback |
bool |
No |
false |
Enable rich 3rd party data callback |
include_fetch_metadata |
bool |
No |
false |
Include fetched_content_timestamp on results |
Freshness Values
| Value |
Description |
pd |
Past day (24 hours) |
pw |
Past week (7 days) |
pm |
Past month (31 days) |
py |
Past year (365 days) |
YYYY-MM-DDtoYYYY-MM-DD |
Custom date range |
Result Filter Values
Filter types: discussions, faq, infobox, news, query, videos, web, locations
# Only web and video results
curl "...&result_filter=web,videos"
Location Headers (Optional)
For location-aware results, add these headers. Lat/Long is sufficient when coordinates are known — the other headers are only needed as a fallback when coordinates are unavailable.
| Header |
Type |
Description |
X-Loc-Lat |
float |
User latitude (-90.0 to 90.0) |
X-Loc-Long |
float |
User longitude (-180.0 to 180.0) |
X-Loc-Timezone |
string |
IANA timezone (e.g., "America/San_Francisco") |
X-Loc-City |
string |
City name |
X-Loc-State |
string |
State/region code (ISO 3166-2) |
X-Loc-State-Name |
string |
State/region full name (e.g., "California") |
X-Loc-Country |
string |
2-letter country code |
X-Loc-Postal-Code |
string |
Postal code (e.g., "94105") |
Priority: X-Loc-Lat + X-Loc-Long take precedence. When provided, downstream services resolve the location directly from coordinates and the text-based headers (City, State, Country, Postal-Code) are not used for location resolution. Provide text-based headers only when you don't have coordinates. Sending both won't break anything — lat/long simply wins.
Response Format
Response Fields
| Field |
Type |
Description |
type |
string |
Always "search" |
query.original |
string |
The original search query |
query.altered |
string? |
Spellcheck-corrected query (if changed) |
query.cleaned |
string? |
Cleaned/normalized query |
query.spellcheck_off |
bool? |
Whether spellcheck was disabled |
query.more_results_available |
bool |
Whether more pages exist |
query.show_strict_warning |
bool? |
True if strict safesearch blocked adult results |
query.search_operators |
object? |
Applied search operators (applied, cleaned_query, sites) |
web.type |
string |
Always "search" |
web.results[].title |
string |
Page title |
web.results[].url |
string |
Page URL |
web.results[].description |
string? |
Snippet/description text |
web.results[].age |
string? |
Human-readable age (e.g., "2 days ago") |
web.results[].language |
string? |
Content language code |
web.results[].meta_url |
object |
URL components (scheme, netloc, hostname, path) |
web.results[].thumbnail |
object? |
Thumbnail (src, original) |
web.results[].thumbnail.original |
string? |
Original full-size image URL |
web.results[].thumbnail.logo |
bool? |
Whether the thumbnail is a logo |
web.results[].profile |
object? |
Publisher identity (name, url, long_name, img) |
web.results[].page_age |
string? |
ISO datetime of publication (e.g., "2025-04-12T14:22:41") |
web.results[].extra_snippets |
list[str]? |
Up to 5 additional excerpts |
web.results[].deep_results |
object? |
Additional links (buttons, links) from the page |
web.results[].schemas |
list? |
Raw schema.org structured data |
web.results[].product |
object? |
Product info and reviews |
web.results[].recipe |
object? |
Recipe details (ingredients, time, ratings) |
web.results[].article |
object? |
Article metadata (author, publisher, date) |
web.results[].book |
object? |
Book info (author, ISBN, rating) |
web.results[].software |
object? |
Software product info |
web.results[].rating |
object? |
Aggregate ratings |
web.results[].faq |
object? |
FAQ found on the page |
web.results[].movie |
object? |
Movie info (directors, actors, genre) |
web.results[].video |
object? |
Video metadata (duration, views, creator) |
web.results[].location |
object? |
Location/restaurant details |
web.results[].qa |
object? |
Question/answer info |
web.results[].creative_work |
object? |
Creative work data |
web.results[].music_recording |
object? |
Music/song data |
web.results[].organization |
object? |
Organization info |
web.results[].review |
object? |
Review data |
web.results[].content_type |
string? |
Content type classification |
web.results[].fetched_content_timestamp |
int? |
Fetch timestamp (with include_fetch_metadata=true) |
web.mutated_by_goggles |
bool |
Whether results were re-ranked by Goggles |
web.family_friendly |
bool |
Whether results are family-friendly |
mixed |
object? |
Preferred display order (see Mixed Response below) |
discussions.results[] |
array? |
Forum discussion clusters |
discussions.results[].data.forum_name |
string? |
Forum/community name |
discussions.results[].data.num_answers |
int? |
Number of answers/replies |
discussions.results[].data.question |
string? |
Discussion question |
discussions.results[].data.top_comment |
string? |
Top-voted comment excerpt |
faq.results[] |
array? |
FAQ entries |
news.results[] |
array? |
News articles |
videos.results[] |
array? |
Video results |
infobox.results[] |
array? |
Knowledge graph entries |
locations.results[] |
array? |
Local POI results |
rich.hint.vertical |
string? |
Rich result type |
rich.hint.callback_key |
string? |
Callback key for rich data |
JSON Example
{
"type": "search",
"query": {
"original": "python frameworks",
"altered": "python web frameworks",
"spellcheck_off": false,
"more_results_available": true
},
"web": {
"type": "search",
"results": [
{
"title": "Top Python Web Frameworks",
"url": "https://example.com/python-frameworks",
"description": "A comprehensive guide to Python web frameworks...",
"age": "2 days ago",
"language": "en",
"meta_url": {
"scheme": "https",
"netloc": "example.com",
"hostname": "example.com",
"path": "/python-frameworks"
},
"thumbnail": {
"src": "https://...",
"original": "https://original-image-url.com/img.jpg"
},
"extra_snippets": ["Additional excerpt 1...", "Additional excerpt 2..."]
}
],
"family_friendly": true
},
"mixed": {
"type": "mixed",
"main": [
{"type": "web", "index": 0, "all": false},
{"type": "web", "index": 1, "all": false},
{"type": "videos", "all": true}
],
"top": [],
"side": []
},
"videos": { "...": "..." },
"news": { "...": "..." },
"rich": {
"type": "rich",
"hint": {
"vertical": "weather",
"callback_key": "<callback_key_hex>"
}
}
}
Mixed Response
The mixed object defines the preferred display order of results across types. It contains three arrays:
| Array |
Purpose |
main |
Primary result list (ordered sequence of results to display) |
top |
Results to display above main results |
side |
Results to display alongside main results (e.g., infobox) |
Each entry is a ResultReference with type (e.g., "web", "videos"), index (into the corresponding result array), and all (true to include all results of that type at this position).
Search Operators
| Operator |
Syntax |
Description |
| Site |
site:example.com |
Limit results to a specific domain |
| File extension |
ext:pdf |
Results with a specific file extension |
| File type |
filetype:pdf |
Results created in a specific file type |
| In title |
intitle:python |
Pages with term in the title |
| In body |
inbody:tutorial |
Pages with term in the body |
| In page |
inpage:guide |
Pages with term in title or body |
| Language |
lang:es |
Pages in a specific language (ISO 639-1) |
| Location |
loc:us |
Pages from a specific country (ISO 3166-1 alpha-2) |
| Include |
+term |
Force inclusion of a term |
| Exclude |
-term |
Exclude pages containing the term |
| Exact match |
"exact phrase" |
Match the exact phrase in order |
| AND |
term1 AND term2 |
Both terms required (uppercase) |
| OR / NOT |
term1 OR term2, NOT term |
Logical operators (uppercase) |
Set operators=false to disable operator parsing.
Goggles (Custom Ranking) — Unique to Brave
Goggles let you re-rank search results — boost trusted sources, suppress SEO spam, or build focused search scopes.
| Method |
Example |
| Hosted |
--data-urlencode "goggles=https://raw.githubusercontent.com/brave/goggles-quickstart/main/goggles/rust_programming.goggle" |
| Inline |
--data-urlencode 'goggles=$discard\n$site=example.com' |
Hosted goggles must be on GitHub/GitLab, include ! name:, ! description:, ! author: headers, and be registered at https://search.brave.com/goggles/create. Inline rules need no registration.
Syntax: $boost=N / $downrank=N (1–10), $discard, $site=example.com. Combine with commas: $site=example.com,boost=3. Separate rules with \n (%0A).
Allow list: $discard\n$site=docs.python.org\n$site=developer.mozilla.org — Block list: $discard,site=pinterest.com\n$discard,site=quora.com
Resources: Discover · Syntax · Quickstart
Rich Data Enrichments
For queries about weather, stocks, sports, currency, etc., use the rich callback workflow:
# 1. Search with rich callback enabled
curl -s "https://api.search.brave.com/res/v1/web/search?q=weather+san+francisco&enable_rich_callback=true" \
-H "X-Subscription-Token: ${BRAVE_SEARCH_API_KEY}"
# Response includes: "rich": {"hint": {"callback_key": "abc123...", "vertical": "weather"}}
# 2. Get rich data with the callback key
curl -s "https://api.search.brave.com/res/v1/web/rich?callback_key=abc123..." \
-H "X-Subscription-Token: ${BRAVE_SEARCH_API_KEY}"
Supported Rich Types: Calculator, Definitions, Unit Conversion, Unix Timestamp, Package Tracker, Stock, Currency, Cryptocurrency, Weather, American Football, Baseball, Basketball, Cricket, Football/Soccer, Ice Hockey, Web3, Translator
Rich Callback Endpoint
GET https://api.search.brave.com/res/v1/web/rich
| Parameter |
Type |
Required |
Description |
callback_key |
string |
Yes |
Callback key from the web search rich.hint.callback_key field |
Use Cases
- General-purpose search integration: Richest result set (web, news, videos, discussions, FAQ, infobox, locations) in one call. For RAG/LLM grounding, prefer
llm-context.
- Structured data extraction: Products, recipes, ratings, articles via
schemas and typed fields on results.
- Custom search with Goggles: Unique to Brave. Boost/discard sites with inline rules or hosted Goggles for fully customized ranking.
Notes
- Pagination: Use
offset (0-9) with count to page through results
- Count: Max 20 for web search; actual results may be less than requested
1---2name: web-search3description: USE FOR web search. Returns ranked results with snippets, URLs, thumbnails. Supports freshness filters, SafeSearch, Goggles for custom ranking, pagination. Primary search endpoint.4---56# Web Search78> **Requires API Key**: Get one at https://api.search.brave.com9>10> **Plan**: Included in the **Search** plan. See https://api-dashboard.search.brave.com/app/subscriptions/subscribe1112## Quick Start (cURL)1314### Basic Search15```bash16curl -s "https://api.search.brave.com/res/v1/web/search?q=python+web+frameworks" \17 -H "Accept: application/json" \18 -H "X-Subscription-Token: ${BRAVE_SEARCH_API_KEY}"19```2021### With Parameters22```bash23curl -s "https://api.search.brave.com/res/v1/web/search" \24 -H "Accept: application/json" \25 -H "X-Subscription-Token: ${BRAVE_SEARCH_API_KEY}" \26 -G \27 --data-urlencode "q=rust programming tutorials" \28 --data-urlencode "country=US" \29 --data-urlencode "search_lang=en" \30 --data-urlencode "count=10" \31 --data-urlencode "safesearch=moderate" \32 --data-urlencode "freshness=pm"33```3435## Endpoint3637```http38GET https://api.search.brave.com/res/v1/web/search39POST https://api.search.brave.com/res/v1/web/search40```4142**Note**: Both GET and POST methods are supported. POST is useful for long queries or complex Goggles.4344**Authentication**: `X-Subscription-Token: <API_KEY>` header4546**Optional Headers**:47- `Accept-Encoding: gzip` — Enable gzip compression4849## When to Use Web Search5051| Feature | Web Search (this) | LLM Context (`llm-context`) | Answers (`answers`) |52|--|--|--|--|53| Output | Structured results (links, snippets, metadata) | Pre-extracted page content for LLMs | End-to-end AI answers with citations |54| Result types | Web, news, videos, discussions, FAQ, infobox, locations, rich | Extracted text chunks, tables, code | Synthesized answer + source list |55| Unique features | Goggles, structured data (`schemas`), rich callbacks | Token budget control, threshold modes | Multi-iteration search, streaming, OpenAI SDK compatible |56| Speed | Fast (~0.5-1s) | Fast (<1s) | Slower (~30-180s) |57| Best for | Search UIs, data extraction, custom ranking | RAG pipelines, AI agents, grounding | Chat interfaces, thorough research |5859## Parameters6061| Parameter | Type | Required | Default | Description |62|--|--|--|--|--|63| `q` | string | **Yes** | - | Search query (1-400 chars, max 50 words) |64| `country` | string | No | `US` | Search country (2-letter country code or `ALL`) |65| `search_lang` | string | No | `en` | Language preference (2+ char language code) |66| `ui_lang` | string | No | `en-US` | UI language (e.g., "en-US") |67| `count` | int | No | `20` | Max results per page (1-20) |68| `offset` | int | No | `0` | Page offset for pagination (0-9) |69| `safesearch` | string | No | `moderate` | Adult content filter (`off`/`moderate`/`strict`) |70| `freshness` | string | No | - | Time filter (`pd`/`pw`/`pm`/`py` or date range) |71| `text_decorations` | bool | No | `true` | Include highlight markers |72| `spellcheck` | bool | No | `true` | Auto-correct query |73| `result_filter` | string | No | - | Filter result types (comma-separated) |74| `goggles` | string | No | - | Custom ranking filter (URL or inline) |75| `extra_snippets` | bool | No | - | Get up to 5 extra snippets per result |76| `operators` | bool | No | `true` | Apply search operators |77| `units` | string | No | - | Measurement units (`metric`/`imperial`) |78| `enable_rich_callback` | bool | No | `false` | Enable rich 3rd party data callback |79| `include_fetch_metadata` | bool | No | `false` | Include `fetched_content_timestamp` on results |8081### Freshness Values8283| Value | Description |84|--|--|85| `pd` | Past day (24 hours) |86| `pw` | Past week (7 days) |87| `pm` | Past month (31 days) |88| `py` | Past year (365 days) |89| `YYYY-MM-DDtoYYYY-MM-DD` | Custom date range |9091### Result Filter Values9293Filter types: `discussions`, `faq`, `infobox`, `news`, `query`, `videos`, `web`, `locations`9495```bash96# Only web and video results97curl "...&result_filter=web,videos"98```99100### Location Headers (Optional)101102For location-aware results, add these headers. **Lat/Long is sufficient** when coordinates are known — the other headers are only needed as a fallback when coordinates are unavailable.103104| Header | Type | Description |105|--|--|--|106| `X-Loc-Lat` | float | User latitude (-90.0 to 90.0) |107| `X-Loc-Long` | float | User longitude (-180.0 to 180.0) |108| `X-Loc-Timezone` | string | IANA timezone (e.g., "America/San_Francisco") |109| `X-Loc-City` | string | City name |110| `X-Loc-State` | string | State/region code (ISO 3166-2) |111| `X-Loc-State-Name` | string | State/region full name (e.g., "California") |112| `X-Loc-Country` | string | 2-letter country code |113| `X-Loc-Postal-Code` | string | Postal code (e.g., "94105") |114115> **Priority**: `X-Loc-Lat` + `X-Loc-Long` take precedence. When provided, downstream services resolve the location directly from coordinates and the text-based headers (City, State, Country, Postal-Code) are not used for location resolution. Provide text-based headers **only** when you don't have coordinates. Sending both won't break anything — lat/long simply wins.116117## Response Format118119### Response Fields120121| Field | Type | Description |122|--|--|--|123| `type` | string | Always `"search"` |124| `query.original` | string | The original search query |125| `query.altered` | string? | Spellcheck-corrected query (if changed) |126| `query.cleaned` | string? | Cleaned/normalized query |127| `query.spellcheck_off` | bool? | Whether spellcheck was disabled |128| `query.more_results_available` | bool | Whether more pages exist |129| `query.show_strict_warning` | bool? | True if strict safesearch blocked adult results |130| `query.search_operators` | object? | Applied search operators (`applied`, `cleaned_query`, `sites`) |131| `web.type` | string | Always `"search"` |132| `web.results[].title` | string | Page title |133| `web.results[].url` | string | Page URL |134| `web.results[].description` | string? | Snippet/description text |135| `web.results[].age` | string? | Human-readable age (e.g., "2 days ago") |136| `web.results[].language` | string? | Content language code |137| `web.results[].meta_url` | object | URL components (`scheme`, `netloc`, `hostname`, `path`) |138| `web.results[].thumbnail` | object? | Thumbnail (`src`, `original`) |139| `web.results[].thumbnail.original` | string? | Original full-size image URL |140| `web.results[].thumbnail.logo` | bool? | Whether the thumbnail is a logo |141| `web.results[].profile` | object? | Publisher identity (`name`, `url`, `long_name`, `img`) |142| `web.results[].page_age` | string? | ISO datetime of publication (e.g., `"2025-04-12T14:22:41"`) |143| `web.results[].extra_snippets` | list[str]? | Up to 5 additional excerpts |144| `web.results[].deep_results` | object? | Additional links (`buttons`, `links`) from the page |145| `web.results[].schemas` | list? | Raw schema.org structured data |146| `web.results[].product` | object? | Product info and reviews |147| `web.results[].recipe` | object? | Recipe details (ingredients, time, ratings) |148| `web.results[].article` | object? | Article metadata (author, publisher, date) |149| `web.results[].book` | object? | Book info (author, ISBN, rating) |150| `web.results[].software` | object? | Software product info |151| `web.results[].rating` | object? | Aggregate ratings |152| `web.results[].faq` | object? | FAQ found on the page |153| `web.results[].movie` | object? | Movie info (directors, actors, genre) |154| `web.results[].video` | object? | Video metadata (duration, views, creator) |155| `web.results[].location` | object? | Location/restaurant details |156| `web.results[].qa` | object? | Question/answer info |157| `web.results[].creative_work` | object? | Creative work data |158| `web.results[].music_recording` | object? | Music/song data |159| `web.results[].organization` | object? | Organization info |160| `web.results[].review` | object? | Review data |161| `web.results[].content_type` | string? | Content type classification |162| `web.results[].fetched_content_timestamp` | int? | Fetch timestamp (with `include_fetch_metadata=true`) |163| `web.mutated_by_goggles` | bool | Whether results were re-ranked by Goggles |164| `web.family_friendly` | bool | Whether results are family-friendly |165| `mixed` | object? | Preferred display order (see Mixed Response below) |166| `discussions.results[]` | array? | Forum discussion clusters |167| `discussions.results[].data.forum_name` | string? | Forum/community name |168| `discussions.results[].data.num_answers` | int? | Number of answers/replies |169| `discussions.results[].data.question` | string? | Discussion question |170| `discussions.results[].data.top_comment` | string? | Top-voted comment excerpt |171| `faq.results[]` | array? | FAQ entries |172| `news.results[]` | array? | News articles |173| `videos.results[]` | array? | Video results |174| `infobox.results[]` | array? | Knowledge graph entries |175| `locations.results[]` | array? | Local POI results |176| `rich.hint.vertical` | string? | Rich result type |177| `rich.hint.callback_key` | string? | Callback key for rich data |178179### JSON Example180181```json182{183 "type": "search",184 "query": {185 "original": "python frameworks",186 "altered": "python web frameworks",187 "spellcheck_off": false,188 "more_results_available": true189 },190 "web": {191 "type": "search",192 "results": [193 {194 "title": "Top Python Web Frameworks",195 "url": "https://example.com/python-frameworks",196 "description": "A comprehensive guide to Python web frameworks...",197 "age": "2 days ago",198 "language": "en",199 "meta_url": {200 "scheme": "https",201 "netloc": "example.com",202 "hostname": "example.com",203 "path": "/python-frameworks"204 },205 "thumbnail": {206 "src": "https://...",207 "original": "https://original-image-url.com/img.jpg"208 },209 "extra_snippets": ["Additional excerpt 1...", "Additional excerpt 2..."]210 }211 ],212 "family_friendly": true213 },214 "mixed": {215 "type": "mixed",216 "main": [217 {"type": "web", "index": 0, "all": false},218 {"type": "web", "index": 1, "all": false},219 {"type": "videos", "all": true}220 ],221 "top": [],222 "side": []223 },224 "videos": { "...": "..." },225 "news": { "...": "..." },226 "rich": {227 "type": "rich",228 "hint": {229 "vertical": "weather",230 "callback_key": "<callback_key_hex>"231 }232 }233}234```235236### Mixed Response237238The `mixed` object defines the preferred display order of results across types. It contains three arrays:239240| Array | Purpose |241|--|--|242| `main` | Primary result list (ordered sequence of results to display) |243| `top` | Results to display above main results |244| `side` | Results to display alongside main results (e.g., infobox) |245246Each entry is a `ResultReference` with `type` (e.g., `"web"`, `"videos"`), `index` (into the corresponding result array), and `all` (`true` to include all results of that type at this position).247248## Search Operators249250| Operator | Syntax | Description |251|--|--|--|252| Site | `site:example.com` | Limit results to a specific domain |253| File extension | `ext:pdf` | Results with a specific file extension |254| File type | `filetype:pdf` | Results created in a specific file type |255| In title | `intitle:python` | Pages with term in the title |256| In body | `inbody:tutorial` | Pages with term in the body |257| In page | `inpage:guide` | Pages with term in title or body |258| Language | `lang:es` | Pages in a specific language (ISO 639-1) |259| Location | `loc:us` | Pages from a specific country (ISO 3166-1 alpha-2) |260| Include | `+term` | Force inclusion of a term |261| Exclude | `-term` | Exclude pages containing the term |262| Exact match | `"exact phrase"` | Match the exact phrase in order |263| AND | `term1 AND term2` | Both terms required (uppercase) |264| OR / NOT | `term1 OR term2`, `NOT term` | Logical operators (uppercase) |265266Set `operators=false` to disable operator parsing.267268## Goggles (Custom Ranking) — Unique to Brave269270Goggles let you **re-rank search results** — boost trusted sources, suppress SEO spam, or build focused search scopes.271272| Method | Example |273|--|--|274| **Hosted** | `--data-urlencode "goggles=https://raw.githubusercontent.com/brave/goggles-quickstart/main/goggles/rust_programming.goggle"` |275| **Inline** | `--data-urlencode 'goggles=$discard\n$site=example.com'` |276277> **Hosted** goggles must be on GitHub/GitLab, include `! name:`, `! description:`, `! author:` headers, and be registered at https://search.brave.com/goggles/create. **Inline** rules need no registration.278279**Syntax**: `$boost=N` / `$downrank=N` (1–10), `$discard`, `$site=example.com`. Combine with commas: `$site=example.com,boost=3`. Separate rules with `\n` (`%0A`).280281**Allow list**: `$discard\n$site=docs.python.org\n$site=developer.mozilla.org` — **Block list**: `$discard,site=pinterest.com\n$discard,site=quora.com`282283**Resources**: [Discover](https://search.brave.com/goggles/discover) · [Syntax](https://search.brave.com/help/goggles) · [Quickstart](https://github.com/brave/goggles-quickstart)284285## Rich Data Enrichments286287For queries about weather, stocks, sports, currency, etc., use the rich callback workflow:288289```bash290# 1. Search with rich callback enabled291curl -s "https://api.search.brave.com/res/v1/web/search?q=weather+san+francisco&enable_rich_callback=true" \292 -H "X-Subscription-Token: ${BRAVE_SEARCH_API_KEY}"293294# Response includes: "rich": {"hint": {"callback_key": "abc123...", "vertical": "weather"}}295296# 2. Get rich data with the callback key297curl -s "https://api.search.brave.com/res/v1/web/rich?callback_key=abc123..." \298 -H "X-Subscription-Token: ${BRAVE_SEARCH_API_KEY}"299```300301**Supported Rich Types**: Calculator, Definitions, Unit Conversion, Unix Timestamp, Package Tracker, Stock, Currency, Cryptocurrency, Weather, American Football, Baseball, Basketball, Cricket, Football/Soccer, Ice Hockey, Web3, Translator302303### Rich Callback Endpoint304305```http306GET https://api.search.brave.com/res/v1/web/rich307```308309| Parameter | Type | Required | Description |310|--|--|--|--|311| `callback_key` | string | Yes | Callback key from the web search `rich.hint.callback_key` field |312313## Use Cases314315- **General-purpose search integration**: Richest result set (web, news, videos, discussions, FAQ, infobox, locations) in one call. For RAG/LLM grounding, prefer `llm-context`.316- **Structured data extraction**: Products, recipes, ratings, articles via `schemas` and typed fields on results.317- **Custom search with Goggles**: Unique to Brave. Boost/discard sites with inline rules or hosted Goggles for fully customized ranking.318319## Notes320321- **Pagination**: Use `offset` (0-9) with `count` to page through results322- **Count**: Max 20 for web search; actual results may be less than requested