Session Management and x-cb-part Usage

Proxy and Session Binding

When a request succeeds using Scrapingbypass API V2, the proxy IP and the session partition (x-cb-part) are bound together for 10 minutes. This mechanism "locks" the session state to that specific IP to ensure stable bypass performance.

  • Session Refresh: Every successful request resets the 10-minute timer.
  • Proxy Consistency: You cannot change the proxy IP within an active session unless you switch the session partition.
  • Mandatory Synchronization: If your logic rotates the proxy IP, you must rotate the x-cb-part value simultaneously.

x-cb-part Configurations

The header x-cb-part determines how session cookies are stored and managed:

ConfigurationStorage LocationBehavior
Set x-cb-partServer-sideCookies are stored on the server. The proxy IP acts as the access key. Matching the proxy and partition avoids re-validation.
Unset x-cb-partClient-sideCookies are encrypted and returned to the client. The client is responsible for maintaining and sending cookies in subsequent requests.

Advanced Session Control

  • Partition Range: Valid values for x-cb-part range from 0 to 999 (1,000 total partitions).
  • Forcing Proxy Changes: If you need to exceed 1,000 concurrent sessions or rotate proxies within an active partition, use the header x-cb-options: Force.
    • Note: Using Force allows unmatching proxies to access a partition but may trigger re-validation (JS challenges).
  • Cookie Handling: V2 does not return Cloudflare-specific cookies (such as cf_clearance) to the client. All challenge resolution is handled internally by the Scrapingbypass API engine.

Implementation Best Practices

  1. Maintain State: To minimize credit consumption and latency, reuse the same proxy and x-cb-part for the duration of your task.
  2. Immediate Rotation: If an immediate proxy change is required before the 10-minute window expires, switch to a different x-cb-part value.
  3. Concurrency: Distribute high-concurrency tasks across different partitions to avoid session interference.