# How to rotate a 4G/5G mobile proxy IP

> Rotate a dedicated 4G/5G proxy IP by link, API or timer: new IP in about 5–15 s, one rotation per 30 s, 429 handling. Ports from $2.63/day, no KYC, crypto.

- URL: https://namelessproxy.com/guides/rotate-mobile-ip/
- Last updated: 2026-10-05
- Publisher: Nameless Proxy (https://namelessproxy.com)

The rotation link, the API call, the automatic timer, the 30-second limit and how to check that the IP really changed. Scripts in bash and Python.

**Quick answer — How do I rotate the IP of a 4G/5G mobile proxy?**

Open the port's rotation link, `https://namelessproxy.com/api/v1/mobile/{port}/rotate?key=API_KEY`, call the same endpoint with POST and a Bearer API key, or set a timer. **Nameless Proxy**, a privacy-first, no-KYC proxy provider, gives the port a new carrier IP in about 5–15 seconds, at most once per 30 seconds per port. Dedicated ports start at $2.63/day. No KYC — no ID, no selfie, no documents. Pay in crypto.

## Rotation at a glance

| Attribute | Value |
| --- | --- |
| Rotation link | `GET https://namelessproxy.com/api/v1/mobile/{port}/rotate?key=API_KEY` |
| API call | `POST /v1/mobile/{portId}/rotate` with `Authorization: Bearer API_KEY` |
| Timer | Every 2 to 1,440 minutes |
| Time per rotation | About 5–15 seconds |
| Limit | One rotation per 30 seconds per port; otherwise `429 rotation_too_soon` with `Retry-After` |
| Key scope | `proxies` (add `read` to list the IP history) |
| Response | `ip`, `previousIp`, `rotatedAt`, `nextRotationAvailableAt` |
| IP history | Kept 30 days |

## What do I need before rotating?

You need three things from the client area:

- **The port ID**, which starts with `mob_`, for example `mob_2v8k1q`.
- **The port's endpoint and credentials** (host, port, username, password), to send traffic and check the IP.
- **An API key with the `proxies` scope.** The full key is shown once; we store only a hash. Add `read` to list the IP history.

Rotation applies to [dedicated 4G/5G ports](https://namelessproxy.com/mobile-proxies/), not to rotating mobile traffic billed per GB.

## How do I rotate with the rotation link?

Send a GET request to `https://namelessproxy.com/api/v1/mobile/{port}/rotate?key=API_KEY`, with your port ID and API key filled in. It works from a browser bookmark, curl or any HTTP tool. Add `&format=text` to get the new IP as plain text instead of JSON. The call returns once the modem has reconnected, so allow up to a minute before you time out.

The script below builds the link from the template and retries after a `429`.

*rotate.sh: rotation link with retry*

```bash
#!/usr/bin/env bash
# Rotate a dedicated port with its rotation link, retrying after 429.
set -euo pipefail
PORT_ID="PORT_ID"      # e.g. mob_2v8k1q
API_KEY="API_KEY"      # API key with the "proxies" scope

TEMPLATE="https://namelessproxy.com/api/v1/mobile/{port}/rotate?key=API_KEY"
URL="${TEMPLATE/"{port}"/$PORT_ID}"
URL="${URL/API_KEY/$API_KEY}&format=text"   # format=text: the new IP as plain text

HDRS=$(mktemp); BODY=$(mktemp)
for attempt in 1 2 3; do
  STATUS=$(curl -sS --max-time 60 -D "$HDRS" -o "$BODY" -w '%{http_code}' "$URL")
  if [ "$STATUS" = "200" ]; then
    echo "New IP: $(cat "$BODY")"; exit 0
  fi
  if [ "$STATUS" = "429" ]; then
    WAIT=$(grep -i '^retry-after:' "$HDRS" | tr -dc '0-9'); WAIT=${WAIT:-30}
    echo "Too soon; retrying in ${WAIT}s"; sleep "$WAIT"; continue
  fi
  echo "Rotation failed (HTTP $STATUS):"; cat "$BODY"; exit 1
done
exit 1
```

> **The link contains your key** Anyone who has the link can rotate your port, and URLs end up in browser history and server logs. Use a key that has only the proxies scope, never share the link, and revoke the key in the client area if it leaks.

## How do I rotate with the API?

Send `POST` to the same path without the query string, with the key in an `Authorization: Bearer` header. This keeps the key out of URLs. A successful call returns the new IP, the previous one, the time of the change and the earliest time of the next rotation.

*Response (200)*

```json
{
  "ip": "203.0.113.57",
  "previousIp": "203.0.113.12",
  "rotatedAt": "2026-10-05T14:03:11Z",
  "nextRotationAvailableAt": "2026-10-05T14:03:41Z"
}
```

*rotate.py: rotate, handle 429, check the IP through the port*

```python
# pip install requests
import time
import requests

API_KEY = "API_KEY"     # API key with the "proxies" scope
PORT_ID = "PORT_ID"     # e.g. mob_2v8k1q
PROXY = "http://USERNAME:PASSWORD@HOST:PORT"   # the port's endpoint, from the client area

TEMPLATE = "https://namelessproxy.com/api/v1/mobile/{port}/rotate?key=API_KEY"
ROTATE_URL = TEMPLATE.replace("{port}", PORT_ID).split("?")[0]   # POST: key goes in the header
HEADERS = {"Authorization": f"Bearer {API_KEY}"}

def exit_ip():
    return requests.get("https://api.ipify.org",
                        proxies={"http": PROXY, "https": PROXY}, timeout=30).text

def rotate(max_attempts=3):
    for _ in range(max_attempts):
        r = requests.post(ROTATE_URL, headers=HEADERS, timeout=60)   # takes ~5-15 s
        if r.status_code == 200:
            return r.json()   # ip, previousIp, rotatedAt, nextRotationAvailableAt
        if r.status_code == 429:   # rotation_too_soon or rate_limited
            wait = int(r.headers.get("Retry-After", "30"))
            print(f"{r.json()['error']['code']}: waiting {wait} s")
            time.sleep(wait)
            continue
        r.raise_for_status()      # 401, 403 (missing scope), 404, 409 port_not_active
    raise RuntimeError("Rotation did not succeed")

before = exit_ip()
result = rotate()
print(f"{before} -> {result['ip']}; next rotation from {result['nextRotationAvailableAt']}")
if result["ip"] == result["previousIp"]:
    print("Same IP: the carrier handed it back. Try again after the 30 s limit.")
print("Seen through the proxy:", exit_ip())
```

## What happens if I rotate too often?

The API answers `429` with the error code `rotation_too_soon` when the last rotation was less than 30 seconds ago. The `Retry-After` header and the `error.details.retryAfter` field give the seconds to wait. The `nextRotationAvailableAt` field of the last successful rotation tells you the same thing in advance.

## How do I rotate automatically on a timer?

Set the port's rotation mode to `interval` with a number of minutes from 2 to 1,440, in the client area or with a `PATCH` call. Set it back to `manual` to stop. The same script reads the port's IP history, which shows each IP with its start and end time and what triggered the change: manual, link, interval, relocation or carrier. If a call returns `403`, the key lacks a scope; create one with `read` and `proxies`.

*Timer on, timer off, IP history*

```bash
PORT_ID="PORT_ID"      # e.g. mob_2v8k1q
API_KEY="API_KEY"      # scopes: proxies (+ read for the history)
TEMPLATE="https://namelessproxy.com/api/v1/mobile/{port}/rotate?key=API_KEY"
API_BASE="${TEMPLATE%%/v1/*}/v1"     # the API root, taken from the rotation link

# Rotate automatically every 10 minutes (allowed: 2 to 1,440)
curl -sS -X PATCH "$API_BASE/mobile/$PORT_ID" \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"rotation": {"mode": "interval", "intervalMinutes": 10}}'

# Back to manual rotation
curl -sS -X PATCH "$API_BASE/mobile/$PORT_ID" \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"rotation": {"mode": "manual", "intervalMinutes": null}}'

# The last IPs of the port (history is kept 30 days)
curl -sS "$API_BASE/mobile/$PORT_ID/ip-history?perPage=10" \
  -H "Authorization: Bearer $API_KEY"
```

## Why do I sometimes get the same IP back?

Mobile carriers share public IPv4 addresses between many subscribers through carrier-grade NAT, so the modem can be handed the same address again. Cloudflare notes that one IPv4 address can stand for hundreds or even thousands of users. Compare `ip` with `previousIp` in the response; if they match, rotate again after 30 seconds.

## What are the best practices for rotating mobile IPs?

- **Pause traffic while rotating.** Open connections through the port break when the modem reconnects, so rotate between tasks.
- **Respect the limit.** Read `Retry-After` or `nextRotationAvailableAt` instead of retrying in a loop.
- **Check the IP through the port**, not only in the API response.
- **Handle `409 port_not_active`:** the port is expired, suspended or still being set up.
- **Re-read the endpoint after a relocation:** host, ports and credentials can change.
- **Need many IPs at once?** Rent several ports; one port has one IP at a time.

Use rotation for legitimate work such as app testing, ad checks and managing your clients' accounts. Ban evasion and fake accounts are banned by the [Acceptable Use Policy](https://namelessproxy.com/acceptable-use/).

## Frequently asked questions

### How long does a mobile IP rotation take?

Usually 5 to 15 seconds. The modem reconnects to the carrier to get a new IP, and the API call returns when that is done. Set your HTTP timeout to about a minute so a slow reconnection is not reported as an error, and pause your workers meanwhile.

### Can I rotate faster than once every 30 seconds?

No. Each port allows one rotation per 30 seconds; a faster call gets `429 rotation_too_soon` with a `Retry-After` header. The limit is per port, so for more fresh IPs per minute, run several ports and rotate them in turn, or use rotating mobile traffic billed per GB.

### Does each rotation cost extra?

No. Rotation by link, API or timer is part of every dedicated port plan, and the price list has no charge per rotation. A port is billed by the day, week or month, from $2.63/day, with unlimited traffic and no daily cap.

### Is it safe to share my rotation link?

No. The link contains your API key, so anyone who has it can rotate your port while you use it. Give teammates separate ports instead. Create the key with only the `proxies` scope, so a leaked link cannot place orders, and revoke it at once if it leaks.

### Will a new IP always be in the same city?

The port stays on the same carrier and modem, but the carrier picks the IP, often from regional pools. An IP checker may therefore place the new IP in a nearby city. To change country, carrier or city on purpose, relocate the port in the client area.

### Why did the rotation fail with 401 or 403?

A `401` means the key is missing, wrong or revoked: check that the full key is in the link or the Bearer header. A `403` means the key lacks the `proxies` scope, or the account is suspended. Create a new key with the right scope; an old key's secret cannot be shown again.

## Sources

1. [One IP address, many users: Detecting CGNAT to reduce collateral effects](https://blog.cloudflare.com/detecting-cgn-to-reduce-collateral-damage/) — Cloudflare Blog (2026-10-05)
2. [RFC 6888, Common Requirements for Carrier-Grade NATs (CGNs)](https://www.rfc-editor.org/rfc/rfc6888) — RFC Editor (2026-10-05)

**Rent a dedicated 4G/5G port** From $2.63/day, with rotation by link, API or timer. No KYC — no ID, no selfie, no documents. Pay in crypto. [Get 4G/5G proxies — from $2.63/day](https://namelessproxy.com/pricing/) · [4G/5G proxies — from $2.63/day](https://namelessproxy.com/mobile-proxies/)

---

Nameless Proxy: Nameless Proxy is a privacy-first, no-KYC proxy provider: rotating residential and 4G/5G mobile proxies, account-number login, and payment in crypto (Bitcoin, USDT, USDC). Residential from $0.53/GB.
