Skip to main content
GET
News Search

授权

Authorization
string
header
必填

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

请求头

accept
enum<string>
默认值:application/json

The default supported media type is application/json.

可用选项:
application/json,
*/*
示例:

"application/json"

api-version
string | null

The API version to use. This is denoted by the format YYYY-MM-DD. Default is the latest that is available. Read more about API versioning.

cache-control
enum<string> | null

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

可用选项:
no-cache
Allowed value: "no-cache"
user-agent
string | null

The user agent originating the request. Brave search can utilize the user agent to provide a different experience depending on the device as described by the string. The user agent should follow the commonly used browser agent strings on each platform. For more information on curating user agents, see RFC 9110.

查询参数

count
integer
默认值:20

The number of search results returned in response. The maximum is 50. The actual number delivered may be less than requested. Combine this parameter with offset to paginate search results.

必填范围: 1 <= x <= 50
country
enum<string>
默认值:US

The search query country, where the results come from. The country string is limited to 2 character country codes of supported countries or ALL for worldwide.

可用选项:
AR,
AU,
AT,
BE,
BR,
CA,
CL,
DK,
FI,
FR,
DE,
GR,
HK,
IN,
ID,
IT,
JP,
KR,
MY,
MX,
NL,
NZ,
NO,
CN,
PL,
PT,
PH,
RU,
SA,
ZA,
ES,
SE,
CH,
TW,
TR,
GB,
US,
ALL
extra_snippets
boolean | null

A snippet is an excerpt from a page you get as a result of the query, and extra_snippets allow you to get up to 5 additional, alternative excerpts.

freshness
string
默认值:""

Filters search results by page age. The age of a page is determined by the most relevant date reported by the content, such as its published or last modified date. The following values are supported:

  • pd - Pages aged 24 hours or less.
  • pw - Pages aged 7 days or less.
  • pm - Pages aged 31 days or less.
  • py - Pages aged 365 days or less.
  • YYYY-MM-DDtoYYYY-MM-DD - A custom date range is also supported by specifying start and end dates e.g. 2022-04-01to2022-07-30.
示例:

""

"pm"

"2022-04-01to2022-07-30"

goggles

Goggles act as a custom re-ranking on top of Brave’s search index. The parameter supports both a url where the Goggle is hosted or the definition of the Goggle. For more details, see the Goggles documentation. The parameter can be a single Goggle or a list of up to 3 Goggles.

include_fetch_metadata
boolean
默认值:false

Include fetch metadata.

示例:

""

true

false

offset
integer
默认值:0

The zero based offset that indicates number of search results per page (count) to skip before returning the result. The maximum is 9. The actual number delivered may be less than requested based on the query. In order to paginate results use this parameter together with count. For example, if your user interface displays 20 search results per page, set count to 20 and offset to 0 to show the first page of results. To get subsequent pages, increment offset by 1 (e.g. 0, 1, 2). The results may overlap across multiple pages.

必填范围: 0 <= x <= 9
operators
boolean
默认值:true

Whether to apply search operators.

示例:

""

true

false

q
string
必填

The user’s search query term. Query can not be empty. Maximum of 400 characters and 50 words in the query.

Required string length: 1 - 400
safesearch
enum<string>
默认值:strict

Filters search results for adult content. The following values are supported:

  • off - No filtering is done.
  • moderate - Filter out explicit content.
  • strict - Filter out explicit and suggestive content.
可用选项:
off,
moderate,
strict
示例:

""

search_lang
enum<string>
默认值:en

The search language preference. The 2 or more character language code for which the search results are provided.

可用选项:
ar,
eu,
bn,
bg,
ca,
zh-hans,
zh-hant,
hr,
cs,
da,
nl,
en,
en-gb,
et,
fi,
fr,
gl,
de,
el,
gu,
he,
hi,
hu,
is,
it,
ja,
jp,
kn,
ko,
lv,
lt,
ms,
ml,
mr,
nb,
pl,
pt-br,
pt-pt,
pa,
ro,
ru,
sr,
sk,
sl,
es,
sv,
ta,
te,
th,
tr,
uk,
vi
spellcheck
boolean
默认值:true

Whether to spell check the provided query. If the spellchecker is enabled, the modified query is always used for search. The modified query can be found in altered key from the query response model.

示例:

""

true

false

ui_lang
enum<string>
默认值:en-US

User interface language preferred in response. Usually of the format <language_code>-<country_code>. For more, see RFC 9110.

可用选项:
es-AR,
en-AU,
de-AT,
nl-BE,
fr-BE,
pt-BR,
en-CA,
fr-CA,
es-CL,
da-DK,
fi-FI,
fr-FR,
de-DE,
el-GR,
zh-HK,
en-IN,
en-ID,
it-IT,
ja-JP,
ko-KR,
en-MY,
es-MX,
nl-NL,
en-NZ,
no-NO,
zh-CN,
pl-PL,
en-PH,
ru-RU,
en-ZA,
es-ES,
sv-SE,
fr-CH,
de-CH,
zh-TW,
tr-TR,
en-GB,
en-US,
es-US

响应

Successful Response

query
Query · object
必填

News search query string.

type
enum<string>
默认值:news
可用选项:
news
Allowed value: "news"
results
NewsResult · object[]

The list of news results for the given query.