Scrapingbypass Go API Documentation

Overview

Scrapingbypass enables seamless automation by solving Cloudflare mechanisms, including WAF, Turnstile, and JavaScript challenges. This documentation covers the implementation of the HTTPS API, local proxy tools, and SDK integration.

Endpoint Configuration

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

https://api.scrapingbypass.com

Required Request Headers

To authenticate and route your traffic, include these mandatory headers:

  • x-cb-apikey: Your unique API secret key.
  • x-cb-host: The target server hostname or IP. For example, if accessing https://www.example.com/path, set this to www.example.com.
  • x-cb-proxy: Proxy server configuration.
    • V1: Uses internal dynamic residential proxies by default but accepts external proxy strings.
    • V2: Requires a dedicated static or time-sensitive ISP proxy to function.

Version Logic and Session Persistence

V1: Stateless Requests

V1 is designed for high-concurrency, stateless operations. Each request is independent. While it supports external proxies, it is optimized for rapid data collection where session persistence is not a priority.

V2: Automated Browser Impersonation

V2 is required for bypassing advanced Cloudflare JS challenges. It operates on a stateful model:

  • Challenge Solving: When a JS challenge is detected, the V2 engine automatically executes the challenge script.
  • Session Management: Upon success, the session (including cookies and clearance tokens) is cached for 10 minutes.
  • Auto-Renewal: Subsequent requests within the 10-minute window reuse the established session. Every successful request resets the 10-minute expiry timer.
  • Session Isolation: Use the x-cb-part parameter to create distinct session partitions, allowing you to manage multiple independent account sessions simultaneously.

Quick Start Example (Go)

package main

import (
    "fmt"
    "io/ioutil"
    "net/http"
)

func main() {
    client := &http.Client{}
    req, _ := http.NewRequest("GET", "https://api.scrapingbypass.com/endpoint", nil)

    // Set required headers
    req.Header.Set("x-cb-apikey", "YOUR_API_KEY")
    req.Header.Set("x-cb-host", "www.target-website.com")
    req.Header.Set("x-cb-proxy", "http://user:pass@proxy-ip:port")

    // Optional: Session partition for V2
    req.Header.Set("x-cb-part", "session_01")

    resp, err := client.Do(req)
    if err != nil {
        fmt.Println("Error:", err)
        return
    }
    defer resp.Body.Close()

    body, _ := ioutil.ReadAll(resp.Body)
    fmt.Printf("Status: %s\nBody: %s\n", resp.Status, string(body))
}

Technical Resources

For advanced SDK integration and detailed parameter definitions, refer to the official developer portal: https://docs.scrapingbypass.com