Getting started
Introduction
This guide will walk you through everything you need to make your first request using the Brave Search API. From creating your account to calling the API, you’ll be up and running in just a few minutes.
Prerequisites
Before you begin, make sure you have:
- A valid email address for account registration
- A credit card to activate a plan
- Basic familiarity with making HTTP requests
Step 1: Create Your Account
Go to Brave Search API Dashboard to create your account:
- Enter your email address and create a secure password
- Verify your email address by clicking the confirmation link sent to your inbox
- Log in and you are ready for Step 2.
Account creation is free and only takes a minute.
Step 2: Activate a Plan
Once your account is created, you’ll need to activate a plan to access the API:
- Navigate to the Plans page in your dashboard
- Review the available plans and select one that fits your needs
- Enter your credit card information
The Search plan includes both LLM Context (Search for AI agents) and Web Search.
Step 3: Create an API Key
After activating a plan, generate your API key:
- Go to the API Keys section in your dashboard
- Click on Add API Key
- Give your key a descriptive name (e.g., “Production App” or “Development”)
- Copy your API key and store it securely
Your API key is confidential. Never share it publicly, commit it to version control, or expose it in client-side code. Treat it like a password.
Step 4: Make Your First Request
The Brave Search API uses a simple REST architecture. All requests require your
API key in the X-Subscription-Token header.
LLM Context - Search for AI agents
Here’s how to retrieve pre-extracted web content for a model:
curl "https://api.search.brave.com/res/v1/llm/context?q=artificial+intelligence" \
-H "X-Subscription-Token: YOUR_API_KEY"import requests
url = "https://api.search.brave.com/res/v1/llm/context"
headers = {
"Accept": "application/json",
"Accept-Encoding": "gzip",
"X-Subscription-Token": "YOUR_API_KEY"
}
params = {
"q": "artificial intelligence"
}
response = requests.get(url, headers=headers, params=params)
results = response.json()
# Print the first extracted snippet
generic = results.get("grounding", {}).get("generic") or []
if generic and generic[0].get("snippets"):
print(generic[0]["title"])
print(generic[0]["url"])
print(generic[0]["snippets"][0])const url = new URL("https://api.search.brave.com/res/v1/llm/context");
url.searchParams.append("q", "artificial intelligence");
const response = await fetch(url, {
headers: {
Accept: "application/json",
"Accept-Encoding": "gzip",
"X-Subscription-Token": "YOUR_API_KEY",
},
});
const results = await response.json();
// Print the first extracted snippet
const first = results.grounding?.generic?.[0];
if (first?.snippets?.length) {
console.log(first.title);
console.log(first.url);
console.log(first.snippets[0]);
}Understanding the Response
A successful LLM Context call returns extracted page content under grounding and source metadata under sources — ready to pass to a model:
{
"grounding": {
"generic": [
{
"url": "https://example.com/ai",
"title": "Artificial Intelligence - Overview",
"snippets": [
"Relevant text chunk extracted from the page..."
]
}
]
},
"sources": {
"https://example.com/ai": {
"title": "Artificial Intelligence - Overview",
"hostname": "example.com"
}
}
}Full documentation of responses at the LLM Context API Reference.
Building a search UI for humans? See Web Search instead.
Monitor Your Usage
Keep track of your API usage in the dashboard to:
- Stay within your plan limits
- Optimize your query patterns
- Plan for scaling needs
Next Steps
Congratulations! You’ve made your first search with the Brave Search API. Here’s what to explore next:
LLM Context
Token budgets, Goggles, local recall, and response fields
Skills
Drop-in instructions for Claude Code, Cursor, Codex, and other agents
Authentication Guide
Learn more about securing your API requests
Web Search
Ranked results for human search UIs
Need Help?
If you run into any issues or have questions:
- Check the LLM Context API Reference for parameters and schemas
- Review our Security Guidelines for best practices
- See the common questions and answers or contact our support team at Help & Feedback page