$npx -y skills add brave/brave-search-skills --skill web-searchUSE FOR web search. Returns ranked results with snippets, URLs, thumbnails. Supports freshness filters, SafeSearch, Goggles for custom ranking, pagination. Primary search endpoint.
| 1 | # Web Search |
| 2 | |
| 3 | > **Requires API Key**: Get one at https://api.search.brave.com |
| 4 | > |
| 5 | > **Plan**: Included in the **Search** plan. See https://api-dashboard.search.brave.com/app/subscriptions/subscribe |
| 6 | |
| 7 | ## Quick Start (cURL) |
| 8 | |
| 9 | ### Basic Search |
| 10 | ```bash |
| 11 | curl -s "https://api.search.brave.com/res/v1/web/search?q=python+web+frameworks" \ |
| 12 | -H "Accept: application/json" \ |
| 13 | -H "X-Subscription-Token: ${BRAVE_SEARCH_API_KEY}" |
| 14 | ``` |
| 15 | |
| 16 | ### With Parameters |
| 17 | ```bash |
| 18 | curl -s "https://api.search.brave.com/res/v1/web/search" \ |
| 19 | -H "Accept: application/json" \ |
| 20 | -H "X-Subscription-Token: ${BRAVE_SEARCH_API_KEY}" \ |
| 21 | -G \ |
| 22 | --data-urlencode "q=rust programming tutorials" \ |
| 23 | --data-urlencode "country=US" \ |
| 24 | --data-urlencode "search_lang=en" \ |
| 25 | --data-urlencode "count=10" \ |
| 26 | --data-urlencode "safesearch=moderate" \ |
| 27 | --data-urlencode "freshness=pm" |
| 28 | ``` |
| 29 | |
| 30 | ## Endpoint |
| 31 | |
| 32 | ```http |
| 33 | GET https://api.search.brave.com/res/v1/web/search |
| 34 | POST https://api.search.brave.com/res/v1/web/search |
| 35 | ``` |
| 36 | |
| 37 | **Note**: Both GET and POST methods are supported. POST is useful for long queries or complex Goggles. |
| 38 | |
| 39 | **Authentication**: `X-Subscription-Token: <API_KEY>` header |
| 40 | |
| 41 | **Optional Headers**: |
| 42 | - `Accept-Encoding: gzip` — Enable gzip compression |
| 43 | |
| 44 | ## When to Use Web Search |
| 45 | |
| 46 | | Feature | Web Search (this) | LLM Context (`llm-context`) | Answers (`answers`) | |
| 47 | |--|--|--|--| |
| 48 | | Output | Structured results (links, snippets, metadata) | Pre-extracted page content for LLMs | End-to-end AI answers with citations | |
| 49 | | Result types | Web, news, videos, discussions, FAQ, infobox, locations, rich | Extracted text chunks, tables, code | Synthesized answer + source list | |
| 50 | | Unique features | Goggles, structured data (`schemas`), rich callbacks | Token budget control, threshold modes | Multi-iteration search, streaming, OpenAI SDK compatible | |
| 51 | | Speed | Fast (~0.5-1s) | Fast (<1s) | Slower (~30-180s) | |
| 52 | | Best for | Search UIs, data extraction, custom ranking | RAG pipelines, AI agents, grounding | Chat interfaces, thorough research | |
| 53 | |
| 54 | ## Parameters |
| 55 | |
| 56 | | Parameter | Type | Required | Default | Description | |
| 57 | |--|--|--|--|--| |
| 58 | | `q` | string | **Yes** | - | Search query (1-400 chars, max 50 words) | |
| 59 | | `country` | string | No | `US` | Search country (2-letter country code or `ALL`) | |
| 60 | | `search_lang` | string | No | `en` | Language preference (2+ char language code) | |
| 61 | | `ui_lang` | string | No | `en-US` | UI language (e.g., "en-US") | |
| 62 | | `count` | int | No | `20` | Max results per page (1-20) | |
| 63 | | `offset` | int | No | `0` | Page offset for pagination (0-9) | |
| 64 | | `safesearch` | string | No | `moderate` | Adult content filter (`off`/`moderate`/`strict`) | |
| 65 | | `freshness` | string | No | - | Time filter (`pd`/`pw`/`pm`/`py` or date range) | |
| 66 | | `text_decorations` | bool | No | `true` | Include highlight markers | |
| 67 | | `spellcheck` | bool | No | `true` | Auto-correct query | |
| 68 | | `result_filter` | string | No | - | Filter result types (comma-separated) | |
| 69 | | `goggles` | string | No | - | Custom ranking filter (URL or inline) | |
| 70 | | `extra_snippets` | bool | No | - | Get up to 5 extra snippets per result | |
| 71 | | `operators` | bool | No | `true` | Apply search operators | |
| 72 | | `units` | string | No | - | Measurement units (`metric`/`imperial`) | |
| 73 | | `enable_rich_callback` | bool | No | `false` | Enable rich 3rd party data callback | |
| 74 | | `include_fetch_metadata` | bool | No | `false` | Include `fetched_content_timestamp` on results | |
| 75 | |
| 76 | ### Freshness Values |
| 77 | |
| 78 | | Value | Description | |
| 79 | |--|--| |
| 80 | | `pd` | Past day (24 hours) | |
| 81 | | `pw` | Past week (7 days) | |
| 82 | | `pm` | Past month (31 days) | |
| 83 | | `py` | Past year (365 days) | |
| 84 | | `YYYY-MM-DDtoYYYY-MM-DD` | Custom date range | |
| 85 | |
| 86 | ### Result Filter Values |
| 87 | |
| 88 | Filter types: `discussions`, `faq`, `infobox`, `news`, `query`, `videos`, `web`, `locations` |
| 89 | |
| 90 | ```bash |
| 91 | # Only web and video results |
| 92 | curl "...&result_filter=web,videos" |
| 93 | ``` |
| 94 | |
| 95 | ### Location Headers (Optional) |
| 96 | |
| 97 | 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. |
| 98 | |
| 99 | | Header | Type | Description | |
| 100 | |--|--|--| |
| 101 | | `X-Loc-Lat` | float | User latitude (-90.0 to 90.0) | |
| 102 | | `X-Loc-Long` | float | User longitude (-180.0 to 180.0) | |
| 103 | | `X-Loc-Timezone` | string | IANA timezone (e.g., "America/San_Francisco") | |
| 104 | | `X-Loc-City` | string | City name | |
| 105 | | `X-Loc-State` | string | State/region code (ISO 3166-2) | |
| 106 | | `X-Loc-State-Name` | string | State/region full name (e.g., "California") | |
| 107 | | `X-Loc-Country` | string | 2-letter country code | |
| 108 | | `X-Loc-Postal-Code` | string | Postal code (e.g., "94105") | |
| 109 | |
| 110 | > **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 lo |