Install, authentication, and troubleshooting for the Bright Data CLI ( bdata) are documented in a single canonical place:
Consult it before any task that shells out to bdata.
Bright Data provides infrastructure for web data extraction at scale. Four primary APIs cover different use cases — always pick the most specific tool for the job.
Use CaseAPIWhyScrape any webpage by URL (no interaction)Web UnlockerHTTP-based, auto-bypasses bot detection, cheapestGoogle / Bing / Yandex search resultsSERP APISpecialized for SERP extraction, returns structured dataStructured data from Amazon, LinkedIn, Instagram, TikTok, etc.Web Scraper APIPre-built scrapers, no parsing neededClick, scroll, fill forms, run JS, intercept XHRBrowser APIFull browser automationPuppeteer / Playwright / Selenium automationBrowser APIConnects via CDP/WebDriver
All APIs share the same authentication model. The env vars below apply to direct REST API integrations — if you are using the bdata CLI, bdata login handles all of these automatically (see references/cli-setup.md).
bash
export BRIGHTDATA_API_KEY="your-api-key" # From Control Panel > Account Settings
export BRIGHTDATA_UNLOCKER_ZONE="zone-name" # Web Unlocker zone name
export BRIGHTDATA_SERP_ZONE="serp-zone-name" # SERP API zone name
export BROWSER_AUTH="brd-customer-ID-zone-NAME:PASSWORD" # Browser API credentials
REST API authentication header for Web Unlocker and SERP API:
text
Authorization: Bearer YOUR_API_KEY
HTTP-based scraping proxy. Best for simple page fetches without browser interaction.
Endpoint: POST https://api.brightdata.com/request
python
import requests
response = requests.post(
"https://api.brightdata.com/request",
headers={"Authorization": f"Bearer {API_KEY}"},
json={
"zone": "YOUR_ZONE_NAME",
"url": "https://example.com/product/123",
"format": "raw"
}
)
html = response.text
ParameterTypeDescriptionzonestringZone name (required)urlstringTarget URL with http:// or https:// (required)formatstring"raw" (HTML) or "json" (structured wrapper) (required)methodstringHTTP verb, default "GET"``countrystring2-letter ISO for geo-targeting (e.g., "us", "de")data_formatstringTransform: "markdown" or "screenshot"``asyncbooleantrue for async mode
python
# Get markdown (best for LLM input)
response = requests.post(
"https://api.brightdata.com/request",
headers={"Authorization": f"Bearer {API_KEY}"},
json={"zone": ZONE, "url": url, "format": "raw", "data_format": "markdown"}
)
# Geo-targeted request
json={"zone": ZONE, "url": url, "format": "raw", "country": "de"}
# Screenshot for debugging
json={"zone": ZONE, "url": url, "format": "raw", "data_format": "screenshot"}
# Async for bulk processing
json={"zone": ZONE, "url": url, "format": "raw", "async": True}
Critical rule: Never use Web Unlocker with Puppeteer, Playwright, Selenium, or anti-detect browsers. Use Browser API instead.
See references/web-unlocker.md for complete reference including proxy interface, special headers, async flow, features, and billing.
Structured search engine result extraction for Google, Bing, Yandex, DuckDuckGo.
Endpoint: POST https://api.brightdata.com/request (same as Web Unlocker)
python
response = requests.post(
"https://api.brightdata.com/request",
headers={"Authorization": f"Bearer {API_KEY}"},
json={
"zone": "YOUR_SERP_ZONE",
"url": "https://www.google.com/search?q=python+web+scraping&brd_json=1&gl=us&hl=en",
"format": "raw"
}
)
data = response.json()
for result in data.get("organic", []):
print(result["rank"], result["title"], result["link"])
ParameterDescriptionExampleqSearch queryq=python+web+scraping``brd_jsonParsed JSON outputbrd_json=1 (always use for data pipelines)glCountry for searchgl=us``hlLanguagehl=en``startPagination offsetstart=10 (page 2), start=20 (page 3)tbmSearch typetbm=nws (news), tbm=isch (images), tbm=vid (videos)brd_mobileDevicebrd_mobile=1 (mobile), brd_mobile=ios``brd_browserBrowserbrd_browser=chrome``brd_ai_overviewTrigger AI Overviewbrd_ai_overview=2``uuleEncoded geo locationfor precise location targeting
Note: num parameter is deprecated as of September 2025. Use start for pagination.
json
{
"organic": [{"rank": 1, "global_rank": 1, "title": "...", "link": "...", "description": "..."}],
"paid": [],
"people_also_ask": [],
"knowledge_graph": {},
"related_searches": [],
"general": {"results_cnt": 1240000000, "query": "..."}
}
ParameterDescriptionqSearch querysetLangLanguage (prefer 4-letter: en-US)ccCountry codefirstPagination (increment by 10: 1, 11, 21...)safesearch``off, moderate, strict``brd_mobileDevice type
python
# Submit
response = requests.post(
"https://api.brightdata.com/request",
params={"async": "1"},
headers={"Authorization": f"Bearer {API_KEY}"},
json={"zone": SERP_ZONE, "url": "https://www.google.com/search?q=test&brd_json=1", "format": "raw"}
)
response_id = response.headers.get("x-response-id")
# Retrieve (retrieve calls are NOT billed)
result = requests.get(
"https://api.brightdata.com/serp/get_result",
params={"response_id": response_id},
headers={"Authorization": f"Bearer {API_KEY}"}
)
Billing: Pay per 1,000 successful requests only. Async retrieve calls are not billed.
See references/serp-api.md for complete reference including Maps, Trends, Reviews, Lens, Hotels, Flights parameters.
Pre-built scrapers for structured data extraction from 100+ platforms. No parsing logic needed.
Sync Endpoint: POST https://api.brightdata.com/datasets/v3/scrape Async Endpoint: POST https://api.brightdata.com/datasets/v3/trigger
python
# Sync (up to 20 URLs, returns immediately)
response = requests.post(
"https://api.brightdata.com/datasets/v3/scrape",
params={"dataset_id": "YOUR_DATASET_ID", "format": "json"},
headers={"Authorization": f"Bearer {API_KEY}"},
json={"input": [{"url": "https://www.amazon.com/dp/B09X7M8TBQ"}]}
)
if response.status_code == 200:
data = response.json() # Results ready
elif response.status_code == 202:
snapshot_id = response.json()["snapshot_id"] # Poll for completion
ParameterTypeDescriptiondataset_idstringScraper identifier from the Scraper Library (required)formatstringjson (default), ndjson, jsonl, csv``custom_output_fieldsstringPipe-separated fields: url|title|price``include_errorsbooleanInclude error info in results
json
{
"input": [
{ "url": "https://www.amazon.com/dp/B09X7M8TBQ" },
{ "url": "https://www.amazon.com/dp/B0B7CTCPKN" }
]
}
python
import time
# Trigger
snapshot_id = requests.post(
"https://api.brightdata.com/datasets/v3/trigger",
params={"dataset_id": DATASET_ID, "format": "json"},
headers={"Authorization": f"Bearer {API_KEY}"},
json={"input": [{"url": u} for u in urls]}
).json()["snapshot_id"]
# Poll
while True:
status = requests.get(
f"https://api.brightdata.com/datasets/v3/progress/{snapshot_id}",
headers={"Authorization": f"Bearer {API_KEY}"}
).json()["status"]
if status == "ready": break
if status == "failed": raise Exception("Job failed")
time.sleep(10)
# Download
data = requests.get(
f"https://api.brightdata.com/datasets/v3/snapshot/{snapshot_id}",
params={"format": "json"},
headers={"Authorization": f"Bearer {API_KEY}"}
).json()
Progress status values: starting → running → ready | failed Data retention: 30 days.
Billing: Per delivered record. Invalid input URLs that fail are still billable.
See references/web-scraper-api.md for complete reference including scraper types, output formats, delivery options, and billing details.
Full browser automation via CDP/WebDriver. Handles CAPTCHA, fingerprinting, and anti-bot detection automatically.
Connection:
wss://${AUTH}@brd.superproxy.io:9222https://${AUTH}@brd.superproxy.io:9515javascript
const { chromium } = require("playwright-core");
const AUTH = process.env.BROWSER_AUTH;
const browser = await chromium.connectOverCDP(`wss://${AUTH}@brd.superproxy.io:9222`);
const page = await browser.newPage();
page.setDefaultNavigationTimeout(120000); // Always set to 2 minutes
await page.goto("https://example.com", { waitUntil: "domcontentloaded" });
const html = await page.content();
await browser.close();
python
from playwright.async_api import async_playwright
async with async_playwright() as p:
browser = await p.chromium.connect_over_cdp(f"wss://{AUTH}@brd.superproxy.io:9222")
page = await browser.new_page()
page.set_default_navigation_timeout(120000)
await page.goto("https://example.com", wait_until="domcontentloaded")
html = await page.content()
await browser.close()
FunctionPurposeCaptcha.solveManually trigger CAPTCHA solvingCaptcha.setAutoSolveEnable/disable auto CAPTCHA solvingProxy.setLocationSet precise geo location (call BEFORE goto)Proxy.useSessionMaintain same IP across sessionsEmulation.setDeviceApply device profile (iPhone 14, etc.)Emulation.getSupportedDevicesList available device profilesUnblocker.enableAdBlockBlock ads to save bandwidthUnblocker.disableAdBlockRe-enable adsInput.typeFast text input for bulk form fillingBrowser.addCertificateInstall client SSL cert for sessionPage.inspectGet DevTools debug URL for live sessionjavascript
// CDP session pattern for custom functions
const client = await page.target().createCDPSession();
// CAPTCHA solve with timeout
const result = await client.send("Captcha.solve", { timeout: 30000 });
// Precise geo location (must be before goto)
await client.send("Proxy.setLocation", {
latitude: 37.7749,
longitude: -122.4194,
distance: 10,
strict: true
});
// Block unnecessary resources
await client.send("Network.setBlockedURLs", { urls: ["*google-analytics*", "*.ads.*"] });
// Device emulation
await client.send("Emulation.setDevice", { deviceName: "iPhone 14" });
-country-us to credentials username-country-eu (routes through 29+ European countries)Proxy.setLocation CDP command (before navigation)CodeIssueFix407Wrong portPlaywright/Puppeteer → 9222, Selenium → 9515``403Bad authCheck credentials format and zone type503Service scalingWait 1 minute, reconnect
Billing: Traffic-based only. Block images/CSS/fonts to reduce costs.
See references/browser-api.md for complete reference including all CDP functions, bandwidth optimization, CAPTCHA patterns, and debugging.