> ## Documentation Index
> Fetch the complete documentation index at: https://anyip.io/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Sticky vs. Rotating Sessions

> Learn how to keep the same IP (Sticky Sessions) or rotate IPs per request. Essential for multi-step workflows, login sessions, and avoiding rate limits.

One of the most common questions: *"How do I get a Static IP?"* or *"Why did my IP change?"*

***

## Rotating Mode (Default)

**Best for:** Web scraping, crawling, bulk data collection.

If you **do not** add a session flag, every request you make will be routed through a fresh IP address.

```
Request 1 → IP A
Request 2 → IP B
Request 3 → IP C
```

No configuration needed. This is the default behavior.

***

## Sticky Sessions ("Static" IPs)

**Best for:** Account management (FB, IG, Amazon), filling forms, checkout bots.

To keep the same IP across multiple requests, define a **Session ID**.

| Flag             | Example                                       |
| :--------------- | :-------------------------------------------- |
| `session_[name]` | `user_XXXX,country_US,session_googleaccount1` |

As long as you use the same `session_googleaccount1`, we will route you through the same device.

```bash theme={null}
curl -x "http://user_XXXX,session_myprofile:pass@portal.anyip.io:1080" http://ip-api.com/
```

### Why Did My Sticky IP Change?

<Warning>
  **Read This Before Asking Support**

  **"Sticky" is NOT "Permanent."**

  We use **real peer devices** (people's phones and home wifi), not datacenter servers. Real people turn off their phones, lose signal, or drive into tunnels.

  1. **If the peer goes offline:** We automatically rotate you to a *new* IP in the same location to keep your connection alive.
  2. **Duration:** A session typically lasts **up to 7 days**, but can be shorter.

  This is expected behavior, not a bug.
</Warning>

***

## How to Manually Rotate a Sticky IP

If your current sticky IP gets blocked or is too slow, you can force a change:

### Method A: Change the Session Name

Simply rename your session in your code/bot:

```
session_profile1   →  session_profile1_v2
```

**Result:** Instant new IP.

### Method B: Use the Change IP URL (Rotation Link)

You can rotate your IP programmatically without changing your code by calling a special URL.

**Where to find it:**

1. Go to [Dashboard > Proxies](https://anyip.io/account/).
2. Click **"Get Proxy Details"**.
3. Look for the **"Change IP URL"** under the Proxy credentials section.

**URL Format:**

```
https://dashboard.anyip.io/api/proxy_accounts/[proxy_id]/invalidate/[hash]/session/[session_name]
```

**Example:**

If your session name is `twitter3`, your rotation link would look like:

```
https://dashboard.anyip.io/api/proxy_accounts/abc123/invalidate/xyz789/session/twitter3
```

**How to use it:**

* Click the link in a browser
* Call it from a script: `curl "https://dashboard.anyip.io/api/proxy_accounts/.../session/twitter3"`
* Set it as a "Rotate" button in your bot/tool

<Warning>
  **Important**

  The rotation link only works if you have a `session_[name]` flag in your username. The session name in the URL must match exactly.
</Warning>

***

## Advanced Session Options

### Set a Custom Session Duration

By default, sessions last up to 7 days. You can set a shorter duration (1 to 10,080 minutes) with the `sesstime_[minutes]` flag:

```bash theme={null}
# Session expires after 10 minutes
curl -x "http://user_XXXX,session_temp,sesstime_10:pass@portal.anyip.io:1080" http://ip-api.com/
```

After 10 minutes, the session expires and a new IP is assigned automatically.

### Disable Auto-Replacement When IP Disconnects

By default, if your sticky IP goes offline, we assign you a new one automatically.

To **disable** this always keep the same IP, you can use the flag `sessreplace_false`:

```bash theme={null}
curl -x "http://user_XXXX,session_unique1,sessreplace_false:pass@portal.anyip.io:1080" http://ip-api.com/
```

If the IP disconnects, you'll receive a `peer_not_found` error instead of being switched to a new IP.

### Avoid IP Collision Across Sessions

Managing multiple accounts? Use `sessipcollision_strict` to ensure no two sessions ever share the same IP:

```bash theme={null}
curl -x "http://user_XXXX,session_account1,sessipcollision_strict:pass@portal.anyip.io:1080" http://ip-api.com/
curl -x "http://user_XXXX,session_account2,sessipcollision_strict:pass@portal.anyip.io:1080" http://ip-api.com/
```

Each session is guaranteed a unique IP.

### Keep the Same ISP/ASN When IP Changes

If an IP disconnects, we try to find a replacement in the same area. To **strictly** require the same ISP (ASN), you can use the flag `sessasn_strict`:

```bash theme={null}
curl -x "http://user_XXXX,session_bank,sessasn_strict:pass@portal.anyip.io:1080" http://ip-api.com/
```

This increases success rates for sensitive use cases.
