跳转到主要内容
POST
/
request
cURL
curl --request POST \
  --url https://api.brightdata.com/request \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "zone": "serp_api1",
  "url": "https://www.google.com/search?q=pizza",
  "format": "json",
  "method": "GET",
  "country": "us",
  "data_format": "markdown"
}
'
"OK"
相关指南:SERP API Introduction

Bright Data Python SDK

要快速开始使用我们的工具,请查看我们的新 Python SDK。

Authorizations

Authorization
string
header
required

在 Authorization 头中使用您的 Bright Data API Key 作为 Bearer token。

认证方法:

  1. 从 Bright Data 账户设置获取您的 API Key: https://brightdata.com/cp/setting/users
  2. 在请求的 Authorization 头中包含 API Key
  3. 格式: Authorization: Bearer YOUR_API_KEY

示例:

Authorization: Bearer b5648e1096c6442f60a6c4bbbe73f8d2234d3d8324554bd6a7ec8f3f251f07df

了解如何获取 Bright Data API Key: https://docs.brightdata.com/cn/api-reference/authentication#如何生成新的-api-key?

Query Parameters

async
boolean

设置为 true 以异步执行

Body

application/json
zone
string
required

区域标识符,用于定义您的 Bright Data 产品配置。每个区域包含目标规则、输出偏好和访问权限。 管理区域: https://brightdata.com/cp/zones

Example:

"serp_api1"

url
string
required

要抓取的完整目标 URL。必须包含协议(http/https),并可公开访问。

Example:

"https://www.google.com/search?q=pizza"

format
enum<string>
required

响应格式:raw 返回 HTML 字符串,json 返回结构化数据。

可用选项:
raw,
json
Example:

"json"

method
string
default:GET

通过代理请求 HTML 的方法为 GET

Example:

"GET"

country
string

用于代理位置的两位 ISO 3166-1 国家代码(如 usgbdecaau)。如果未指定,系统会根据区域配置自动选择最佳位置。 国家代码列表: https://docs.brightdata.com/cn/general/faqs#where-can-i-see-the-list-of-country-codes

Example:

"us"

data_format
enum<string>

附加响应格式转换:markdown 将 HTML 转为干净的 Markdown,screenshot 截取页面 PNG 图片。

可用选项:
markdown,
screenshot
Example:

"markdown"

Response

OK

The response is of type string.

Example:

"OK"