How to Keep the Same IP with Rotating Proxies
You keep the same IP by adding a session ID and time-to-live (TTL) option to your proxy username. This creates a sticky session that holds an IP from your chosen location for a set number of minutes.
- Add `sid.abc123` and `ttl.30` to your username to keep an IP for 30 minutes.
- The same session ID reuses the IP as long as you reconnect within the TTL.
- Sticky sessions work on all four proxy networks: residential, mobile, datacenter, and ISP.
How to Keep the Same IP for Multiple Requests
You keep the same IP by using a sticky session, which is configured by adding two special options to your proxy username: a session ID and a time-to-live. Without these options, every new connection through the gateway gets a fresh IP from the selected location, which is standard rotation. When you add a session ID, the system assigns you a specific IP and remembers to give you that same IP back for subsequent connections, as long as they happen within the TTL window. This is essential for tasks where you need a consistent identity, like maintaining a logged-in state on a website or completing a multi-step process that checks for IP consistency.
Step-by-Step Sticky Session Setup in the Dashboard
You build your sticky session proxy string directly in the dashboard under the "Proxy setup" section. First, ensure you have a proxy user created with access to the network you want to use (like residential or mobile). In the proxy setup tool, select that proxy user, then choose your target network, country, and optionally a US state or city. Below the location choices, you will find the session settings. Enable "Sticky session" and enter a custom session ID (or let the tool generate one) and set the TTL in minutes, from 1 to 120. The tool instantly builds the complete username string, which you can copy. Your password remains the proxy user's password. This setup string is what you use in your code or proxy settings.
Understanding the Session ID and TTL Options
The session ID (`sid`) is a key you define, which can be any string from 6 to 16 lowercase letters or digits (like `sid.a7k2m9`). The system uses this ID to map you to a specific exit IP in your chosen location. The time-to-live (`ttl`) is the duration in minutes that this mapping lasts, from 1 to 120 (e.g., `ttl.45`). If you specify a session ID but no TTL, the session lasts 10 minutes by default. The IP is reserved for that session ID for the TTL period. If you open a new connection with the same session ID within that period, you get the same IP. If the TTL expires or you stop using the session for longer than the TTL, the next connection with that session ID will be assigned a new IP (still in the same target location). This is useful for managing sessions in scrapers that interact with stateful websites.
Example Usernames for Sticky Sessions
Here are concrete examples of proxy usernames configured for sticky sessions.
- Residential IP in Germany for 20 minutes:
USERNAME_net.res_cc.de_city.berlin_sid.myjob1_ttl.20 - Mobile IP in the UK for 1 hour:
USERNAME_net.mob_cc.gb_sid.test456_ttl.60 - Datacenter IP in the US for a 5-minute test:
USERNAME_net.dc_cc.us_sid.sessiona_ttl.5 - ISP IP in Canada, keeping the IP for 2 hours:
USERNAME_net.isp_cc.ca_sid.longtask_ttl.120
You can use these strings with the gateway host gw.rotatingproxy.cc on port 7070 (HTTP/HTTPS) or 7071 (SOCKS5). For setup steps, see our guides for Python requests, Playwright, or curl.
When to Use Sticky Sessions vs. Rotation
Choose a sticky session for tasks that need the same IP address to stay connected. Common use cases include managing social media accounts where you stay logged in, checking ecommerce seller dashboards, or tracking a travel booking across multiple pages. Sticky sessions are also key for testing mobile apps or websites that track user sessions by IP. Conversely, you should use standard rotation (no session ID) when you need a new IP for every request or connection, which is ideal for large-scale web scraping to distribute requests and avoid rate limits. Learn more about the trade-offs in our guide on sticky vs rotating sessions.
What Happens When the Session IP Changes
Even with a sticky session, your IP can change before the TTL expires in a few specific scenarios. If the physical device providing your residential or mobile IP goes offline, the system will automatically move your session to a new IP within the same target location (same country, state, or city). This ensures continuity of service. Also, if your network's gateway (like a mobile carrier) performs a network-level IP change, the exit IP may update. For the most stable IP experience over longer periods, consider using ISP or datacenter networks, as their server-based exits are less prone to such changes. If you experience an unexpected change, you can test your proxy connection to see the new exit IP.
Managing Multiple Sticky Sessions Concurrently
You can run many different sticky sessions at the same time by using different session IDs. Each unique session ID gets its own IP assignment. For example, you could simulate 10 different users in Chicago by creating 10 usernames with the same location but different session IDs: USERNAME_net.res_cc.us_city.chicago_sid.user1k_ttl.30, ...sid.user2k..., and so on. This is a common pattern for price monitoring from multiple user perspectives or tracking search rankings in different sessions. Remember that your account-wide limit is 1,000 concurrent connections across all sessions and proxy users. You can create up to 25 proxy users in the dashboard to organize access for different projects or teams.
Combining Sticky Sessions with Other Options
The session ID and TTL options can be combined with all other targeting options. You can specify a network (net.res, net.mob, net.dc, net.isp), a country (cc.us), a US state (st.ca), and a city (city.new-york). The order of options in the username does not matter, as long as they are separated by underscores. This gives you precise control: for instance, a mobile IP from a specific German city, kept for an hour. For a full reference on the username grammar, visit our username options documentation.
Checking Your Sticky Session IP
To verify which IP your sticky session is currently using, you can make a request to an IP checking service through the proxy. A simple way is to use curl: curl -x http://gw.rotatingproxy.cc:7070 -U "USERNAME_net.res_cc.us_sid.test123_ttl.30:PASSWORD" http://ipinfo.io/ip. This will return the exit IP address. You can also use more detailed services to confirm the geolocation matches your target. We have a list of recommended IP check tools that work well with our proxies.
Related Proxy Configuration Guides
Setting up sticky sessions is one part of configuring your proxies effectively. You might also want to learn about choosing the right proxy network for your task, as mobile IPs behave differently from datacenter IPs. If you need a new IP every time, read our guide on how to rotate IPs on every request. To understand the costs involved, see how pay-as-you-go billing works, where traffic from sticky sessions is metered just like rotating traffic. For automating proxy setup, explore our REST API which allows you to generate endpoint strings programmatically.
Questions
What is the maximum time I can keep the same IP?
You can keep the same IP for a maximum of 120 minutes (2 hours) by setting `ttl.120` in your username. After that time, the session expires and a new IP will be assigned for the next connection.
Can a single session ID be used in multiple countries?
No, a session ID is tied to the specific location options (network, country, state, city) in the username. Using the same session ID with different location options creates a separate, independent session mapping.
Will my IP stay the same if I disconnect and reconnect within the TTL?
Yes. As long as you use the exact same username (including the session ID) and reconnect before the TTL minutes pass, the system will give you back the same IP address.
How do I change the IP during an active sticky session?
To force a new IP before the TTL expires, change your session ID to a new value. Using a new session ID immediately triggers the assignment of a fresh IP from your targeted location pool.
Do sticky sessions have a higher cost than rotating IPs?
No, the billing is identical. You are charged per gigabyte of traffic used, based on the network (residential, mobile, etc.) and your monthly volume band. The session mechanism itself does not incur extra fees.
Can I set a TTL longer than 120 minutes?
No, the maximum TTL allowed is 120 minutes. For tasks requiring longer-term IP consistency, you would need to implement logic in your application to re-establish a new sticky session with the same ID after the TTL expires, which will get a new IP in the same location.
Start with one top-up, use any network
Create an account in a minute, add $40 or more, and the same balance pays for residential, mobile, datacenter and ISP traffic.