> ## 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 |
| :- | :- | :- | :- |
| [`deleteAll`](#deleteall) | `DELETE /2/connections/all` | Standard | Terminate All Connections |
| [`deleteByEndpoint`](#deletebyendpoint) | `DELETE /2/connections/{endpoint_id}` | Standard | Terminate Connections by Endpoint |
| [`deleteByUuids`](#deletebyuuids) | `DELETE /2/connections` | Standard | Terminate Multiple Connections |
| [`getConnectionHistory`](#getconnectionhistory) | `GET /2/connections` | Paginated | Get Connection History |

## `deleteAll`

DELETE `/2/connections/all`

**Terminate All Connections**

Terminates all active streaming connections for the authenticated application.

```java theme={null}
import com.x.xdk.XClient;

XClient client = XClient.builder()
    .bearerToken(System.getenv("X_BEARER_TOKEN"))
    .build();

var response = client.connections().deleteAll();
System.out.println(response);
```

**Returns:** `Schemas.DeleteAllConnectionsResponse`

***

## `deleteByEndpoint`

DELETE `/2/connections/{endpoint_id}`

**Terminate Connections by Endpoint**

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

```java theme={null}
import com.x.xdk.XClient;

XClient client = XClient.builder()
    .bearerToken(System.getenv("X_BEARER_TOKEN"))
    .build();

var response = client.connections().deleteByEndpoint("filtered_stream");
System.out.println(response);
```

### Parameters

**endpointId** `String` *required*

`endpoint_id` (path parameter).

**Returns:** `Schemas.DeleteConnectionsByEndpointResponse`

***

## `deleteByUuids`

DELETE `/2/connections`

**Terminate Multiple Connections**

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

```java theme={null}
import com.x.xdk.Schemas;
import com.x.xdk.XClient;
import java.util.List;

XClient client = XClient.builder()
    .bearerToken(System.getenv("X_BEARER_TOKEN"))
    .build();

var response = client.connections().deleteByUuids(
    new Schemas.DeleteConnectionsByUuidsRequest().uuids(List.of("example"))
);
System.out.println(response);
```

### Parameters

**body** `Schemas.DeleteConnectionsByUuidsRequest` *required*

Request payload.

**Returns:** `Schemas.DeleteConnectionsByUuidsResponse`

***

## `getConnectionHistory`

GET `/2/connections` Paginated

**Get Connection History**

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

```java theme={null}
import com.x.xdk.XClient;

XClient client = XClient.builder()
    .bearerToken(System.getenv("X_BEARER_TOKEN"))
    .build();

for (var page : client.connections().getConnectionHistoryPages()) {
    System.out.println(page);
}
```

### Parameters

**Optional parameters (ConnectionsClient.GetConnectionHistoryOptions — 5)**

**options.status** `String`

`status` (query parameter).

**options.endpoints** `List\<String\>`

`endpoints` (query parameter).

**options.maxResults** `Integer`

`max_results` (query parameter).

**options.paginationToken** `String`

`pagination_token` (query parameter).

**options.connectionFields** `List\<String\>`

A comma separated list of Connection fields to display.

**Returns:** `Schemas.GetConnectionHistoryResponse` (use `getConnectionHistoryPages(...)` for automatic `Paginator<...>` iteration)

***
