Run a search
curl --request POST \
--url https://api.brightdata.com/webarchive/search \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"filters": {
"max_age": "24h",
"domain_whitelist": [
"example.com"
],
"domain_like_whitelist": [
"%.example.%",
"example%"
],
"domain_regex_whitelist": [
".*example..*"
],
"category_whitelist": [
"Motor Vehicles"
],
"url_like_whitelist": [
"%/products/%",
"%/search%"
],
"url_regex_whitelist": [
".*/products/.*"
],
"language_whitelist": [
"eng"
],
"ip_country_whitelist": [
"us",
"ie",
"in"
],
"captcha": true,
"robots_block": true
}
}
'import requests
url = "https://api.brightdata.com/webarchive/search"
payload = { "filters": {
"max_age": "24h",
"domain_whitelist": ["example.com"],
"domain_like_whitelist": ["%.example.%", "example%"],
"domain_regex_whitelist": [".*example..*"],
"category_whitelist": ["Motor Vehicles"],
"url_like_whitelist": ["%/products/%", "%/search%"],
"url_regex_whitelist": [".*/products/.*"],
"language_whitelist": ["eng"],
"ip_country_whitelist": ["us", "ie", "in"],
"captcha": True,
"robots_block": True
} }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
filters: {
max_age: '24h',
domain_whitelist: ['example.com'],
domain_like_whitelist: ['%.example.%', 'example%'],
domain_regex_whitelist: ['.*example..*'],
category_whitelist: ['Motor Vehicles'],
url_like_whitelist: ['%/products/%', '%/search%'],
url_regex_whitelist: ['.*/products/.*'],
language_whitelist: ['eng'],
ip_country_whitelist: ['us', 'ie', 'in'],
captcha: true,
robots_block: true
}
})
};
fetch('https://api.brightdata.com/webarchive/search', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.brightdata.com/webarchive/search",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'filters' => [
'max_age' => '24h',
'domain_whitelist' => [
'example.com'
],
'domain_like_whitelist' => [
'%.example.%',
'example%'
],
'domain_regex_whitelist' => [
'.*example..*'
],
'category_whitelist' => [
'Motor Vehicles'
],
'url_like_whitelist' => [
'%/products/%',
'%/search%'
],
'url_regex_whitelist' => [
'.*/products/.*'
],
'language_whitelist' => [
'eng'
],
'ip_country_whitelist' => [
'us',
'ie',
'in'
],
'captcha' => true,
'robots_block' => true
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.brightdata.com/webarchive/search"
payload := strings.NewReader("{\n \"filters\": {\n \"max_age\": \"24h\",\n \"domain_whitelist\": [\n \"example.com\"\n ],\n \"domain_like_whitelist\": [\n \"%.example.%\",\n \"example%\"\n ],\n \"domain_regex_whitelist\": [\n \".*example..*\"\n ],\n \"category_whitelist\": [\n \"Motor Vehicles\"\n ],\n \"url_like_whitelist\": [\n \"%/products/%\",\n \"%/search%\"\n ],\n \"url_regex_whitelist\": [\n \".*/products/.*\"\n ],\n \"language_whitelist\": [\n \"eng\"\n ],\n \"ip_country_whitelist\": [\n \"us\",\n \"ie\",\n \"in\"\n ],\n \"captcha\": true,\n \"robots_block\": true\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.brightdata.com/webarchive/search")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"filters\": {\n \"max_age\": \"24h\",\n \"domain_whitelist\": [\n \"example.com\"\n ],\n \"domain_like_whitelist\": [\n \"%.example.%\",\n \"example%\"\n ],\n \"domain_regex_whitelist\": [\n \".*example..*\"\n ],\n \"category_whitelist\": [\n \"Motor Vehicles\"\n ],\n \"url_like_whitelist\": [\n \"%/products/%\",\n \"%/search%\"\n ],\n \"url_regex_whitelist\": [\n \".*/products/.*\"\n ],\n \"language_whitelist\": [\n \"eng\"\n ],\n \"ip_country_whitelist\": [\n \"us\",\n \"ie\",\n \"in\"\n ],\n \"captcha\": true,\n \"robots_block\": true\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.brightdata.com/webarchive/search")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"filters\": {\n \"max_age\": \"24h\",\n \"domain_whitelist\": [\n \"example.com\"\n ],\n \"domain_like_whitelist\": [\n \"%.example.%\",\n \"example%\"\n ],\n \"domain_regex_whitelist\": [\n \".*example..*\"\n ],\n \"category_whitelist\": [\n \"Motor Vehicles\"\n ],\n \"url_like_whitelist\": [\n \"%/products/%\",\n \"%/search%\"\n ],\n \"url_regex_whitelist\": [\n \".*/products/.*\"\n ],\n \"language_whitelist\": [\n \"eng\"\n ],\n \"ip_country_whitelist\": [\n \"us\",\n \"ie\",\n \"in\"\n ],\n \"captcha\": true,\n \"robots_block\": true\n }\n}"
response = http.request(request)
puts response.read_body{
"search_id": "ucd_abc123xyz"
}Archive API
运行搜索
使用 Bright Data Marketplace Archive API 运行搜索。POST /webarchive/search 管理网页存档快照,返回 200 OK 及 JSON 状态。
POST
/
webarchive
/
search
Run a search
curl --request POST \
--url https://api.brightdata.com/webarchive/search \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"filters": {
"max_age": "24h",
"domain_whitelist": [
"example.com"
],
"domain_like_whitelist": [
"%.example.%",
"example%"
],
"domain_regex_whitelist": [
".*example..*"
],
"category_whitelist": [
"Motor Vehicles"
],
"url_like_whitelist": [
"%/products/%",
"%/search%"
],
"url_regex_whitelist": [
".*/products/.*"
],
"language_whitelist": [
"eng"
],
"ip_country_whitelist": [
"us",
"ie",
"in"
],
"captcha": true,
"robots_block": true
}
}
'import requests
url = "https://api.brightdata.com/webarchive/search"
payload = { "filters": {
"max_age": "24h",
"domain_whitelist": ["example.com"],
"domain_like_whitelist": ["%.example.%", "example%"],
"domain_regex_whitelist": [".*example..*"],
"category_whitelist": ["Motor Vehicles"],
"url_like_whitelist": ["%/products/%", "%/search%"],
"url_regex_whitelist": [".*/products/.*"],
"language_whitelist": ["eng"],
"ip_country_whitelist": ["us", "ie", "in"],
"captcha": True,
"robots_block": True
} }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
filters: {
max_age: '24h',
domain_whitelist: ['example.com'],
domain_like_whitelist: ['%.example.%', 'example%'],
domain_regex_whitelist: ['.*example..*'],
category_whitelist: ['Motor Vehicles'],
url_like_whitelist: ['%/products/%', '%/search%'],
url_regex_whitelist: ['.*/products/.*'],
language_whitelist: ['eng'],
ip_country_whitelist: ['us', 'ie', 'in'],
captcha: true,
robots_block: true
}
})
};
fetch('https://api.brightdata.com/webarchive/search', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.brightdata.com/webarchive/search",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'filters' => [
'max_age' => '24h',
'domain_whitelist' => [
'example.com'
],
'domain_like_whitelist' => [
'%.example.%',
'example%'
],
'domain_regex_whitelist' => [
'.*example..*'
],
'category_whitelist' => [
'Motor Vehicles'
],
'url_like_whitelist' => [
'%/products/%',
'%/search%'
],
'url_regex_whitelist' => [
'.*/products/.*'
],
'language_whitelist' => [
'eng'
],
'ip_country_whitelist' => [
'us',
'ie',
'in'
],
'captcha' => true,
'robots_block' => true
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.brightdata.com/webarchive/search"
payload := strings.NewReader("{\n \"filters\": {\n \"max_age\": \"24h\",\n \"domain_whitelist\": [\n \"example.com\"\n ],\n \"domain_like_whitelist\": [\n \"%.example.%\",\n \"example%\"\n ],\n \"domain_regex_whitelist\": [\n \".*example..*\"\n ],\n \"category_whitelist\": [\n \"Motor Vehicles\"\n ],\n \"url_like_whitelist\": [\n \"%/products/%\",\n \"%/search%\"\n ],\n \"url_regex_whitelist\": [\n \".*/products/.*\"\n ],\n \"language_whitelist\": [\n \"eng\"\n ],\n \"ip_country_whitelist\": [\n \"us\",\n \"ie\",\n \"in\"\n ],\n \"captcha\": true,\n \"robots_block\": true\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.brightdata.com/webarchive/search")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"filters\": {\n \"max_age\": \"24h\",\n \"domain_whitelist\": [\n \"example.com\"\n ],\n \"domain_like_whitelist\": [\n \"%.example.%\",\n \"example%\"\n ],\n \"domain_regex_whitelist\": [\n \".*example..*\"\n ],\n \"category_whitelist\": [\n \"Motor Vehicles\"\n ],\n \"url_like_whitelist\": [\n \"%/products/%\",\n \"%/search%\"\n ],\n \"url_regex_whitelist\": [\n \".*/products/.*\"\n ],\n \"language_whitelist\": [\n \"eng\"\n ],\n \"ip_country_whitelist\": [\n \"us\",\n \"ie\",\n \"in\"\n ],\n \"captcha\": true,\n \"robots_block\": true\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.brightdata.com/webarchive/search")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"filters\": {\n \"max_age\": \"24h\",\n \"domain_whitelist\": [\n \"example.com\"\n ],\n \"domain_like_whitelist\": [\n \"%.example.%\",\n \"example%\"\n ],\n \"domain_regex_whitelist\": [\n \".*example..*\"\n ],\n \"category_whitelist\": [\n \"Motor Vehicles\"\n ],\n \"url_like_whitelist\": [\n \"%/products/%\",\n \"%/search%\"\n ],\n \"url_regex_whitelist\": [\n \".*/products/.*\"\n ],\n \"language_whitelist\": [\n \"eng\"\n ],\n \"ip_country_whitelist\": [\n \"us\",\n \"ie\",\n \"in\"\n ],\n \"captcha\": true,\n \"robots_block\": true\n }\n}"
response = http.request(request)
puts response.read_body{
"search_id": "ucd_abc123xyz"
}POST /webarchive/search 搜索 Bright Data Archive,返回完整的搜索结果对象或用于轮询状态的 search_id。
每次搜索都必须指定时间范围。
filters 对象为必填项,其中必须包含 max_age,或者同时包含 min_date 和 max_date。缺少 filters 对象的请求会返回 HTTP 400 及 "filters" is required。如何设置搜索时间范围
使用max_age 指定相对于当前时间的时间窗口。Bright Data 建议首次搜索时使用 max_age = 24h,因为最新数据的交付速度最快。
curl -X POST https://api.brightdata.com/webarchive/search \
-H "Authorization: Bearer <YOUR_API_KEY>" \
-H "Content-Type: application/json" \
-d '{
"filters": {
"max_age": "24h",
"domain_whitelist": ["example.com"]
}
}'
min_date 和 max_date 指定固定的日历范围。两个日期均采用 YYYY-MM-DD 格式,且必须同时提供。请勿在同一请求中将它们与 max_age 一起使用。
curl -X POST https://api.brightdata.com/webarchive/search \
-H "Authorization: Bearer <YOUR_API_KEY>" \
-H "Content-Type: application/json" \
-d '{
"filters": {
"min_date": "2026-08-01",
"max_date": "2026-08-08",
"domain_whitelist": ["example.com"]
}
}'
min_date 和 max_date,而不是 max_age。有关请求范围如何影响交付速度,请参阅数据范围与交付时间。
如果搜索耗时超过 30 秒,响应将仅返回
search_id,您应该异步轮询状态。如果搜索在 30 秒内完成,响应将返回完整的搜索结果对象(与 GET /webarchive/search/<search_id> 相同)。您每天可以运行最多 100 次搜索而不触发转储。
触发转储后,该搜索将不再计入您的限制。
LIKE 与正则表达式过滤器
LIKE 与正则表达式过滤器
- 对于简单的模式匹配,使用 LIKE 过滤器(
domain_like_*、url_like_*),其中%表示任意序列,_表示单个字符。 - LIKE 模式不区分大小写,对于简单的前缀/后缀匹配(如
%.com或amazon%)通常比正则表达式更快。 - 对于需要完整正则表达式语法的复杂模式,使用正则表达式过滤器(
domain_regex_*、url_regex_*)。LIKE 模式使用反斜杠转义:\%表示字面上的%,\_表示字面上的_。
授权
Use your Bright Data API Key as a Bearer token in the Authorization header.
How to authenticate:
- Obtain your API Key from the Bright Data account settings at https://brightdata.com/cp/setting/users
- Include the API Key in the Authorization header of your requests
- Format:
Authorization: Bearer YOUR_API_KEY
Example:
Authorization: Bearer b5648e1096c6442f60a6c4bbbe73f8d2234d3d8324554bd6a7ec8f3f251f07df
Learn how to get your Bright Data API key: https://docs.brightdata.com/api-reference/authentication
请求体
application/json
Filters that scope the search. The filters object is required, and it must carry a time range: either max_age, or both min_date and max_date.
Show child attributes
Show child attributes
响应
Search initiated successfully
- Async (Still Running)
- Completed within 30s
Returned if search is async
示例:
"ucd_abc123xyz"
此页面对您有帮助吗?
⌘I