Brave Web Search API

Request Headers

Web Search API Request Headers

This table lists the request headers supported by the Web Search API. Most are optional, but note that sending more information in headers (such as client location) will improve search results.

Header Required Name Description
Accept No Accept The default supported media type is application/json.
Accept-Encoding No Accept Encoding The supported compression type is gzip.
Api-Version No Web Search API Version The Brave Web Search API version to use. This is denoted by the format YYYY-MM-DD. The latest version is used by default, and the previous ones can be found in the API Changelog.
Cache-Control No Cache Control

Search will return cached web search results by default. To prevent caching set the Cache-Control header to no-cache. This is currently done as best effort.

User-Agent No User Agent

The user agent of the client sending the request. Search can utilize the user agent to provide a different experience depending on the client sending the request.

The user agent should follow the commonly used browser agent strings on each platform. For more information on curating user agents, see RFC 9110.

User agent string examples by platform:

Android
Mozilla/5.0 (Linux; Android 13; Pixel 7 Pro) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Mobile Safari/537.36
iOS
Mozilla/5.0 (iPhone; CPU IPhone OS 16_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) CriOS/100.0.0.0 Mobile/15E148 Safari/604.1
macOS
Mozilla/5.0 (Macintosh; Intel Mac OS X 13_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36
Windows
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.0.0 Safari/537.36
X-Loc-Lat No Latitude The latitude of the client's geographical location in degrees, to provide relevant local results. The latitiude must be greater than or equal to -90.0 degrees and less than or equal to +90.0 degrees.
X-Loc-Long No Longitude

The longitude of the client's geographical location in degrees, to provide relevant local results. The longitude must be greater than or equal to -180.0 degrees and less than or equal to +180.0 degrees.

X-Loc-Timezone No Timezone

The IANA timezone for the client's device.

For complete list of IANA timezones and location mappings see IANA Database and Geonames Database.

X-Loc-City No City Name

The generic name of the client city.

X-Loc-State No State Code

The code representing the client’s state/region, can be up to 3 characters long.

The region is the first-level subdivision (the broadest or least specific) of the ISO 3166-2 code.

X-Loc-State-Name No State Name

The name of the client's state/region.

The region is the first-level subdivision (the broadest or least specific) of the ISO 3166-2 code.

X-Loc-Country No Country Code

The two letter code for the client's country.

For a list of country codes, see ISO 3166-1 alpha-2

X-Loc-Postal-Code No Postal Code The client's postal code
X-Subscription-Token Yes Authentication token The secret token for the subscribed plan to authenticate the request. Can be obtained from API Keys.

Local Search API Request Headers

This table lists the request headers supported by the Local Search API, most of which are optional.

Header Required Name Description
Accept No Accept The default supported media type is application/json.
Accept Encoding No Accept-Encoding The supported compression type is gzip.
Api-Version No Local Search API Version The Brave Local Search API version to use. This is denoted in the format YYYY-MM-DD. The latest version is used by default.
Cache-Control No Cache Control

Search will return cached information for a location by default. To prevent caching set the Cache-Control header to no-cache. This is currently done as best effort.

User-Agent No User Agent

The user agent of the client sending the request. Search can utilize the user agent to provide a different experience depending on the client sending the request.

The user agent should follow the commonly used browser agent strings on each platform. For more information on curating user agents, see RFC 9110.

User agent string examples by platform:

Android
Mozilla/5.0 (Linux; Android 13; Pixel 7 Pro) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Mobile Safari/537.36
iOS
Mozilla/5.0 (iPhone; CPU IPhone OS 16_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) CriOS/100.0.0.0 Mobile/15E148 Safari/604.1
macOS
Mozilla/5.0 (Macintosh; Intel Mac OS X 13_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36
Windows
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.0.0 Safari/537.36
X-Subscription-Token Yes Authentication token The secret token for the subscribed plan to authenticate the request. Can be obtained from API Keys.