Scrapingbypass Node.js SDK

The Scrapingbypass Node.js SDK is built on top of Axios, providing a familiar interface for developers while adding specialized support for automated WAF bypass, cross-origin requests, and integrated session management.

Installation

Install the SDK using your preferred package manager:

# Using npm
$ npm install scrapingbypass-sdk

# Using yarn
$ yarn add scrapingbypass-sdk

# Using pnpm
$ pnpm add scrapingbypass-sdk

Getting Started

You can import the library using CommonJS or ES Modules:

// ES6 Modules
import scrapingbypass from 'scrapingbypass-sdk';

// CommonJS
// const scrapingbypass = require('scrapingbypass-sdk');

Making Requests

The SDK inherits all standard Axios configurations. Use the following custom properties to interface with the Scrapingbypass engine:

  • cb_apikey: Your service API key.
  • cb_part: Required for V2 requests to handle JS challenges.
  • cb_proxy: Proxy URL (supports HTTP and SOCKS5).
  • cb_apihost: Custom API endpoint for enterprise users.

Tip: You can also configure these via environment variables: CB_APIKEY, CB_PROXY, and CB_APIHOST.

Basic GET Request

scrapingbypass.get('https://example.com', {
    cb_apikey: 'YOUR_API_KEY'
})
    .then(response => {
        console.log("Status:", response.status);
        console.log("Bypass Status:", response.headers.get("x-cb-status"));
        console.log(response.data);
    })
    .catch(error => {
        console.error(error.response?.data || error.message);
    });

Using V2 (JS/Turnstile Challenge)

For websites protected by advanced JS challenges or Turnstile (e.g., Etherscan), set the cb_part parameter:

scrapingbypass.get('https://etherscan.io/accounts/label/lido', {
    cb_apikey: 'YOUR_API_KEY',
    cb_part: '0',
    cb_proxy: 'http://user:pass@proxy_host:port'
})
    .then(response => {
        console.log("Status:", response.status);
        console.log(response.data);
    });

Account and Balance

Check your remaining credit balance programmatically:

scrapingbypass.getBalance('YOUR_API_KEY')
    .then(balance => console.log("Current Balance:", balance))
    .catch(err => console.error(err));

Proxy Management

The scrapingbypass.createProxy(auth: string) method initializes a ScrapingbypassProxy instance for managing dynamic and sticky (TTL-based) residential ISP proxies.

MethodDescription
copy()Clones the current proxy instance to prevent state mutation.
setDynamic()Configures the instance for dynamic rotating IPs.
setExpire(sec)Configures a sticky IP with a specific expiration time (seconds).
setRegion(code)Sets the target ISO country code (e.g., "US", "RU").
toString()Returns the formatted proxy string.
limit(count)Returns an iterator for a specific number of proxy strings.

Proxy Example

const proxy = scrapingbypass.createProxy("username:password");

// Extract a dynamic US-based proxy
const dynamicProxy = proxy.setDynamic().setRegion("US").toString();

// Extract 5 sticky proxies (10-minute duration)
const pool = proxy.copy().setExpire(600).limit(5);
for (let p of pool) {
    console.log(p);
}

Technical Notes

  • Redirection: The SDK handles HTTP redirects (301/302) automatically. Note that each hop in a redirect chain that requires a bypass will consume credits.
  • Authentication: Retrieve your API Key from the Scrapingbypass Dashboard.
  • Automation: Redirects and session persistence are managed natively to ensure JA3/HTTP2 fingerprint consistency across the request lifecycle.