List browser sessions
curl --request GET \
--url https://api.brightdata.com/browser_sessions \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.brightdata.com/browser_sessions"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.brightdata.com/browser_sessions', 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/browser_sessions",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.brightdata.com/browser_sessions"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.brightdata.com/browser_sessions")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.brightdata.com/browser_sessions")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"sessions": [
{
"session_id": "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX",
"api_name": "scraping_browser1",
"status": "finished",
"target_url": "https://www.example.com",
"end_url": "https://www.example.com/example/sub",
"navigations": 4,
"timestamp": "2025-12-16T18:53:41Z",
"duration": 209.444,
"captcha": "solved",
"bandwidth": 123456789,
"error": null
},
{
"session_id": "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX",
"api_name": "scraping_browser1",
"status": "failed",
"target_url": "https://www.another-site.com",
"end_url": "https://www.another-site.com/examplesubdomain",
"navigations": 3,
"timestamp": "2025-12-16T17:20:15Z",
"duration": 45.2,
"captcha": "none",
"bandwidth": 45678901,
"error": {
"code": "unknown",
"message": "Error"
}
},
{
"session_id": "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX",
"api_name": "scraping_browser1",
"status": "running",
"target_url": null,
"end_url": null,
"navigations": 0,
"timestamp": "2025-12-16T19:05:30Z",
"duration": null,
"captcha": "none",
"bandwidth": 0,
"error": null
}
],
"count": 3,
"total": 257,
"pagination": {
"offset": 0,
"limit": 50,
"has_more": true,
"next_offset": 50
}
}浏览器 API
列出浏览器会话
Retrieve a list of browser sessions with filtering and pagination.
GET
/
browser_sessions
List browser sessions
curl --request GET \
--url https://api.brightdata.com/browser_sessions \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.brightdata.com/browser_sessions"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.brightdata.com/browser_sessions', 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/browser_sessions",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.brightdata.com/browser_sessions"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.brightdata.com/browser_sessions")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.brightdata.com/browser_sessions")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"sessions": [
{
"session_id": "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX",
"api_name": "scraping_browser1",
"status": "finished",
"target_url": "https://www.example.com",
"end_url": "https://www.example.com/example/sub",
"navigations": 4,
"timestamp": "2025-12-16T18:53:41Z",
"duration": 209.444,
"captcha": "solved",
"bandwidth": 123456789,
"error": null
},
{
"session_id": "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX",
"api_name": "scraping_browser1",
"status": "failed",
"target_url": "https://www.another-site.com",
"end_url": "https://www.another-site.com/examplesubdomain",
"navigations": 3,
"timestamp": "2025-12-16T17:20:15Z",
"duration": 45.2,
"captcha": "none",
"bandwidth": 45678901,
"error": {
"code": "unknown",
"message": "Error"
}
},
{
"session_id": "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX",
"api_name": "scraping_browser1",
"status": "running",
"target_url": null,
"end_url": null,
"navigations": 0,
"timestamp": "2025-12-16T19:05:30Z",
"duration": null,
"captcha": "none",
"bandwidth": 0,
"error": null
}
],
"count": 3,
"total": 257,
"pagination": {
"offset": 0,
"limit": 50,
"has_more": true,
"next_offset": 50
}
}示例使用 URLs
示例使用 URLs
默认:按时间戳倒序排列的最后 50 个会话
https://api.brightdata.com/browser_sessions
获取前 25 个已完成的会话
https://api.brightdata.com/browser_sessions?limit=25&status=finished
获取所有运行中的会话
https://api.brightdata.com/browser_sessions?status=running
获取所有失败的会话
https://api.brightdata.com/browser_sessions?status=failed
从特定 API 区域获取会话
https://api.brightdata.com/browser_sessions?api_name=scraping_browser1
从特定日期范围获取会话
https://api.brightdata.com/browser_sessions?start_date=2025-12-01T00:00:00Z&end_date=2025-12-16T23:59:59Z
特定目标 URL 的会话,按带宽排序
https://api.brightdata.com/browser_sessions?target_url=example.com&sort=bandwidth&order=desc
特定目标 URL 的所有会话
https://api.brightdata.com/browser_sessions?target_url=amazon.com
特定目标 URL 的失败会话
https://api.brightdata.com/browser_sessions?target_url=linkedin.com&status=failed
按最高带宽排序的会话
https://api.brightdata.com/browser_sessions?sort=bandwidth&order=desc
按最长持续时间排序的会话
https://api.brightdata.com/browser_sessions?sort=duration&order=desc
第一页(100 个会话)
https://api.brightdata.com/browser_sessions?limit=100&offset=0
第二页(接下来的 100 个会话)
https://api.brightdata.com/browser_sessions?limit=100&offset=100
授权
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
查询参数
Name of the Browser API used
Number of sessions to return
必填范围:
x <= 100Pagination offset
Filter by session status
可用选项:
running, finished, failed, all Start date filter
End date filter
Filter by target url (e.g., example.com)
Filter by end url (e.g., https://www.example.com/example/sub)
Sort field: timestamp, duration, bandwidth
可用选项:
timestamp, duration, bandwidth Sort order: asc or desc
可用选项:
asc, desc 此页面对您有帮助吗?