Official TypeScript/JavaScript SDK for Bright Data APIs. Currently supports Web Unlocker API.
- 🔓 Web Unlocker API - Bypass anti-bot measures and access any website
- 🛡️ Built-in error handling - Comprehensive error handling and retries
- 📝 TypeScript support - Full TypeScript definitions included
npm install @brightdata/sdk
import { BrightDataClient } from '@brightdata/sdk';
const client = new BrightDataClient('your-api-key', zone: 'web_unlocker1');
async function example() {
try {
const result = await client.webUnlocker.unlock('https://example.com');
console.log(result.content);
} catch (error) {
console.error('Error:', error.message);
}
}
// Simple unlock
const result = await client.webUnlocker.unlock('https://example.com');
// With options
const result = await client.webUnlocker.unlock('https://example.com', {
country: 'US',
format: 'raw',
method: 'GET',
data_format: 'markdown'
});
import { BrightDataError } from '@brightdata/sdk';
try {
const result = await client.webUnlocker.unlock('https://example.com');
} catch (error) {
if (error instanceof BrightDataError) {
console.log('Status Code:', error.statusCode);
console.log('Request ID:', error.requestId);
console.log('Response:', error.response);
}
}