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

# BroadcastsClient

> Methods for X API v2 Broadcasts endpoints.

Access **Broadcasts** endpoints via `client.broadcasts` (`BroadcastsClient`).

## Methods

| Method | Endpoint | Behavior | Summary |
| :- | :- | :- | :- |
| [`add_chat_moderator`](#add_chat_moderator) | `POST /2/broadcasts/chat/moderators` | Standard | Add a Chat Moderator |
| [`create_broadcast`](#create_broadcast) | `POST /2/broadcasts` | Standard | Go Live on a Source |
| [`create_scheduled_broadcast`](#create_scheduled_broadcast) | `POST /2/broadcasts/scheduled` | Standard | Create a Scheduled Broadcast |
| [`create_source`](#create_source) | `POST /2/sources` | Standard | Create a Stream Source |
| [`create_user_broadcast`](#create_user_broadcast) | `POST /2/users/{id}/broadcasts` | Standard | Create a Broadcast on a User's Source |
| [`create_user_source`](#create_user_source) | `POST /2/users/{id}/sources` | Standard | Create a Stream Source for a User |
| [`delete_broadcast`](#delete_broadcast) | `DELETE /2/broadcasts/{id}` | Standard | Delete a Broadcast |
| [`delete_broadcast_chat_message`](#delete_broadcast_chat_message) | `DELETE /2/broadcasts/{id}/chat/{message_id}` | Standard | Remove a Chat Message from a Live Broadcast |
| [`delete_scheduled_broadcast`](#delete_scheduled_broadcast) | `DELETE /2/broadcasts/scheduled/{id}` | Standard | Delete a Scheduled Broadcast |
| [`delete_source`](#delete_source) | `DELETE /2/sources/{id}` | Standard | Delete a Stream Source |
| [`delete_user_broadcast`](#delete_user_broadcast) | `DELETE /2/users/{id}/broadcasts/{broadcast_id}` | Standard | Delete a User's Broadcast |
| [`delete_user_source`](#delete_user_source) | `DELETE /2/users/{id}/sources/{source_id}` | Standard | Delete a User's Stream Source |
| [`get_broadcast`](#get_broadcast) | `GET /2/broadcasts/{id}` | Standard | Get a Broadcast |
| [`get_broadcast_chat`](#get_broadcast_chat) | `GET /2/broadcasts/{id}/chat` | Paginated | Get Broadcast Chat History |
| [`get_chat_moderators`](#get_chat_moderators) | `GET /2/broadcasts/chat/moderators` | Standard | Get Chat Moderators |
| [`get_chat_muted_users`](#get_chat_muted_users) | `GET /2/broadcasts/chat/mutes` | Paginated | Get Muted Chat Users |
| [`get_region`](#get_region) | `GET /2/region` | Standard | Get the Ingest Region |
| [`get_scheduled_broadcast`](#get_scheduled_broadcast) | `GET /2/broadcasts/scheduled/{id}` | Standard | Get a Scheduled Broadcast |
| [`get_source`](#get_source) | `GET /2/sources/{id}` | Standard | Get a Stream Source |
| [`get_source_stream_key`](#get_source_stream_key) | `GET /2/sources/{id}/stream_key` | Standard | Get a Stream Source's Stream Key |
| [`get_user_broadcast`](#get_user_broadcast) | `GET /2/users/{id}/broadcasts/{broadcast_id}` | Standard | Get a User's Broadcast |
| [`get_user_source`](#get_user_source) | `GET /2/users/{id}/sources/{source_id}` | Standard | Get a User's Stream Source |
| [`go_live_scheduled_broadcast`](#go_live_scheduled_broadcast) | `POST /2/broadcasts/scheduled/{id}/live` | Standard | Go Live on a Scheduled Broadcast |
| [`list`](#list) | `GET /2/broadcasts` | Paginated | List Broadcasts |
| [`list_live_categories`](#list_live_categories) | `GET /2/broadcasts/categories` | Standard | List Live Categories |
| [`list_scheduled`](#list_scheduled) | `GET /2/broadcasts/scheduled` | Paginated | List Scheduled Broadcasts |
| [`list_sources`](#list_sources) | `GET /2/sources` | Standard | List Stream Sources |
| [`list_user`](#list_user) | `GET /2/users/{id}/broadcasts` | Paginated | List a User's Broadcasts |
| [`list_user_sources`](#list_user_sources) | `GET /2/users/{id}/sources` | Standard | List a User's Stream Sources |
| [`mute_broadcast_chat_user`](#mute_broadcast_chat_user) | `POST /2/broadcasts/{id}/chat/mutes` | Standard | Mute or Time Out a User in a Broadcast Chat |
| [`mute_chat_user`](#mute_chat_user) | `POST /2/broadcasts/chat/mutes` | Standard | Mute or Time Out a User in Chat |
| [`remove_chat_moderator`](#remove_chat_moderator) | `DELETE /2/broadcasts/chat/moderators/{user_id}` | Standard | Remove a Chat Moderator |
| [`send_broadcast_chat`](#send_broadcast_chat) | `POST /2/broadcasts/{id}/chat` | Standard | Send a Chat Message to a Live Broadcast |
| [`unmute_broadcast_chat_user`](#unmute_broadcast_chat_user) | `DELETE /2/broadcasts/{id}/chat/mutes/{user_id}` | Standard | Unmute a User in a Broadcast Chat |
| [`unmute_chat_user`](#unmute_chat_user) | `DELETE /2/broadcasts/chat/mutes/{user_id}` | Standard | Unmute a User in Chat |
| [`update_broadcast`](#update_broadcast) | `PUT /2/broadcasts/{id}` | Standard | Update a Broadcast |
| [`update_broadcast_state`](#update_broadcast_state) | `PUT /2/broadcasts/{id}/state` | Standard | End a Broadcast |
| [`update_scheduled_broadcast`](#update_scheduled_broadcast) | `PUT /2/broadcasts/scheduled/{id}` | Standard | Update a Scheduled Broadcast |
| [`update_source`](#update_source) | `PUT /2/sources/{id}` | Standard | Rename a Stream Source |
| [`update_user_broadcast_state`](#update_user_broadcast_state) | `PUT /2/users/{id}/broadcasts/{broadcast_id}/state` | Standard | Publish or End a User's Broadcast |
| [`update_user_source`](#update_user_source) | `PUT /2/users/{id}/sources/{source_id}` | Standard | Rename a User's Stream Source |

## `add_chat_moderator`

POST `/2/broadcasts/chat/moderators`

**Add a Chat Moderator**

Adds a moderator to the authenticated broadcaster's persistent list and returns the updated moderator user IDs. The list applies to all current and future broadcast chats.

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

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

response = client.broadcasts.add_chat_moderator(body: { "user_id" => "2244994945" })
puts response
```

### Parameters

**body** `Hash` *required*

Request payload.

**Returns:** `Hash`

***

## `create_broadcast`

POST `/2/broadcasts`

**Go Live on a Source**

Takes one or more of the authenticated user's sources live and returns 201 with the new broadcast. Several sources (`source_id` plus `additional_source_ids`, one per video format) go live together as one broadcast; they must all be RTMP sources in one region, and when one of them is already live its broadcast is returned only if it holds every listed source. The broadcast goes live immediately (state `RUNNING`), even before the encoder sends video, and is ended (`TIMED_OUT`) if no video arrives within 5 minutes. It is announced in a Post unless `should_not_tweet` is true. When the source already has a live broadcast, returns 200 with that broadcast unchanged and ignores the request's `title`, `locale`, `chat_option` and `should_not_tweet`. A missing `tweet_id` means the Post hasn't been created yet, was suppressed with `should_not_tweet`, or could not be created; read it later with GET /2/broadcasts/:id. A 409 `conflict` means the source can't go live right now: either it can't take video before the encoder connects (external HLS sources, or regions where this isn't available), so retry once video is flowing, or another broadcast is live on it, so END that broadcast first. The `detail` says which, and names the live broadcast when known.

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

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

response = client.broadcasts.create_broadcast(body: { "source_id" => "1895000000000000000" })
puts response
```

### Parameters

**body** `Hash` *required*

Request payload.

**Returns:** `Hash`

***

## `create_scheduled_broadcast`

POST `/2/broadcasts/scheduled`

**Create a Scheduled Broadcast**

Schedules a broadcast for the authenticated user on one of their sources: `source_id` is required. Passing a stream key as `source_id` is deprecated and stops working when the /2/users/:id/sources and /2/users/:id/broadcasts routes reach end of life on January 1, 2027; pass the source's `id` from GET /2/sources instead.

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

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

response = client.broadcasts.create_scheduled_broadcast(
  body: { "source_id" => "1895000000000000000", "scheduled_start_ms" => "example" }
)
puts response
```

### Parameters

**body** `Hash` *required*

Request payload.

**Returns:** `Hash`

***

## `create_source`

POST `/2/sources`

**Create a Stream Source**

Creates a persistent RTMP/RTMPS ingest point for the authenticated user. Push an encoder to `rtmps_url` with the returned `stream_key`. This is the only response that includes the stream key; read it later with GET /2/sources/:id/stream\_key.

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

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

response = client.broadcasts.create_source(body: { "name" => "My List", "region" => "example" })
puts response
```

### Parameters

**body** `Hash` *required*

Request payload.

**Returns:** `Hash`

***

## `create_user_broadcast`

POST `/2/users/{id}/broadcasts`

**Create a Broadcast on a User's Source**

Creates a broadcast on one of the authenticated user's sources. `id` must be the authenticated user. The broadcast is `NOT_STARTED` and posts nothing until it is published with PUT /2/users/:id/broadcasts/:broadcast\_id/state; one that is never published is deleted after 7 days. When the source already has a running broadcast, that broadcast is returned.

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

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

response = client.broadcasts.create_user_broadcast(id: "2244994945", body: { "source_id" => "1895000000000000000" })
puts response
```

### Parameters

**id** `String` *required*

`id` (path parameter).

**body** `Hash` *required*

Request payload.

**Returns:** `Hash`

***

## `create_user_source`

POST `/2/users/{id}/sources`

**Create a Stream Source for a User**

Creates a persistent RTMP/RTMPS ingest point for the authenticated user. `id` must be the authenticated user.

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

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

response = client.broadcasts.create_user_source(id: "2244994945", body: { "name" => "My List" })
puts response
```

### Parameters

**id** `String` *required*

`id` (path parameter).

**body** `Hash` *required*

Request payload.

**Returns:** `Hash`

***

## `delete_broadcast`

DELETE `/2/broadcasts/{id}`

**Delete a Broadcast**

Deletes one of the authenticated user's broadcasts, scheduled or ended, including its replay. A running broadcast must be ended first.

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

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

response = client.broadcasts.delete_broadcast(id: "1895000000000000000")
puts response
```

### Parameters

**id** `String` *required*

`id` (path parameter).

**Returns:** `Hash`

***

## `delete_broadcast_chat_message`

DELETE `/2/broadcasts/{id}/chat/{message_id}`

**Remove a Chat Message from a Live Broadcast**

Removes a specific chat message from a running broadcast where the authenticated user is the host or a moderator.

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

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

response = client.broadcasts.delete_broadcast_chat_message(id: "1895000000000000000", message_id: "1895000000000000000")
puts response
```

### Parameters

**id** `String` *required*

`id` (path parameter).

**message\_id** `String` *required*

`message_id` (path parameter).

**Returns:** `Hash`

***

## `delete_scheduled_broadcast`

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

**Delete a Scheduled Broadcast**

Deletes a scheduled broadcast by its alphanumeric broadcast id.

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

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

response = client.broadcasts.delete_scheduled_broadcast(id: "1895000000000000000")
puts response
```

### Parameters

**id** `String` *required*

`id` (path parameter).

**Optional keyword arguments (1)**

**roll\_forward** `Boolean`

Deprecated: recurring schedules are being retired and `true` will be rejected.

**Returns:** `Hash`

***

## `delete_source`

DELETE `/2/sources/{id}`

**Delete a Stream Source**

Deletes one of the authenticated user's stream sources.

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

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

response = client.broadcasts.delete_source(id: "1895000000000000000")
puts response
```

### Parameters

**id** `String` *required*

Source id (19 digits), from GET /2/sources.

**Returns:** `Hash`

***

## `delete_user_broadcast`

DELETE `/2/users/{id}/broadcasts/{broadcast_id}`

**Delete a User's Broadcast**

Deletes one of the authenticated user's broadcasts. `id` must be the authenticated user. Deprecated: use DELETE /2/broadcasts/:id.

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

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

response = client.broadcasts.delete_user_broadcast(id: "2244994945", broadcast_id: "1895000000000000000")
puts response
```

### Parameters

**id** `String` *required*

`id` (path parameter).

**broadcast\_id** `String` *required*

`broadcast_id` (path parameter).

**Returns:** `Hash`

***

## `delete_user_source`

DELETE `/2/users/{id}/sources/{source_id}`

**Delete a User's Stream Source**

Deletes one of the authenticated user's stream sources. `id` must be the authenticated user. Success is an empty object.

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

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

response = client.broadcasts.delete_user_source(id: "2244994945", source_id: "1895000000000000000")
puts response
```

### Parameters

**id** `String` *required*

`id` (path parameter).

**source\_id** `String` *required*

`source_id` (path parameter).

**Returns:** `Hash`

***

## `get_broadcast`

GET `/2/broadcasts/{id}`

**Get a Broadcast**

Returns a broadcast owned by the authenticated user.

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

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

response = client.broadcasts.get_broadcast(id: "1895000000000000000")
puts response
```

### Parameters

**id** `String` *required*

`id` (path parameter).

**Optional keyword arguments (1)**

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

A comma separated list of Broadcast fields to display.

**Returns:** `Hash`

***

## `get_broadcast_chat`

GET `/2/broadcasts/{id}/chat` Paginated

**Get Broadcast Chat History**

Returns newest-first chat messages for a broadcast owned by the authenticated user.

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

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

client.broadcasts.get_broadcast_chat(id: "1895000000000000000").each do |page|
  puts page["data"]
end
```

### Parameters

**id** `String` *required*

`id` (path parameter).

**Optional keyword arguments (5)**

**max\_results** `Integer`

`max_results` (query parameter).

**pagination\_token** `String`

A 64-bit signed integer.

**broadcast\_chat\_message\_fields** `Array\<String\>`

A comma separated list of BroadcastChatMessage 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:** `Enumerator<Hash>`

***

## `get_chat_moderators`

GET `/2/broadcasts/chat/moderators`

**Get Chat Moderators**

Returns the authenticated broadcaster's persistent moderators as User resources. The list applies to all of their current and future broadcast chats.

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

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

response = client.broadcasts.get_chat_moderators
puts response
```

### Parameters

**Optional keyword arguments (3)**

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

A comma separated list of User fields to display.

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

A comma separated list of fields to expand.

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

A comma separated list of Post fields to display.

**Returns:** `Hash`

***

## `get_chat_muted_users`

GET `/2/broadcasts/chat/mutes` Paginated

**Get Muted Chat Users**

Returns the users muted in the authenticated broadcaster's chat, with the expiry time of timed mutes. Mutes apply to all of their broadcasts. Expired timed mutes are omitted. Use `expansions=user_id` to include the muted users.

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

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

client.broadcasts.get_chat_muted_users.each do |page|
  puts page["data"]
end
```

### Parameters

**Optional keyword arguments (5)**

**max\_results** `Integer`

`max_results` (query parameter).

**pagination\_token** `String`

`pagination_token` (query parameter).

**broadcast\_chat\_mute\_fields** `Array\<String\>`

A comma separated list of BroadcastChatMute 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:** `Enumerator<Hash>`

***

## `get_region`

GET `/2/region`

**Get the Ingest Region**

Returns the ingest region nearest the server handling the request. Pass it as `region` when creating a stream source to ingest there.

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

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

response = client.broadcasts.get_region
puts response
```

**Returns:** `Hash`

***

## `get_scheduled_broadcast`

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

**Get a Scheduled Broadcast**

Returns a single scheduled broadcast by its alphanumeric broadcast id.

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

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

response = client.broadcasts.get_scheduled_broadcast(id: "1895000000000000000")
puts response
```

### Parameters

**id** `String` *required*

`id` (path parameter).

**Returns:** `Hash`

***

## `get_source`

GET `/2/sources/{id}`

**Get a Stream Source**

Returns one of the authenticated user's stream sources. Poll it after starting an encoder and wait for `is_stream_active` before going live. The stream key is not included; read it with GET /2/sources/:id/stream\_key.

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

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

response = client.broadcasts.get_source(id: "1895000000000000000")
puts response
```

### Parameters

**id** `String` *required*

Source id (19 digits), from GET /2/sources.

**Returns:** `Hash`

***

## `get_source_stream_key`

GET `/2/sources/{id}/stream_key`

**Get a Stream Source's Stream Key**

Returns the stream key of one of the authenticated user's stream sources. The stream key is a credential: anyone with it can stream to the source, so keep it out of logs, URLs and client-side code.

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

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

response = client.broadcasts.get_source_stream_key(id: "1895000000000000000")
puts response
```

### Parameters

**id** `String` *required*

Source id (19 digits), from GET /2/sources.

**Returns:** `Hash`

***

## `get_user_broadcast`

GET `/2/users/{id}/broadcasts/{broadcast_id}`

**Get a User's Broadcast**

Returns one of the authenticated user's broadcasts. `id` must be the authenticated user. Deprecated: use GET /2/broadcasts/:id.

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

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

response = client.broadcasts.get_user_broadcast(id: "2244994945", broadcast_id: "1895000000000000000")
puts response
```

### Parameters

**id** `String` *required*

`id` (path parameter).

**broadcast\_id** `String` *required*

`broadcast_id` (path parameter).

**Returns:** `Hash`

***

## `get_user_source`

GET `/2/users/{id}/sources/{source_id}`

**Get a User's Stream Source**

Returns one of the authenticated user's stream sources. `id` must be the authenticated user.

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

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

response = client.broadcasts.get_user_source(id: "2244994945", source_id: "1895000000000000000")
puts response
```

### Parameters

**id** `String` *required*

`id` (path parameter).

**source\_id** `String` *required*

`source_id` (path parameter).

**Returns:** `Hash`

***

## `go_live_scheduled_broadcast`

POST `/2/broadcasts/scheduled/{id}/live`

**Go Live on a Scheduled Broadcast**

Publishes a schedule that was created or updated with `manual_publish: true`. Without that flag the coordinator auto-publishes at start and this call is rejected.

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

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

response = client.broadcasts.go_live_scheduled_broadcast(id: "1895000000000000000")
puts response
```

### Parameters

**id** `String` *required*

`id` (path parameter).

**Returns:** `Hash`

***

## `list`

GET `/2/broadcasts` Paginated

**List Broadcasts**

Returns the authenticated user's live-video broadcasts, or selected owned broadcasts when ids are provided.

At most one of `ids`, `max_results` may be provided. At most one of `ids`, `pagination_token` may be provided.

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

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

client.broadcasts.list.each do |page|
  puts page["data"]
end
```

### Parameters

**Optional keyword arguments (4)**

**ids** `Array\<String\>`

Comma-separated broadcast IDs to retrieve instead of listing broadcasts.

**max\_results** `Integer`

`max_results` (query parameter).

**pagination\_token** `String`

`pagination_token` (query parameter).

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

A comma separated list of Broadcast fields to display.

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

***

## `list_live_categories`

GET `/2/broadcasts/categories`

**List Live Categories**

Returns the live categories a host can pick when going live, in display order. Pass a category's `id` as `live_category_id` on POST /2/broadcasts. Ids are permanent; names can change, so store the id and show the current name. The whole list is returned in one response, without paging.

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

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

response = client.broadcasts.list_live_categories
puts response
```

**Returns:** `Hash`

***

## `list_scheduled`

GET `/2/broadcasts/scheduled` Paginated

**List Scheduled Broadcasts**

Returns scheduled broadcasts owned by the authenticated user.

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

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

client.broadcasts.list_scheduled.each do |page|
  puts page["data"]
end
```

### Parameters

**Optional keyword arguments (4)**

**max\_results** `Integer`

`max_results` (query parameter).

**oldest\_start\_time** `String`

`oldest_start_time` (query parameter).

**newest\_start\_time** `String`

`newest_start_time` (query parameter).

**pagination\_token** `String`

`pagination_token` (query parameter).

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

***

## `list_sources`

GET `/2/sources`

**List Stream Sources**

Returns the authenticated user's RTMP/RTMPS stream sources. A source's `id` is the `source_id` that POST /2/broadcasts and scheduled broadcasts take. Stream keys are not included; read one with GET /2/sources/:id/stream\_key.

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

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

response = client.broadcasts.list_sources
puts response
```

**Returns:** `Hash`

***

## `list_user`

GET `/2/users/{id}/broadcasts` Paginated

**List a User's Broadcasts**

Returns the authenticated user's broadcasts, 100 per page. `id` must be the authenticated user. Deprecated: use GET /2/broadcasts.

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

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

client.broadcasts.list_user(id: "2244994945").each do |page|
  puts page["data"]
end
```

### Parameters

**id** `String` *required*

`id` (path parameter).

**Optional keyword arguments (1)**

**pagination\_token** `String`

`next_token.offset` from the previous page. Empty reads the first page.

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

***

## `list_user_sources`

GET `/2/users/{id}/sources`

**List a User's Stream Sources**

Returns the authenticated user's RTMP/RTMPS stream sources (empty array if none). `id` must be the authenticated user.

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

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

response = client.broadcasts.list_user_sources(id: "2244994945")
puts response
```

### Parameters

**id** `String` *required*

`id` (path parameter).

**Returns:** `Hash`

***

## `mute_broadcast_chat_user`

POST `/2/broadcasts/{id}/chat/mutes`

**Mute or Time Out a User in a Broadcast Chat**

Prevents a user from posting further messages in a running broadcast chat. When `end_at_ms` is provided, the mute expires at that time. The authenticated user must be the broadcast host or a moderator.

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

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

response = client.broadcasts.mute_broadcast_chat_user(id: "1895000000000000000", body: { "user_id" => "2244994945" })
puts response
```

### Parameters

**id** `String` *required*

`id` (path parameter).

**body** `Hash` *required*

Request payload.

**Returns:** `Hash`

***

## `mute_chat_user`

POST `/2/broadcasts/chat/mutes`

**Mute or Time Out a User in Chat**

Prevents a user from posting messages in all of a broadcaster's chats. Without `broadcast_id` or `host_id`, the user is muted in the authenticated user's own chats. Moderators pass `host_id`, or the `broadcast_id` of a live broadcast, to mute the user in that host's chats. When `end_at_ms` is provided, the mute expires at that time.

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

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

response = client.broadcasts.mute_chat_user(body: { "user_id" => "2244994945" })
puts response
```

### Parameters

**body** `Hash` *required*

Request payload.

**Returns:** `Hash`

***

## `remove_chat_moderator`

DELETE `/2/broadcasts/chat/moderators/{user_id}`

**Remove a Chat Moderator**

Removes a moderator from the authenticated broadcaster's persistent list and returns the updated moderator user IDs.

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

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

response = client.broadcasts.remove_chat_moderator(user_id: "2244994945")
puts response
```

### Parameters

**user\_id** `String` *required*

A 64-bit signed integer.

**Returns:** `Hash`

***

## `send_broadcast_chat`

POST `/2/broadcasts/{id}/chat`

**Send a Chat Message to a Live Broadcast**

Posts a chat message to a running broadcast, attributed to the authenticated user.

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

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

response = client.broadcasts.send_broadcast_chat(id: "1895000000000000000", body: { "text" => "Hello from XDK!" })
puts response
```

### Parameters

**id** `String` *required*

`id` (path parameter).

**body** `Hash` *required*

Request payload.

**Returns:** `Hash`

***

## `unmute_broadcast_chat_user`

DELETE `/2/broadcasts/{id}/chat/mutes/{user_id}`

**Unmute a User in a Broadcast Chat**

Allows a muted user to post messages in a running broadcast chat again. The authenticated user must be the broadcast host or a moderator.

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

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

response = client.broadcasts.unmute_broadcast_chat_user(id: "1895000000000000000", user_id: "2244994945")
puts response
```

### Parameters

**id** `String` *required*

`id` (path parameter).

**user\_id** `String` *required*

A 64-bit signed integer.

**Returns:** `Hash`

***

## `unmute_chat_user`

DELETE `/2/broadcasts/chat/mutes/{user_id}`

**Unmute a User in Chat**

Allows a muted user to post messages in a broadcaster's chats again. Without `broadcast_id` or `host_id`, the user is unmuted in the authenticated user's own chats. Moderators pass `host_id`, or the `broadcast_id` of a live broadcast, to unmute the user in that host's chats.

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

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

response = client.broadcasts.unmute_chat_user(user_id: "2244994945")
puts response
```

### Parameters

**user\_id** `String` *required*

A 64-bit signed integer.

**Optional keyword arguments (2)**

**broadcast\_id** `String`

A live broadcast whose host's chats the user is unmuted in. Cannot be combined with `host_id`.

**host\_id** `String`

The host whose chats the user is unmuted in. The authenticated user must be that host or one of their moderators. The host does not need to be live. Cannot be combined with `broadcast_id`. A 64-bit signed integer.

**Returns:** `Hash`

***

## `update_broadcast`

PUT `/2/broadcasts/{id}`

**Update a Broadcast**

Changes the title, chat option or live category of one of the authenticated user's broadcasts and returns the broadcast. Send at least one of `title`, `chat_option` and `live_category_id`; fields left out keep their values. A broadcast can be updated before it starts, while it is live and after it has ended. A 409 `conflict` means the broadcast can't be edited, for example because it was deleted or moderated.

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

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

response = client.broadcasts.update_broadcast(id: "1895000000000000000", body: { "chat_option" => 1 })
puts response
```

### Parameters

**id** `String` *required*

`id` (path parameter).

**body** `Hash` *required*

Request payload.

**Returns:** `Hash`

***

## `update_broadcast_state`

PUT `/2/broadcasts/{id}/state`

**End a Broadcast**

Ends one of the authenticated user's broadcasts. Only `state: END` is supported.

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

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

response = client.broadcasts.update_broadcast_state(id: "1895000000000000000", body: { "state" => "example" })
puts response
```

### Parameters

**id** `String` *required*

`id` (path parameter).

**body** `Hash` *required*

Request payload.

**Returns:** `Hash`

***

## `update_scheduled_broadcast`

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

**Update a Scheduled Broadcast**

Updates a scheduled broadcast. Path `:id` is the broadcast id; the body must include `scheduled_broadcast_id`. Re-send every field that should be kept. Passing a stream key as `source_id` is deprecated and stops working when the /2/users/:id/sources and /2/users/:id/broadcasts routes reach end of life on January 1, 2027; pass the source's `id` from GET /2/sources instead.

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

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

response = client.broadcasts.update_scheduled_broadcast(
  id: "1895000000000000000",
  body: { "scheduled_broadcast_id" => "1895000000000000000", "scheduled_start_ms" => "example", "scheduled_end_ms" => "example" }
)
puts response
```

### Parameters

**id** `String` *required*

`id` (path parameter).

**body** `Hash` *required*

Request payload.

**Returns:** `Hash`

***

## `update_source`

PUT `/2/sources/{id}`

**Rename a Stream Source**

Renames one of the authenticated user's stream sources.

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

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

response = client.broadcasts.update_source(id: "1895000000000000000", body: { "name" => "My List" })
puts response
```

### Parameters

**id** `String` *required*

Source id (19 digits), from GET /2/sources.

**body** `Hash` *required*

Request payload.

**Returns:** `Hash`

***

## `update_user_broadcast_state`

PUT `/2/users/{id}/broadcasts/{broadcast_id}/state`

**Publish or End a User's Broadcast**

Publishes or ends one of the authenticated user's broadcasts. `id` must be the authenticated user. `PUBLISH` takes a broadcast created with POST /2/users/:id/broadcasts live once its source is receiving video, and posts it unless `should_not_tweet` is true. `END` ends the broadcast. Deprecated: use PUT /2/broadcasts/:id/state to end a broadcast.

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

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

response = client.broadcasts.update_user_broadcast_state(
  id: "2244994945",
  broadcast_id: "1895000000000000000",
  body: { "state" => "example" }
)
puts response
```

### Parameters

**id** `String` *required*

`id` (path parameter).

**broadcast\_id** `String` *required*

`broadcast_id` (path parameter).

**body** `Hash` *required*

Request payload.

**Returns:** `Hash`

***

## `update_user_source`

PUT `/2/users/{id}/sources/{source_id}`

**Rename a User's Stream Source**

Renames one of the authenticated user's stream sources. `id` must be the authenticated user.

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

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

response = client.broadcasts.update_user_source(
  id: "2244994945",
  source_id: "1895000000000000000",
  body: { "name" => "My List" }
)
puts response
```

### Parameters

**id** `String` *required*

`id` (path parameter).

**source\_id** `String` *required*

`source_id` (path parameter).

**body** `Hash` *required*

Request payload.

**Returns:** `Hash`

***
