Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.brightdata.com/llms.txt

Use this file to discover all available pages before exploring further.

This guide shows how to install the Bright Data JavaScript SDK, scrape URLs, run searches, call platform-specific scrapers (LinkedIn, Amazon, Instagram, and more), and connect to the Browser API and Scraper Studio from Node.js.

Install the package

Open the terminal and run:
npm install @brightdata/sdk
In your code file, import the package and launch your first requests:
import { bdclient } from '@brightdata/sdk';

const client = new bdclient({ apiKey: 'YOUR_API_KEY' });

const html = await client.scrapeUrl('https://example.com');
const google = await client.search.google('pizza restaurants');

console.log(google);
await client.close();

Launch scrapes and web searches

import { bdclient } from '@brightdata/sdk';

const client = new bdclient({ apiKey: 'YOUR_API_KEY' });

const google = await client.search.google('best laptops 2026');
const bing = await client.search.bing('python tutorial');
const yandex = await client.search.yandex('AI news');

console.log({ google, bing, yandex });
await client.close();

Platform scrapers and datasets

Collect data from popular platforms by URL, or discover content by parameters.
import { bdclient } from '@brightdata/sdk';

const client = new bdclient({ apiKey: 'YOUR_API_KEY' });

// Collect by URL
const profiles = await client.scrape.linkedin.collectProfiles([
    'https://www.linkedin.com/in/satyanadella/',
]);
const companies = await client.scrape.linkedin.collectCompanies([
    'https://www.linkedin.com/company/bright-data',
]);
const jobs = await client.scrape.linkedin.collectJobs([
    'https://www.linkedin.com/jobs/view/123456',
]);
const posts = await client.scrape.linkedin.collectPosts([
    'https://www.linkedin.com/feed/update/urn:li:activity:123',
]);

// Discover by parameters
const byKeyword = await client.scrape.linkedin.discoverJobs(
    [{ keyword: 'python developer', location: 'New York', remote: true }],
    {}
);
const byName = await client.scrape.linkedin.discoverProfiles(
    [{ firstName: 'John', lastName: 'Doe' }],
    {}
);
const compPosts = await client.scrape.linkedin.discoverCompanyPosts(
    [{ url: 'https://www.linkedin.com/company/bright-data' }],
    {}
);
const userPosts = await client.scrape.linkedin.discoverUserPosts(
    [{ url: 'https://www.linkedin.com/in/satyanadella' }],
    {}
);

Discover API

Search the web and get AI-ranked results in one call, or trigger and poll manually.
// One-shot: searches, polls, and returns AI-ranked results
const result = await client.discover('AI trends 2026', {
    intent: 'latest technology developments',
});
// result.data is [{ title, link, description, relevance_score }]

// Manual: trigger, wait, and fetch
const job = await client.discoverTrigger('SaaS pricing', {
    intent: 'competitor pricing strategies',
});
await job.wait({ timeout: 60_000 });
const data = await job.fetch();

Scraper Studio

Run your custom Scraper Studio collectors from the SDK.
// Run and get results in one call
const results = await client.scraperStudio.run('c_your_collector_id', {
    input: { url: 'https://example.com/product/1' },
});
// results is [{ input, data, error, responseId, elapsedMs }]

// Manual: trigger, wait, and fetch
const job = await client.scraperStudio.trigger('c_your_collector_id', {
    url: 'https://example.com/product/1',
});
const data = await job.waitAndFetch();

// Check status
const status = await client.scraperStudio.status('j_abc123');
// status.status is 'queued' | 'running' | 'done' | 'failed'

Browser API

Connect Playwright to Bright Data’s cloud browser.
import { bdclient } from '@brightdata/sdk';
import { chromium } from 'playwright';

const client = new bdclient({
    apiKey: 'YOUR_API_KEY',
    browserUsername: 'brd-customer-xxxx-zone-scraping_browser1',
    browserPassword: 'YOUR_ZONE_PASSWORD',
});

const browser = await chromium.connectOverCDP(client.browser.getConnectUrl());
const page = await browser.newPage();
await page.goto('https://example.com');
await browser.close();
await client.close();

Datasets API

Query and download from any of the 126+ Bright Data datasets.
const ds = client.datasets;

// Query, then download
const snapshotId = await ds.instagramProfiles.query(
    { url: 'https://www.instagram.com/natgeo/' },
    { records_limit: 10 }
);
const rows = await ds.instagramProfiles.download(snapshotId);

// Same pattern across the full catalog
await ds.amazonProducts.query({ url: 'https://amazon.com/dp/B123' });
await ds.linkedinProfiles.query({ url: 'https://linkedin.com/in/johndoe' });
await ds.imdbMovies.query({}, { records_limit: 50 });
await ds.redditPosts.query({ subreddit: 'technology' });
await ds.glassdoorReviews.query({ company: 'Bright Data' });

// Get field metadata
const meta = await ds.instagramProfiles.getMetadata();

Client and method parameters

ParameterTypeDescriptionDefault
apiKeystringYour API key (or BRIGHTDATA_API_KEY env var).
autoCreateZonesbooleanAuto-create zones if they do not existtrue
webUnlockerZonestringCustom Web Unlocker zone name.
serpZonestringCustom SERP zone name.
browserUsernamestringBrowser API username (or BRIGHTDATA_BROWSERAPI_USERNAME env var).
browserPasswordstringBrowser API password (or BRIGHTDATA_BROWSERAPI_PASSWORD env var).
logLevelstringLog level'INFO'
structuredLoggingbooleanUse structured JSON loggingtrue
verbosebooleanEnable verbose loggingfalse
const client = new bdclient({
    apiKey: 'YOUR_API_KEY',
    autoCreateZones: true,
    webUnlockerZone: 'unlocker_zone1',
    serpZone: 'serp_zone1',
    browserUsername: 'brd-customer-xxxx-zone-scraping_browser1',
    browserPassword: 'YOUR_ZONE_PASSWORD',
    logLevel: 'INFO',
    structuredLogging: true,
    verbose: false,
});
Scrape a single URL or list of URLs using the Web Unlocker API.
NameTypeDescriptionDefault
urlstring | string[]Single URL string or array of URLs.
options.zonestringZone identifier (auto-configured if null).
options.format'json' | 'raw'Response format'raw'
options.methodstringHTTP method'GET'
options.countrystringTwo-letter country code''
options.dataFormat'markdown' | 'screenshot' | 'html'Returned content format'html'
options.concurrencynumberMax parallel workers10
options.timeoutnumber (ms)Request timeout30000
NameTypeDescriptionDefault
contentanyContent to save.
options.filenamestringOutput filename (auto-generated if null).
options.format'json' | 'csv' | 'txt'File format.

Error handling

Enable VERBOSE in the Client for advanced logging (see Client parameters). Use the listZones() function to check available zones.
Create a Bright Data account and copy your API key. Go to account settings and make sure your API key has admin permissions.

Resources

GitHub

Visit the Bright Data SDK GitHub repository