> For AI agents: the complete documentation index is available at https://proxykite.com/docs/llms.txt, the full documentation bundle is available at https://proxykite.com/docs/llms-full.txt.

# Rotation links

Every proxy has a secret **rotation link** that changes its IP without an API token. It is the `rotation_url` field of
the [proxy object](https://proxykite.com/docs/api/proxies.md) and is shown on the proxy's page in the panel:

```
https://proxykite.com/r/<rotation_token>
```

Anyone who has the link can rotate that one proxy, so treat it like a password.

## Rotating

Send a **GET** or a **POST**: either one rotates the IP straight away. The call waits for the rotation to
finish (up to about 60 seconds), so use a client timeout of at least 90 s.


**curl**

```bash
curl -X POST 'https://proxykite.com/r/<rotation_token>'
# or simply open it (GET):
curl 'https://proxykite.com/r/<rotation_token>'
```


**Python**

```python
import requests

r = requests.post("https://proxykite.com/r/<rotation_token>", timeout=90)
print(r.status_code, r.json())
```


**Node.js**

```js
const res = await fetch('https://proxykite.com/r/<rotation_token>', {
  method: 'POST',
  signal: AbortSignal.timeout(90_000),
});
console.log(res.status, await res.json());
```


**PHP**

```php
<?php
$ch = curl_init('https://proxykite.com/r/<rotation_token>');
curl_setopt_array($ch, [CURLOPT_POST => true, CURLOPT_RETURNTRANSFER => true, CURLOPT_TIMEOUT => 90]);
$body = curl_exec($ch);
var_dump(curl_getinfo($ch, CURLINFO_HTTP_CODE), json_decode($body, true));
```


## Link previews

Opening the link rotates, so a chat app, mail scanner or link previewer that opens a pasted link with GET rotates the IP
too. A `HEAD` request (what many link checkers send) does not rotate: it answers `204` and is only logged. Every request
shows up in the proxy's **Rotation link access log** with its IP and user agent. To stop strangers, turn on
**Only allow the rotation link from these IPs** on the proxy's Rotation tab, and keep the link out of chats.
A `?confirm=1` left over in older scripts is ignored.

## Answers

| Status | Body                                                                                                |
| ------ | --------------------------------------------------------------------------------------------------- |
| 200    | `{"ok": true, "old_ip": "100.64.1.2", "new_ip": "100.64.9.8"}`                                      |
| 403    | `dongle_disabled`: the proxy is disabled; `ip_not_allowed`: your IP is not on the link's allow list |
| 404    | `not_found`: unknown link (for example after a reset in the panel)                                  |
| 409    | `rotation_in_progress`: another rotation of this proxy is running                                   |
| 429    | `rate_limited`: more than 6 per minute for this link, or 30 per minute from your IP                 |
| 501    | `not_implemented`: this dongle cannot rotate this way                                               |
| 502    | `rotation_failed`: the dongle did not get a new IP                                                  |

Every error body is `{"ok": false, "error": "<code>", "message": "…"}`.

## Link or API?

|            | Rotation link                 | [API rotate](https://proxykite.com/docs/api/rotation.md) |
| ---------- | ----------------------------- | -------------------------------------------------------- |
| Auth       | the secret in the URL         | bearer token (`rotate` level)                            |
| Scope      | one proxy                     | every proxy the login can see                            |
| Answer     | `ok`, `old_ip`, `new_ip`      | also `method`, `duration_ms`                             |
| Rate limit | 6/min per link, 30/min per IP | 120/min per login                                        |
