📌 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:
# 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:2222Session 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 Value | Duration |
|---|---|
ttl_1h | 1 hour |
ttl_6h | 6 hours |
ttl_24h | 1 day |
ttl_48h | 2 days |
ttl_72h | 3 days |
ttl_120h | 5 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.
# 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:2222Sticky vs. Rotating: Summary
| Rotating | Sticky | |
|---|---|---|
| IP changes | Every request | Stays the same |
| Session parameter | Not needed | session_ID required |
| TTL parameter | Not needed | ttl_Xh required |
| Max duration | N/A | 120h (5 days) |
| Recommended pool | Dynamic or Stable | Stable |
| Best for | Large-scale scraping, distributed tasks | Login flows, account management |
| Traffic cost | Same per GB | Same per GB |
Next: Sub-Accounts