Getting started
Get started with the Brave Search API in minutes
Introduction
This guide will walk you through everything you need to perform your first search using the Brave Search API. From creating your account to making your first API request, 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 for plan subscription (required also on free plans)
- 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: Subscribe to a Plan
Once your account is created, you’ll need to subscribe to a plan to access the API:
- Navigate to the Available plans section in your dashboard
- Review the available plans and select one that fits your needs
- Enter your credit card information
Free Plan Available: We offer a free tier that includes generous monthly query limits. While a credit card is required to prevent fraud and abuse, you won’t be charged unless you upgrade.
Plan Options
Our plans are designed to scale with your needs:
- Free: Perfect for testing and small projects (credit card required for verification)
- Base: Ideal for production applications with moderate traffic
- Pro: For businesses with high-volume requirements
- Enterprise: Custom solutions with dedicated support and capacities
Step 3: Create an API Key
After subscribing to 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 Search Request
Now you’re ready to make your first search! The Brave Search API uses a simple REST architecture. All requests require your API key in the X-Subscription-Token header.
Basic Web Search
Here’s how to perform a basic web search:
curl "https://api.search.brave.com/res/v1/web/search?q=artificial+intelligence" \
-H "X-Subscription-Token: YOUR_API_KEY"import requests
url = "https://api.search.brave.com/res/v1/web/search"
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 search result
if results.get("web", {}).get("results"):
first_result = results["web"]["results"][0]
print(f"Title: {first_result['title']}")
print(f"URL: {first_result['url']}")
print(f"Description: {first_result['description']}")const url = new URL("https://api.search.brave.com/res/v1/web/search");
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 search result
if (results.web?.results?.length > 0) {
const firstResult = results.web.results[0];
console.log(`Title: ${firstResult.title}`);
console.log(`URL: ${firstResult.url}`);
console.log(`Description: ${firstResult.description}`);
}Understanding the Response
A successful search returns a JSON object with various result types:
{
"type": "search",
"query": {
"original": "artificial intelligence"
},
"web": {
"results": [
{
"title": "Artificial Intelligence - Overview",
"url": "https://example.com/ai",
"description": "Learn about artificial intelligence...",
"age": "2024-10-08T10:30:00.000Z"
}
]
}
}Full documentation of responses at API Reference page.
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:
Authentication Guide
Learn more about securing your API requests
API Reference
Explore all available endpoints and parameters
Rate Limiting
Understand rate limits and how to optimize requests
API Versioning
Learn about API versions and backward compatibility
Need Help?
If you run into any issues or have questions:
- Check our API Documentation for detailed endpoint information
- Review our Security Guidelines for best practices
- See the common questions and answers or contact our support team at Help & Feedback page