Overview
Scrapingbypass API enables seamless automation through Cloudflare’s WAF and Turnstile challenges. This documentation covers the implementation of the HTTP API and SDK, focusing on endpoint configuration, required headers, and session management.
Endpoint Configuration
The API utilizes the HTTPS protocol and supports all standard HTTP methods. Route your requests through the following gateway:
Base URL: https://api.scrapingbypass.com
Required Request Headers
To authenticate and route your traffic correctly, the following headers must be included in every request:
| Header | Description |
|---|---|
x-cb-apikey | Your unique API key for authentication. |
x-cb-host | The target server hostname (e.g., if accessing https://www.example.com/path, use www.example.com). |
x-cb-proxy | Proxy server configuration. See version specifics below. |
Version Logic and Proxy Management
V1: Stateless Requests
- Behavior: Every request is independent and stateless.
- Proxy: V1 uses a default dynamic proxy pool. You may optionally use the
x-cb-proxyheader to specify a custom proxy server.
V2: Stateful Sessions & Challenge Solving
- Behavior: Automatically handles Cloudflare JS challenges. Upon a successful solve, the session is persisted for 10 minutes. Subsequent requests within this window reuse the session and automatically extend the expiry.
- Proxy Requirement: You must provide a static or time-sensitive residential/ISP proxy via the
x-cb-proxyheader. - Session Isolation: Use the
x-cb-partparameter to create distinct session partitions, allowing for parallel session management without crosstalk.
Java Implementation Example
Ensure you have an HTTP client (like OkHttp or Apache HttpClient) configured to handle TLS/JA3 impersonation where necessary.
// Example using OkHttp for a V2 request
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("https://api.scrapingbypass.com/target-path")
.addHeader("x-cb-apikey", "YOUR_API_KEY")
.addHeader("x-cb-host", "www.target-website.com")
.addHeader("x-cb-proxy", "http://user:pass@proxy-ip:port")
.addHeader("x-cb-part", "0") // Session partition
.get()
.build();
try (Response response = client.newCall(request).execute()) {
System.out.println("Status Code: " + response.code());
System.out.println("Response Body: " + response.body().string());
}
Reference Links
- Official SDK & Quickstart: https://docs.scrapingbypass.com/#/en/quickstart
- Technical Support: Access the dashboard for real-time credit monitoring and log analysis.