> ## 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 |
| :- | :- | :- | :- |
| [`cancel_scheduled_call`](#cancel_scheduled_call) | `DELETE /2/calls/scheduled/{id}` | Standard | Cancel a Scheduled Call |
| [`create_call`](#create_call) | `POST /2/calls` | Standard | Create a Call |
| [`get_call`](#get_call) | `GET /2/calls/{id}` | Standard | Get a Call |
| [`get_scheduled_call`](#get_scheduled_call) | `GET /2/calls/scheduled/{id}` | Standard | Get a Scheduled Call |
| [`join_call`](#join_call) | `POST /2/calls/{id}/join` | Standard | Join a Call |
| [`leave_call`](#leave_call) | `POST /2/calls/{id}/leave` | Standard | Leave a Call |
| [`list_scheduled`](#list_scheduled) | `GET /2/calls/scheduled` | Standard | List Scheduled Calls |
| [`respond_to_scheduled_call`](#respond_to_scheduled_call) | `POST /2/calls/scheduled/{id}/rsvp` | Standard | Respond to a Scheduled Call |
| [`schedule_call`](#schedule_call) | `POST /2/calls/scheduled` | Standard | Schedule a Call |
| [`update_scheduled_call`](#update_scheduled_call) | `PUT /2/calls/scheduled/{id}` | Standard | Update a Scheduled Call |

## `cancel_scheduled_call`

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.

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

client = Xdk::Client.new(access_token: ENV.fetch("X_ACCESS_TOKEN"))

response = client.calls.cancel_scheduled_call(id: "1895000000000000000")
puts response
```

### Parameters

**id** `String` *required*

`id` (path parameter).

**Optional keyword arguments (3)**

**scope** `String`

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

**occurrence\_start\_time** `String`

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

**notify\_invitees** `Boolean`

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

**Returns:** `Hash`

***

## `create_call`

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.

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

client = Xdk::Client.new(access_token: ENV.fetch("X_ACCESS_TOKEN"))

response = client.calls.create_call(body: { "audio_only" => true })
puts response
```

### Parameters

**body** `Hash` *required*

Request payload.

**Returns:** `Hash`

***

## `get_call`

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.

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

client = Xdk::Client.new(access_token: ENV.fetch("X_ACCESS_TOKEN"))

response = client.calls.get_call(id: "1895000000000000000")
puts response
```

### Parameters

**id** `String` *required*

`id` (path parameter).

**Optional keyword arguments (3)**

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

A comma separated list of Call fields to display.

**expansions** `Array\<String\>`

A comma separated list of fields to expand.

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

A comma separated list of User fields to display.

**Returns:** `Hash`

***

## `get_scheduled_call`

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.

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

client = Xdk::Client.new(access_token: ENV.fetch("X_ACCESS_TOKEN"))

response = client.calls.get_scheduled_call(id: "1895000000000000000")
puts response
```

### Parameters

**id** `String` *required*

`id` (path parameter).

**Optional keyword arguments (4)**

**scheduled\_call\_fields** `Array\<String\>`

A comma separated list of ScheduledCall fields to display.

**expansions** `Array\<String\>`

A comma separated list of fields to expand.

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

A comma separated list of Call fields to display.

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

A comma separated list of User fields to display.

**Returns:** `Hash`

***

## `join_call`

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

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

client = Xdk::Client.new(access_token: ENV.fetch("X_ACCESS_TOKEN"))

response = client.calls.join_call(
  id: "1895000000000000000",
  body: { "media" => { "audio" => { "encoding" => "example" } } }
)
puts response
```

### Parameters

**id** `String` *required*

`id` (path parameter).

**body** `Hash` *required*

Request payload.

**Returns:** `Hash`

***

## `leave_call`

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.

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

client = Xdk::Client.new(access_token: ENV.fetch("X_ACCESS_TOKEN"))

response = client.calls.leave_call(id: "1895000000000000000")
puts response
```

### Parameters

**id** `String` *required*

`id` (path parameter).

**Returns:** `Hash`

***

## `list_scheduled`

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

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

client = Xdk::Client.new(access_token: ENV.fetch("X_ACCESS_TOKEN"))

response = client.calls.list_scheduled
puts response
```

### Parameters

**Optional keyword arguments (7)**

**start\_time** `String`

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

**end\_time** `String`

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

**max\_results** `Integer`

The most calls to return. Defaults to 20.

**scheduled\_call\_fields** `Array\<String\>`

A comma separated list of ScheduledCall fields to display.

**expansions** `Array\<String\>`

A comma separated list of fields to expand.

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

A comma separated list of Call fields to display.

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

A comma separated list of User fields to display.

**Returns:** `Hash`

***

## `respond_to_scheduled_call`

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.

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

client = Xdk::Client.new(access_token: ENV.fetch("X_ACCESS_TOKEN"))

response = client.calls.respond_to_scheduled_call(id: "1895000000000000000", body: { "response" => "accepted" })
puts response
```

### Parameters

**id** `String` *required*

`id` (path parameter).

**body** `Hash` *required*

Request payload.

**Returns:** `Hash`

***

## `schedule_call`

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.

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

client = Xdk::Client.new(access_token: ENV.fetch("X_ACCESS_TOKEN"))

response = client.calls.schedule_call(body: { "start_time" => "2026-01-01T00:00:00Z" })
puts response
```

### Parameters

**body** `Hash` *required*

Request payload.

**Returns:** `Hash`

***

## `update_scheduled_call`

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.

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

client = Xdk::Client.new(access_token: ENV.fetch("X_ACCESS_TOKEN"))

response = client.calls.update_scheduled_call(id: "1895000000000000000", body: { "description" => "example" })
puts response
```

### Parameters

**id** `String` *required*

`id` (path parameter).

**body** `Hash` *required*

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

**Returns:** `Hash`

***
