---
title: "GET /private/logout"
method: GET
path: "/private/logout"
tags: ["Authentication", "WebSocket Only", "Private"]
---

# GET /private/logout

`GET /private/logout`

Gracefully terminate the current WebSocket connection and optionally invalidate all tokens associated with the session.

This method provides a clean way to close WebSocket connections while preserving active orders when [**Cancel On Disconnect (COD)**](https://docs.deribit.com/api-reference/session-management/private-enable_cancel_on_disconnect) is enabled.

**Use Cases:**

- **Clean Shutdown:** Properly close WebSocket connections during application shutdown or restart
- **Order Preservation:** Close connections without triggering order cancellations when COD is enabled
- **Session Management:** Invalidate tokens to ensure security when closing connections
- **Maintenance Operations:** Temporarily disconnect for system maintenance without affecting trading positions

**Cancel On Disconnect (COD) Behavior:**

When Cancel On Disconnect is enabled for your connection, this method provides a safe way to close the connection without triggering automatic order cancellations. This is different from other disconnection scenarios:

- **Graceful logout** (this method): Orders are **NOT cancelled**, even if COD is enabled
- **Unexpected disconnection:** Orders are **cancelled** if COD is enabled
- **Inactivity timeout:** Orders are **cancelled** if COD is enabled
- **Heartbeat failure:** Orders are **cancelled** if COD is enabled

This distinction allows you to perform planned disconnections (e.g., for maintenance, updates, or reconnection) while preserving your active orders.

**WebSocket Only:**

This method is designed exclusively for WebSocket connections. Attempting to use it via REST/HTTP will result in a 400 error response.

**Note:** This method has no response. The WebSocket connection is closed immediately after the request is processed.

[Try in API console](https://test.deribit.com/api_console?method=%2Fprivate%2Flogout)

## Query parameters

- `invalidate_token` boolean

## Response `200`

Connection closed

---

[API](https://skmtc.net/deribit/apis/deribit-api.md) · [All operations](https://skmtc.net/deribit/apis/deribit-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/deribit/deribit-api/versions/78a0783dbfcc/schema)
