> For the complete documentation index, see [llms.txt](https://ro-proxy.gitbook.io/integration/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://ro-proxy.gitbook.io/integration/sessions.md).

# Sessions

Manage proxy sessions purchased on your account.

## List proxy sessions

> Paginated list of proxy sessions owned by the caller. Each item includes the gateway\
> connection credentials (\`username\`, \`password\`, \`gateway\_host\`, \`gateway\_http\_port\`,\
> \`gateway\_socks5\_port\`) you connect to in order to route traffic through the proxy.<br>

```json
{"openapi":"3.0.3","info":{"title":"RoProxy Integration API","version":"1.0.0"},"tags":[{"name":"Sessions","description":"Manage proxy sessions purchased on your account."}],"servers":[{"url":"https://integration-api.ro-proxy.com","description":"Production"}],"security":[{"ApiKeyAuth":[]}],"components":{"securitySchemes":{"ApiKeyAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT","description":"API key minted via `POST /api/key`, sent as\n`Authorization: Bearer <token>`.\n"}},"schemas":{"ListSessionEnvelope":{"type":"object","properties":{"message":{"type":"string"},"data":{"$ref":"#/components/schemas/ListSessionResponse"}}},"ListSessionResponse":{"type":"object","properties":{"total":{"type":"integer","format":"int64"},"page":{"type":"integer"},"size":{"type":"integer"},"items":{"type":"array","items":{"$ref":"#/components/schemas/ListSessionItem"}}}},"ListSessionItem":{"type":"object","properties":{"id":{"type":"integer"},"user_id":{"type":"integer"},"user_email":{"type":"string"},"plan_id":{"type":"integer","nullable":true},"plan_name":{"type":"string","nullable":true},"username":{"type":"string"},"password":{"type":"string"},"gateway_host":{"type":"string"},"gateway_http_port":{"type":"integer"},"gateway_socks5_port":{"type":"integer"},"proxy_ip":{"type":"string","nullable":true},"country":{"type":"string","nullable":true},"strategy":{"type":"string","enum":["bind","request","time"]},"duration":{"type":"integer","nullable":true},"in":{"type":"integer","format":"int64"},"out":{"type":"integer","format":"int64"},"status":{"type":"string"},"rotated_at":{"type":"string","format":"date-time","nullable":true},"expired_at":{"type":"string","format":"date-time","nullable":true},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"}}},"ErrorEnvelope":{"type":"object","properties":{"message":{"type":"string"},"data":{"nullable":true}},"required":["message"]}},"responses":{"Unauthorized":{"description":"Missing or invalid API key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"ServerError":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}}},"paths":{"/api/session":{"get":{"tags":["Sessions"],"summary":"List proxy sessions","description":"Paginated list of proxy sessions owned by the caller. Each item includes the gateway\nconnection credentials (`username`, `password`, `gateway_host`, `gateway_http_port`,\n`gateway_socks5_port`) you connect to in order to route traffic through the proxy.\n","parameters":[{"in":"query","name":"page","schema":{"type":"integer","minimum":1,"default":1}},{"in":"query","name":"size","schema":{"type":"integer","minimum":1,"maximum":120,"default":20}},{"in":"query","name":"order_by","schema":{"type":"string","enum":["created_at","updated_at","in","out"]}},{"in":"query","name":"order_dir","schema":{"type":"string","enum":["asc","desc"]}},{"in":"query","name":"country","schema":{"type":"string"},"description":"Filter by country code."},{"in":"query","name":"strategy","schema":{"type":"string","enum":["bind","request","time"]}}],"responses":{"200":{"description":"List of sessions.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ListSessionEnvelope"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"500":{"$ref":"#/components/responses/ServerError"}}}}}}
```

## Update a proxy session

> Change the rotation strategy, country, or duration of an existing session.\
> \- \`strategy = bind\`   — sticky IP (rotates only on demand).\
> \- \`strategy = request\`— rotates IP on every request.\
> \- \`strategy = time\`   — rotates IP every \`duration\` seconds.<br>

```json
{"openapi":"3.0.3","info":{"title":"RoProxy Integration API","version":"1.0.0"},"tags":[{"name":"Sessions","description":"Manage proxy sessions purchased on your account."}],"servers":[{"url":"https://integration-api.ro-proxy.com","description":"Production"}],"security":[{"ApiKeyAuth":[]}],"components":{"securitySchemes":{"ApiKeyAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT","description":"API key minted via `POST /api/key`, sent as\n`Authorization: Bearer <token>`.\n"}},"parameters":{"SessionId":{"in":"path","name":"id","required":true,"schema":{"type":"integer","minimum":1},"description":"Session ID."}},"schemas":{"UpdateSessionRequest":{"type":"object","required":["strategy"],"properties":{"strategy":{"type":"string","enum":["bind","request","time"]},"country":{"type":"string","nullable":true},"duration":{"type":"integer","nullable":true,"description":"Rotation period in seconds (only meaningful when `strategy = time`)."}}},"EmptyEnvelope":{"type":"object","properties":{"message":{"type":"string"},"data":{"nullable":true}},"required":["message"]},"ErrorEnvelope":{"type":"object","properties":{"message":{"type":"string"},"data":{"nullable":true}},"required":["message"]}},"responses":{"BadRequest":{"description":"Invalid request payload.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"Unauthorized":{"description":"Missing or invalid API key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"NotFound":{"description":"Resource not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"ServerError":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}}},"paths":{"/api/session/{id}":{"put":{"tags":["Sessions"],"summary":"Update a proxy session","description":"Change the rotation strategy, country, or duration of an existing session.\n- `strategy = bind`   — sticky IP (rotates only on demand).\n- `strategy = request`— rotates IP on every request.\n- `strategy = time`   — rotates IP every `duration` seconds.\n","parameters":[{"$ref":"#/components/parameters/SessionId"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateSessionRequest"}}}},"responses":{"200":{"description":"Session updated.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EmptyEnvelope"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"500":{"$ref":"#/components/responses/ServerError"}}}}}}
```

## Manually rotate a session's IP

> Force a session to pick a new exit IP immediately. Returns the new \`proxy\_ip\` and the \`rotated\_at\` timestamp.

```json
{"openapi":"3.0.3","info":{"title":"RoProxy Integration API","version":"1.0.0"},"tags":[{"name":"Sessions","description":"Manage proxy sessions purchased on your account."}],"servers":[{"url":"https://integration-api.ro-proxy.com","description":"Production"}],"security":[{"ApiKeyAuth":[]}],"components":{"securitySchemes":{"ApiKeyAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT","description":"API key minted via `POST /api/key`, sent as\n`Authorization: Bearer <token>`.\n"}},"parameters":{"SessionId":{"in":"path","name":"id","required":true,"schema":{"type":"integer","minimum":1},"description":"Session ID."}},"schemas":{"UserRotateSessionEnvelope":{"type":"object","properties":{"message":{"type":"string"},"data":{"$ref":"#/components/schemas/UserRotateSessionData"}}},"UserRotateSessionData":{"type":"object","properties":{"rotated_at":{"type":"string","format":"date-time","nullable":true},"proxy_ip":{"type":"string"}}},"ErrorEnvelope":{"type":"object","properties":{"message":{"type":"string"},"data":{"nullable":true}},"required":["message"]}},"responses":{"Unauthorized":{"description":"Missing or invalid API key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"NotFound":{"description":"Resource not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"ServerError":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}}},"paths":{"/api/session/{id}/rotate":{"post":{"tags":["Sessions"],"summary":"Manually rotate a session's IP","description":"Force a session to pick a new exit IP immediately. Returns the new `proxy_ip` and the `rotated_at` timestamp.","parameters":[{"$ref":"#/components/parameters/SessionId"}],"responses":{"200":{"description":"Rotated.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UserRotateSessionEnvelope"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"500":{"$ref":"#/components/responses/ServerError"}}}}}}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://ro-proxy.gitbook.io/integration/sessions.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
