Scrapingbypass NodeJS API Documentation

Overview

Scrapingbypass API enables seamless automation by solving Cloudflare WAF, Turnstile, and JavaScript challenges. This documentation covers the implementation of the HTTPS API and session management via the SDK.

Endpoint Configuration

The API operates over HTTPS and supports all standard HTTP methods. Route your requests through the following gateway:

  • Gateway URL: https://api.scrapingbypass.com

Required Request Headers

To authenticate and route your traffic, the following headers are mandatory:

HeaderDescription
x-cb-apikeyYour unique API key.
x-cb-hostThe target server hostname (e.g., for https://example.com/path, use example.com).
x-cb-proxyProxy server address. Required for V2; optional for V1.

API Version Logic

V1: Stateless Requests

  • Proxying: Uses a default dynamic proxy pool unless specified via x-cb-proxy.
  • State: Each request is independent (stateless). Ideal for simple scraping tasks.

V2: Stateful Challenge Solving

  • Proxying: Mandatory. You must provide a static or time-limited residential/ISP proxy.
  • JS Challenge Automation: The engine automatically detects and solves Cloudflare JS challenges.
  • Session Persistence: Upon a successful solve, the system caches the Cloudflare session for 10 minutes. Subsequent requests using the same parameters reuse this session and automatically extend the expiration.
  • Isolation: Use the x-cb-part header to create session partitions, allowing you to manage multiple isolated browser contexts simultaneously.

Implementation Example (NodeJS)

To integrate the API using standard libraries like axios or node-fetch, follow this structure:

const axios = require('axios');

const config = {
  method: 'get',
  url: 'https://api.scrapingbypass.com/your-endpoint',
  headers: { 
    'x-cb-apikey': 'YOUR_API_KEY', 
    'x-cb-host': 'target-website.com', 
    'x-cb-proxy': 'http://user:pass@proxy-ip:port', // Required for V2
    'x-cb-part': '0' // Session partition for V2
  }
};

axios(config)
  .then(response => console.log(JSON.stringify(response.data)))
  .catch(error => console.log(error));

Reference Documentation

For complete SDK methods and advanced configurations, visit the official developer portal:
https://docs.scrapingbypass.com