> ## Documentation Index
> Fetch the complete documentation index at: https://docs.x.com/llms.txt
> Use this file to discover all available pages before exploring further.

# ConnectionsClient

> Methods for X API v2 Connections endpoints.

Access **Connections** endpoints via `client.connections` (`ConnectionsClient`).

## Methods

| Method | Endpoint | Behavior | Summary |
| :- | :- | :- | :- |
| [`delete_all`](#delete_all) | `DELETE /2/connections/all` | Standard | Terminate All Connections |
| [`delete_by_endpoint`](#delete_by_endpoint) | `DELETE /2/connections/{endpoint_id}` | Standard | Terminate Connections by Endpoint |
| [`delete_by_uuids`](#delete_by_uuids) | `DELETE /2/connections` | Standard | Terminate Multiple Connections |
| [`get_connection_history`](#get_connection_history) | `GET /2/connections` | Paginated | Get Connection History |

## `delete_all`

DELETE `/2/connections/all`

**Terminate All Connections**

Terminates all active streaming connections for the authenticated application.

```ruby theme={null}
require "xdk"

client = Xdk::Client.new(bearer_token: ENV.fetch("X_BEARER_TOKEN"))

response = client.connections.delete_all
puts response
```

**Returns:** `Hash`

***

## `delete_by_endpoint`

DELETE `/2/connections/{endpoint_id}`

**Terminate Connections by Endpoint**

Terminates all streaming connections for a specific endpoint ID for the authenticated application.

```ruby theme={null}
require "xdk"

client = Xdk::Client.new(bearer_token: ENV.fetch("X_BEARER_TOKEN"))

response = client.connections.delete_by_endpoint(endpoint_id: "filtered_stream")
puts response
```

### Parameters

**endpoint\_id** `String` *required*

`endpoint_id` (path parameter).

**Returns:** `Hash`

***

## `delete_by_uuids`

DELETE `/2/connections`

**Terminate Multiple Connections**

Terminates multiple streaming connections by their UUIDs for the authenticated application.

```ruby theme={null}
require "xdk"

client = Xdk::Client.new(bearer_token: ENV.fetch("X_BEARER_TOKEN"))

response = client.connections.delete_by_uuids(body: { "uuids" => ["example"] })
puts response
```

### Parameters

**body** `Hash` *required*

Request payload.

**Returns:** `Hash`

***

## `get_connection_history`

GET `/2/connections` Paginated

**Get Connection History**

Returns active and historical streaming connections with disconnect reasons for the authenticated application.

```ruby theme={null}
require "xdk"

client = Xdk::Client.new(bearer_token: ENV.fetch("X_BEARER_TOKEN"))

client.connections.get_connection_history.each do |page|
  puts page["data"]
end
```

### Parameters

**Optional keyword arguments (5)**

**status** `String`

`status` (query parameter).

**endpoints** `Array\<String\>`

`endpoints` (query parameter).

**max\_results** `Integer`

`max_results` (query parameter).

**pagination\_token** `String`

`pagination_token` (query parameter).

**connection\_fields** `Array\<String\>`

A comma separated list of Connection fields to display.

**Returns:** `Enumerator<Hash>`

***
