> ## 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.

# CallsClient

> Methods for X API v2 Calls endpoints.

Access **Calls** endpoints via `client.calls()` (`CallsClient`).

## Methods

| Method | Endpoint | Behavior | Summary |
| :- | :- | :- | :- |
| [`cancelScheduledCall`](#cancelscheduledcall) | `DELETE /2/calls/scheduled/{id}` | Standard | Cancel a Scheduled Call |
| [`createCall`](#createcall) | `POST /2/calls` | Standard | Create a Call |
| [`getCall`](#getcall) | `GET /2/calls/{id}` | Standard | Get a Call |
| [`getScheduledCall`](#getscheduledcall) | `GET /2/calls/scheduled/{id}` | Standard | Get a Scheduled Call |
| [`joinCall`](#joincall) | `POST /2/calls/{id}/join` | Standard | Join a Call |
| [`leaveCall`](#leavecall) | `POST /2/calls/{id}/leave` | Standard | Leave a Call |
| [`listScheduled`](#listscheduled) | `GET /2/calls/scheduled` | Standard | List Scheduled Calls |
| [`respondToScheduledCall`](#respondtoscheduledcall) | `POST /2/calls/scheduled/{id}/rsvp` | Standard | Respond to a Scheduled Call |
| [`scheduleCall`](#schedulecall) | `POST /2/calls/scheduled` | Standard | Schedule a Call |
| [`updateScheduledCall`](#updatescheduledcall) | `PUT /2/calls/scheduled/{id}` | Standard | Update a Scheduled Call |

## `cancelScheduledCall`

DELETE `/2/calls/scheduled/{id}`

**Cancel a Scheduled Call**

Cancels a scheduled call the authenticated user organizes, and takes it off invitees' calendars. For a recurring call, scope and occurrence\_start\_time pick the occurrences: all of them (the default), one, or one and every one after it. Cancelling what is already cancelled succeeds.

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

XClient client = XClient.builder()
    .accessToken(System.getenv("X_ACCESS_TOKEN"))
    .build();

var response = client.calls().cancelScheduledCall("1895000000000000000");
System.out.println(response);
```

### Parameters

**id** `String` *required*

`id` (path parameter).

**Optional parameters (CallsClient.CancelScheduledCallOptions — 3)**

**options.scope** `String`

Which occurrences: all (the default without occurrence\_start\_time), this (the default with it), or this\_and\_following.

**options.occurrenceStartTime** `String`

Start of the occurrence that scope this or this\_and\_following refers to (RFC 3339).

**options.notifyInvitees** `Boolean`

Whether invitees get an email about it. Defaults to true.

**Returns:** `Schemas.CancelScheduledCallResponse`

***

## `createCall`

POST `/2/calls`

**Create a Call**

Starts an X call hosted by the authenticated user (typically a bot). Pass an XChat conversation\_id to start the call in that conversation, or omit it for a standalone call anyone can join with the returned join\_url (subject to join\_policy). The call starts empty: put an agent in it with POST /2/calls/:id/join. When the host joins a conversation call, the other members are rung.

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

XClient client = XClient.builder()
    .accessToken(System.getenv("X_ACCESS_TOKEN"))
    .build();

var response = client.calls().createCall(new Schemas.CreateCallRequest().audioOnly(true));
System.out.println(response);
```

### Parameters

**body** `Schemas.CreateCallRequest` *required*

Request payload.

**Returns:** `Schemas.CreateCallResponse`

***

## `getCall`

GET `/2/calls/{id}`

**Get a Call**

Returns a call's title, join policy, host and participant count, and whether the authenticated user may join it without asking the host.

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

XClient client = XClient.builder()
    .accessToken(System.getenv("X_ACCESS_TOKEN"))
    .build();

var response = client.calls().getCall("1895000000000000000");
System.out.println(response);
```

### Parameters

**id** `String` *required*

`id` (path parameter).

**Optional parameters (CallsClient.GetCallOptions — 3)**

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

A comma separated list of Call fields to display.

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

A comma separated list of fields to expand.

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

A comma separated list of User fields to display.

**Returns:** `Schemas.GetCallResponse`

***

## `getScheduledCall`

GET `/2/calls/scheduled/{id}`

**Get a Scheduled Call**

Returns a scheduled call the authenticated user organizes or is invited to, at its occurrence running now or its next one within a year: its time, call, recurrence and who is invited and how they answered. Changes can take a few seconds to show here. Use scheduled\_call.fields to select which fields are returned.

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

XClient client = XClient.builder()
    .accessToken(System.getenv("X_ACCESS_TOKEN"))
    .build();

var response = client.calls().getScheduledCall("1895000000000000000");
System.out.println(response);
```

### Parameters

**id** `String` *required*

`id` (path parameter).

**Optional parameters (CallsClient.GetScheduledCallOptions — 4)**

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

A comma separated list of ScheduledCall fields to display.

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

A comma separated list of fields to expand.

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

A comma separated list of Call fields to display.

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

A comma separated list of User fields to display.

**Returns:** `Schemas.GetScheduledCallResponse`

***

## `joinCall`

POST `/2/calls/{id}/join`

**Join a Call**

Starts a media session that takes part in the call as the authenticated user. The response carries a media\_url and a short-lived media\_token: open a WebSocket to media\_url with the token as a Bearer credential to exchange PCM16 audio and events with the call; the user enters the call when the WebSocket connects. On a closed or trusted call the session asks the host first (admission: requires\_approval).

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

XClient client = XClient.builder()
    .accessToken(System.getenv("X_ACCESS_TOKEN"))
    .build();

var response = client.calls().joinCall("1895000000000000000", new Schemas.JoinCallRequest());
System.out.println(response);
```

### Parameters

**id** `String` *required*

`id` (path parameter).

**body** `Schemas.JoinCallRequest` *required*

Request payload.

**Returns:** `Schemas.JoinCallResponse`

***

## `leaveCall`

POST `/2/calls/{id}/leave`

**Leave a Call**

Ends the authenticated user's media session in the call (its WebSocket receives session.ended with reason left) and removes the user from the call.

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

XClient client = XClient.builder()
    .accessToken(System.getenv("X_ACCESS_TOKEN"))
    .build();

var response = client.calls().leaveCall("1895000000000000000");
System.out.println(response);
```

### Parameters

**id** `String` *required*

`id` (path parameter).

**Returns:** `Schemas.LeaveCallResponse`

***

## `listScheduled`

GET `/2/calls/scheduled`

**List Scheduled Calls**

Returns the X calls on the authenticated user's calendar, earliest first: events on their X Calls calendar, and events on the Microsoft Outlook calendars they linked to X whose conference is an X call. Calls still running at start\_time are included. The window defaults to the next 24 hours and may span at most 7 days. Use scheduled\_call.fields to select which fields are returned.

When both are provided, `start_time` must be earlier than `end_time`.

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

XClient client = XClient.builder()
    .accessToken(System.getenv("X_ACCESS_TOKEN"))
    .build();

var response = client.calls().listScheduled();
System.out.println(response);
```

### Parameters

**Optional parameters (CallsClient.ListScheduledOptions — 7)**

**options.startTime** `String`

Calls still running at this time or starting after it (RFC 3339). Defaults to now.

**options.endTime** `String`

Calls starting before this time (RFC 3339). Defaults to 24 hours after start\_time.

**options.maxResults** `Integer`

The most calls to return. Defaults to 20.

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

A comma separated list of ScheduledCall fields to display.

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

A comma separated list of fields to expand.

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

A comma separated list of Call fields to display.

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

A comma separated list of User fields to display.

**Returns:** `Schemas.ListScheduledCallsResponse`

***

## `respondToScheduledCall`

POST `/2/calls/scheduled/{id}/rsvp`

**Respond to a Scheduled Call**

Accepts, declines or tentatively accepts an invitation to a scheduled call for the authenticated user. For a recurring call, scope and occurrence\_start\_time pick the occurrences the answer is for: all of them (the default), one, or one and every one after it.

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

XClient client = XClient.builder()
    .accessToken(System.getenv("X_ACCESS_TOKEN"))
    .build();

var response = client.calls().respondToScheduledCall(
    "1895000000000000000",
    new Schemas.RespondToScheduledCallRequest().response("accepted")
);
System.out.println(response);
```

### Parameters

**id** `String` *required*

`id` (path parameter).

**body** `Schemas.RespondToScheduledCallRequest` *required*

Request payload.

**Returns:** `Schemas.RespondToScheduledCallResponse`

***

## `scheduleCall`

POST `/2/calls/scheduled`

**Schedule a Call**

Puts an X call on the authenticated user's X Calls calendar, with them as its organizer, and invites people to it. The call exists right away: share its join\_url, or put an agent in it at start time with POST /2/calls/:id/join. A recurrence (an RFC 5545 RRULE) repeats it. Invitees get an email unless notify\_invitees is false.

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

XClient client = XClient.builder()
    .accessToken(System.getenv("X_ACCESS_TOKEN"))
    .build();

var response = client.calls().scheduleCall(new Schemas.ScheduleCallRequest().startTime("2026-01-01T00:00:00Z"));
System.out.println(response);
```

### Parameters

**body** `Schemas.ScheduleCallRequest` *required*

Request payload.

**Returns:** `Schemas.ScheduleCallResponse`

***

## `updateScheduledCall`

PUT `/2/calls/scheduled/{id}`

**Update a Scheduled Call**

Moves, renames or re-invites a scheduled call the authenticated user organizes. Only the fields sent change. For a recurring call, scope and occurrence\_start\_time pick the occurrences: all of them (the default), one, or one and every one after it.

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

XClient client = XClient.builder()
    .accessToken(System.getenv("X_ACCESS_TOKEN"))
    .build();

var response = client.calls().updateScheduledCall(
    "1895000000000000000",
    new Schemas.UpdateScheduledCallRequest().description("example")
);
System.out.println(response);
```

### Parameters

**id** `String` *required*

`id` (path parameter).

**body** `Schemas.UpdateScheduledCallRequest` *required*

At least one of `start_time`, `duration_minutes`, `title`, `description`, `invitee_ids`, `recurrence`, `time_zone` is required.

**Returns:** `Schemas.UpdateScheduledCallResponse`

***
