X-Subscription-Token header.
Things to know before you call:
- Plans. Brave sells three plans, each with its own key scope: Search ($5 per 1,000 requests: `web.*`, `llm.context`, `news`, `videos`, `images`, `local.*`), Answers ($4 per 1,000 searches plus $5 per million input and output tokens: `answers.*`) and Autosuggest/Spellcheck ($5 per 10,000 requests:
suggest.search,spellcheck.search). A call outside the key’s plan answers400 OPTION_NOT_IN_PLAN. Failed calls are not billed. llm.contextvsweb.search.llm.contextreturns extracted page text sized to a token budget, for grounding a model;web.searchreturns ranked titles, URLs and snippets plus news, video, discussion, FAQ and local sections.- Places.
local.placeSearchfinds businesses and landmarks by text (location: "tokyo japan") orlatitude/longitude. Its result ids (and the ids inweb.searchlocations) feedlocal.poisandlocal.descriptions; they expire after 8 hours. - Rich results.
web.searchwithenable_rich_callback: truereturnsrich.hint.callback_keyfor queries like “weather in london”;web.richfetches the live data for it. - Answers.
answers.createanswers from one search;enable_citationscollects inline citations (offsets into the answer text) intocitations.answers.researchruns multi-search deep research for up toresearch_maximum_number_of_seconds(default 180). Both stream from Brave and return one completion withcitations,cost(Brave’s usage line in USD) and any other tagged items intags. - Location headers. Pass
location: { lat, long, city, country, ... }onweb.search,llm.contextandlocal.poisfor local results; it is sent asX-Loc-*headers and kept out of error messages. - Admin API.
admin.*reads usage and key lists with a separate admin key (bsk_admin_..., made on the dashboard’s Admin keys page). Set it as theadminKeyoption or store it as the account’sadmin_key; a search key gets401 ADMIN_KEY_INVALID. - Managed pricing. With
authType: 'managed_pricing', searches run on Corsair’s Brave Search key and are billed in Corsair credits. Operations Corsair doesn’t price (Answers research, the Admin API) are refused and nothing is charged. - Rate limits. Every response carries
X-RateLimit-*headers with one value per window (per second, per month). A per-second429 RATE_LIMITEDis retried after a second; a spent monthly quota is not. - Brave’s Summarizer endpoints are deprecated (replaced by Answers) and not included.
- 17 typed API operations
Setup
1
Install
2
Add the plugin
corsair.ts
multiTenancy: true, scope calls with corsair.withTenant(id). See Quick start for KEK + Hub keys, and Multi-tenancy for account isolation.3
Choose authentication
- API Key (Recommended)
Store the Brave Search API key before the first call: More: API Key
pnpm corsair setup --plugin=bravesearch --tenant=acme api_key=<your-key> (leave out --tenant without multiTenancy), or pass it as key in the plugin options. With Hub, each tenant enters their own key on the connect page. See API key auth.4
Connect a tenant
Mint a connect link and send the tenant to it. Hub hosts the page and delivers the result to your app — see Connect / OAuth.
Example API calls
Search the webWhat’s next
API reference
Every
bravesearch.api.* operation with input and output types.Connect / OAuth
createLink, Hub delivery, and tenant connect flows.
Use with agents
Expose this plugin’s operations as MCP tools.