Skip to content

📌 Sticky Sessions

Sticky sessions allow you to hold the same residential IP address across multiple requests for a defined period — up to 5 days (120 hours). This is essential for workflows that require session continuity.

How Sticky Sessions Work

When you include a session_ID parameter and a ttl_Xh parameter in your proxy username, the gateway associates all requests using that session ID with the same IP address. As long as the session is active and the TTL has not expired, every request with that session ID will be routed through the same residential IP.

Enabling Sticky Sessions

Add session_YOUR_ID and ttl_Xh to your username:

bash
# Sticky session — same IP for all requests using this session ID (24 hours)
http://pool_category;john;session_mysession01;ttl_24h:pass123@pr.x2proxy.com:2222

# Sticky session with country targeting — US, 48 hours
http://pool_category;john;region_US;session_mysession01;ttl_48h:pass123@pr.x2proxy.com:2222

# Sticky session — UK, maximum duration (5 days)
http://pool_category;john;region_GB;session_london42;ttl_120h:pass123@pr.x2proxy.com:2222

# SOCKS5 sticky session — France, 12 hours
socks5://pool_category;john;region_FR;session_paris01;ttl_12h:pass123@pr.x2proxy.com:2222

Session ID rules:

  • Can contain letters, numbers, and underscores (e.g., session01, user_42abc)
  • Must be unique per session you want to maintain simultaneously
  • The same session ID always resolves to the same IP until the TTL expires or the device goes offline

Session Duration (TTL)

The ttl_ parameter defines how long the session is maintained. Specify the value in hours:

TTL ValueDuration
ttl_1h1 hour
ttl_6h6 hours
ttl_24h1 day
ttl_48h2 days
ttl_72h3 days
ttl_120h5 days (maximum)

After the TTL expires, the next request with that session ID will be assigned a new IP and a new session clock begins.

Combining With Location Targeting

Sticky sessions can be combined with either Country + State + City targeting or Country + ASN targeting — see Geographic Targeting for details.

Pool Selection for Sticky Sessions

For sticky sessions, the Stable Pool is strongly recommended. Devices in this pool remain online consistently, which means your session IP is far less likely to go offline mid-session. Using the Dynamic Pool for sticky sessions carries a higher risk of the IP becoming temporarily unavailable if the underlying device disconnects.

When to Use Sticky Sessions

Use sticky sessions when the target site or workflow requires consistent identity:

  • Account login flows — maintaining a session cookie tied to one IP
  • Multi-step forms — completing checkout or registration over multiple requests
  • Social media automation — managing accounts where IP consistency is critical
  • Testing & QA — reproducing issues tied to a specific IP
  • Platforms with session-based anti-bot — where switching IPs mid-session triggers challenges

Managing Multiple Sessions Simultaneously

You can run multiple sticky sessions in parallel by using different session IDs. Each ID maps to a different residential IP, letting you manage many concurrent accounts or workflows independently.

bash
# Account A — US IP
http://pool_category;john;region_US;session_acc_A;ttl_24h:pass123@pr.x2proxy.com:2222

# Account B — UK IP
http://pool_category;john;region_GB;session_acc_B;ttl_24h:pass123@pr.x2proxy.com:2222

# Account C — Germany IP
http://pool_category;john;region_DE;session_acc_C;ttl_24h:pass123@pr.x2proxy.com:2222

Sticky vs. Rotating: Summary

RotatingSticky
IP changesEvery requestStays the same
Session parameterNot neededsession_ID required
TTL parameterNot neededttl_Xh required
Max durationN/A120h (5 days)
Recommended poolDynamic or StableStable
Best forLarge-scale scraping, distributed tasksLogin flows, account management
Traffic costSame per GBSame per GB

Next: Sub-Accounts