---
title: "Rotate a session proxy and record the reason."
method: POST
path: "/sessions/{session_id}/rotate"
---

# Rotate a session proxy and record the reason.

`POST /sessions/{session_id}/rotate`

## Request

- Base URL: `https://api.nexalayer.net/v1`
- URL: `https://api.nexalayer.net/v1/sessions/{session_id}/rotate`
- Auth: API key in header `X-API-Key`

## Path parameters

- `session_id` string, required

## Query parameters

- `include_credentials` boolean

## Headers

- `Idempotency-Key` string

## Request body

- object
  - `reason` 'manual' | 'scheduled' | 'http_403' | 'http_429' | 'captcha' | 'timeout' | 'block'

## Response `200`

Rotated session. proxy.username, proxy.password, and proxy.full_url are omitted unless the include_credentials query parameter is true.

## Other responses

- `401`: API key is missing or invalid.
- `404`: The requested route (ROUTE_NOT_FOUND), product (PRODUCT_NOT_FOUND), or session (SESSION_NOT_FOUND) was not found. See https://docs.nexalayer.net/en/errors.
- `409`: HTTP 409. PRICE_MISMATCH means the price changed since it was read; no order was placed, so re-read prices and retry. Also used for PRODUCT_OUT_OF_STOCK and IDEMPOTENCY_CONFLICT. See https://docs.nexalayer.net/en/errors.
- `429`: Request or trial limit exceeded.

---

[API](https://skmtc.dev/nexalayer/apis/nexalayer-agent-api.md) · [All operations](https://skmtc.dev/nexalayer/apis/nexalayer-agent-api/llms.txt) · [OpenAPI document](https://skmtc.dev/nexalayer/apis/nexalayer-agent-api/revisions/126d0d474804?raw)
