Overview
The Brave Search API uses API key authentication to secure requests. Every API request must include your subscription token in the request header to authenticate and authorize access.Your API key is confidential and should be kept secure. Never expose it in
client-side code, public repositories, or share it publicly.
Obtaining Your API Key
To get started with the Brave Search API, you’ll need a subscription token:- Subscribe to a plan — Visit the Brave Search API page and choose a plan that fits your needs
- Access your API keys — Once subscribed, navigate to the API Keys section in your dashboard
- Copy your token — Your subscription token will be displayed. Copy it to use in your requests
Even on the Free plan, you need to subscribe to obtain an API key. You won’t
be charged for the free tier.
Authentication Method
All requests to the Brave Search API must include your subscription token in theX-Subscription-Token HTTP header.
Header Format
Code Examples
Here are examples of how to authenticate requests in various programming languages:Best Practices
Secure Storage
Never hardcode your API key directly in your source code. Instead, use environment variables or secure configuration management:Key Rotation
Regularly rotate your API keys as a security best practice. You can generate new keys from your dashboard.If you suspect your API key has been compromised, immediately revoke it from
your dashboard and generate a new one.