API 文档提供英文版本。

Brave Search

Get Brave web search results.

GET/api/v1/brave/search

Costs 1 credit per request; failed requests are refunded. Authentication, the search_metadata envelope and error codes are the same as for every endpoint (see the API reference). Try it in the playground.

Parameters

Search query

ParameterTypeDescription
qrequiredstringSearch text. Brave query operators are supported; Brave may relax them when there are few matches.Up to 2,048 characters.
offsetintegerZero-based page number, not a result offset. Follow serpfast_pagination.next when present.Default: 0.Range: 0 to 9.Results per page depend on Brave. Organic positions start at 1 within each page.
spellcheckbooleanAllow Brave to correct the query spelling.Default: true.

Localization and filters

ParameterTypeDescription
countrystringTwo-letter country preference, or all for all regions. Brave determines regional availability.Default: us.
ui_langstringInterface language preference such as en-us or de-de. This does not restrict result languages.Default: en-us.
safesearch"off" | "moderate" | "strict"Adult-content filtering preference.Default: moderate.
tf"pd" | "pw" | "pm" | "py"Optional date window: pd for past day, pw for past week, pm for past month, py for past year.

Response

A JSON object with search_metadata (request id, credits used and remaining) and the result data: organic_results. Groups and fields depend on the content of each page, so treat every field as optional.

Examples

cURL
curl "https://serpfast.com/api/v1/brave/search?q=python+programming" \
  -H "Authorization: Bearer $SERPFAST_KEY"
Node.js 18+
const params = new URLSearchParams({
  "q": "python programming"
});
const res = await fetch(`https://serpfast.com/api/v1/brave/search?${params}`, {
  headers: { Authorization: `Bearer ${process.env.SERPFAST_KEY}` },
});
const data = await res.json();
console.log(data);
Python
import os, requests

params = {
  "q": "python programming"
}
res = requests.get(
    "https://serpfast.com/api/v1/brave/search",
    params=params,
    headers={"Authorization": f"Bearer {os.environ['SERPFAST_KEY']}"},
    timeout=120,
)
print(res.json())