Live Chat
Get Chat History
GET /2/broadcasts/:id/chat returns a paginated list of timestamped chat messages for a broadcast owned by the authenticated user, available after the broadcast has finished.
GET
/
2
/
broadcasts
/
{id}
/
chat
Get broadcast chat history
curl --request GET \
--url https://api.x.com/2/broadcasts/{id}/chat \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.x.com/2/broadcasts/{id}/chat"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.x.com/2/broadcasts/{id}/chat', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.x.com/2/broadcasts/{id}/chat",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.x.com/2/broadcasts/{id}/chat"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.x.com/2/broadcasts/{id}/chat")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.x.com/2/broadcasts/{id}/chat")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"data": [
{
"author_id": "<string>",
"author_name": "<string>",
"author_username": "<string>",
"broadcast_id": "<string>",
"created_at_ms": "<string>",
"id": "<string>",
"reply_to": "<string>",
"text": "<string>"
}
],
"errors": [
{
"detail": "<string>",
"resource_type": "<string>",
"title": "<string>",
"type": "https://api.x.com/2/problems/resource-not-found",
"parameter": "<string>",
"resource_id": "<string>",
"status": 123,
"value": "<string>"
}
],
"includes": {
"calls": [
{
"conversation_id": "<string>",
"created_at": "<string>",
"host_id": "<string>",
"id": "<string>",
"join_policy": "<string>",
"join_url": "<string>",
"participant_count": 123,
"title": "<string>",
"viewer_may_join": true
}
],
"media": [
{
"alt_text": "<string>",
"duration_ms": 123,
"height": 123,
"media_key": "<string>",
"non_public_metrics": {
"playback_0_count": 123,
"playback_100_count": 123,
"playback_25_count": 123,
"playback_50_count": 123,
"playback_75_count": 123
},
"organic_metrics": {
"playback_0_count": 123,
"playback_100_count": 123,
"playback_25_count": 123,
"playback_50_count": 123,
"playback_75_count": 123,
"view_count": 123
},
"preview_image_url": "<string>",
"promoted_metrics": {
"playback_0_count": 123,
"playback_100_count": 123,
"playback_25_count": 123,
"playback_50_count": 123,
"playback_75_count": 123,
"view_count": 123
},
"public_metrics": {
"view_count": 123
},
"type": "<string>",
"url": "<string>",
"variants": [
{
"bit_rate": 123,
"content_type": "<string>",
"url": "<string>"
}
],
"width": 123
}
],
"places": [
{
"contained_within": [
"<string>"
],
"country": "<string>",
"country_code": "<string>",
"full_name": "<string>",
"geo": {
"bbox": [
123
],
"properties": {},
"type": "Feature"
},
"id": "<string>",
"name": "<string>",
"place_type": "<string>"
}
],
"polls": [
{
"duration_minutes": 123,
"end_datetime": "<string>",
"id": "<string>",
"options": [
{
"label": "<string>",
"position": 123,
"votes": 123
}
],
"voting_status": "<string>"
}
],
"posts": [
{
"article": {},
"article_title": {},
"attachments": {
"media_keys": [
"<string>"
],
"media_source_tweet_id": [
"<string>"
],
"poll_ids": [
"<string>"
]
},
"author_id": "<string>",
"card_uri": "<string>",
"community_id": "<string>",
"context_annotations": [
{
"domain": {
"description": "<string>",
"id": "<string>",
"name": "<string>"
},
"entity": {
"description": "<string>",
"id": "<string>",
"name": "<string>"
}
}
],
"conversation_id": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"display_text_range": [
123
],
"edit_controls": {
"editable_until": "<string>",
"edits_remaining": 123,
"is_edit_eligible": true
},
"edit_history_post_ids": [
"<string>"
],
"entities": {
"cashtags": [
{
"end": 123,
"start": 123,
"tag": "<string>"
}
],
"hashtags": [
{
"end": 123,
"start": 123,
"tag": "<string>"
}
],
"mentions": [
{
"end": 123,
"start": 123,
"id": "<string>",
"username": "<string>"
}
],
"urls": [
{
"end": 123,
"start": 123,
"description": "<string>",
"display_url": "<string>",
"expanded_url": "<string>",
"images": [
{
"height": 123,
"url": "<string>",
"width": 123
}
],
"media_key": "<string>",
"status": 123,
"title": "<string>",
"unwound_url": "<string>",
"url": "<string>"
}
]
},
"geo": {
"coordinates": {
"coordinates": [
123
],
"type": "Point"
},
"place_id": "<string>"
},
"id": "<string>",
"in_reply_to_user_id": "<string>",
"lang": "<string>",
"matched_media_notes": [
{
"match_status": "<string>",
"note_id": "<string>"
}
],
"media_metadata": [
{
"alt_text": "<string>",
"description": "<string>",
"media_key": "<string>",
"title": "<string>"
}
],
"non_public_metrics": {},
"note_post": {
"text": "<string>",
"entities": {
"cashtags": [
{
"end": 123,
"start": 123,
"tag": "<string>"
}
],
"hashtags": [
{
"end": 123,
"start": 123,
"tag": "<string>"
}
],
"mentions": [
{
"end": 123,
"start": 123,
"id": "<string>",
"username": "<string>"
}
],
"urls": [
{
"end": 123,
"start": 123,
"display_url": "<string>",
"expanded_url": "<string>",
"url": "<string>"
}
]
}
},
"note_request_suggestions": [
{
"source_link": "<string>",
"suggestion": "<string>",
"suggestion_id": "<string>"
}
],
"organic_metrics": {},
"paid_partnership": true,
"possibly_sensitive": true,
"promoted_metrics": {},
"public_metrics": {
"bookmark_count": 123,
"impression_count": 123,
"like_count": 123,
"quote_count": 123,
"reply_count": 123,
"repost_count": 123
},
"referenced_posts": [
{
"id": "<string>",
"type": "retweeted"
}
],
"reply_settings": "<string>",
"scopes": {
"followers": true
},
"source": "<string>",
"suggested_source_links": [
"<string>"
],
"suggested_source_links_with_counts": [
{
"count": 123,
"url": "<string>"
}
],
"text": "<string>",
"username": "<string>",
"withheld": {
"copyright": true,
"country_codes": [
"<string>"
],
"scope": "post"
}
}
],
"topics": [
{
"description": "<string>",
"id": "<string>",
"name": "<string>"
}
],
"users": [
{
"active_follower_count": 123,
"affiliation": {
"badge_url": "<string>",
"description": "<string>",
"url": "<string>",
"user_id": [
"<string>"
]
},
"confirmed_email": "<string>",
"connection_status": [
"blocking"
],
"created_at": "2023-11-07T05:31:56Z",
"description": "<string>",
"entities": {
"description": {
"cashtags": [
{
"end": 123,
"start": 123,
"tag": "<string>"
}
],
"hashtags": [
{
"end": 123,
"start": 123,
"tag": "<string>"
}
],
"mentions": [
{
"end": 123,
"start": 123,
"username": "<string>",
"id": "<string>"
}
],
"urls": [
{
"end": 123,
"start": 123,
"url": "<string>",
"description": "<string>",
"display_url": "<string>",
"expanded_url": "<string>",
"images": [
{
"height": 123,
"url": "<string>",
"width": 123
}
],
"media_key": "<string>",
"status": 123,
"title": "<string>",
"unwound_url": "<string>"
}
]
},
"url": {
"urls": [
{
"end": 123,
"start": 123,
"url": "<string>",
"description": "<string>",
"display_url": "<string>",
"expanded_url": "<string>",
"images": [
{
"height": 123,
"url": "<string>",
"width": 123
}
],
"media_key": "<string>",
"status": 123,
"title": "<string>",
"unwound_url": "<string>"
}
]
}
},
"id": "<string>",
"is_identity_verified": true,
"location": "<string>",
"most_recent_post_id": "<string>",
"name": "<string>",
"parody": true,
"pinned_post_id": "<string>",
"profile_banner_url": "<string>",
"profile_image_url": "<string>",
"protected": true,
"public_metrics": {
"followers_count": 123,
"following_count": 123,
"listed_count": 123,
"post_count": 123,
"like_count": 123,
"media_count": 123
},
"receives_your_dm": true,
"subscriber_count": 123,
"subscribes_to_you": true,
"subscription": {
"subscribes_to_you": true
},
"subscription_type": "<string>",
"url": "<string>",
"username": "<string>",
"verified": true,
"verified_followers_count": 123,
"verified_type": "<string>",
"withheld": {
"country_codes": [
"<string>"
],
"scope": "user"
}
}
]
},
"meta": {
"next_token": "<string>",
"result_count": 123
}
}{
"code": 123,
"message": "<string>"
}Gets a paginated list of timestamped chat messages for a broadcast. Only accessible after the broadcast has finished.
:id is the alphanumeric broadcast_id, and the authenticated user must own the broadcast.
Messages are returned newest-first. Use max_results (1–200, default 100) to page, and pagination_token to continue from the meta.next_token returned by the previous response.
For live chat ingestion while a broadcast is running, use the X Activity API
broadcast.chat event instead. This endpoint is for retrieving the message history after the broadcast ends.Authorizations
OAuth2UserTokenUserToken
The access token received from the authorization server in the OAuth 2.0 flow.
Path Parameters
Pattern:
^[a-zA-Z0-9]{1,24}$Query Parameters
Required range:
1 <= x <= 200A 64-bit signed integer.
A comma separated list of BroadcastChatMessage fields to display. The fields available for a BroadcastChatMessage object.
Minimum array length:
1Available options:
author_name, author_username, broadcast_id, created_at_ms, id, reply_to, text A comma separated list of fields to expand.
Minimum array length:
1Available options:
author_id A comma separated list of User fields to display. The fields available for a User object.
Minimum array length:
1Available options:
active_follower_count, confirmed_email, connection_status, created_at, description, entities, id, is_identity_verified, location, name, parody, profile_banner_url, profile_image_url, protected, public_metrics, receives_your_dm, subscriber_count, subscribes_to_you, subscription, subscription_type, url, username, verified, verified_followers_count, verified_type, withheld Response
The request has succeeded.
Show child attributes
Show child attributes
- Option 1
- Option 2
- Option 3
- Option 4
- Option 5
- Option 6
- Option 7
- Option 8
- Option 9
- Option 10
- Option 11
- Option 12
- Option 13
- Option 14
- Option 15
- Option 16
- Option 17
- Option 18
- Option 19
- Option 20
- Option 21
- Option 22
- Option 23
- Option 24
- Option 25
- Option 26
- Option 27
- Option 28
- Option 29
- Option 30
- Option 31
- Option 32
- Option 33
- Option 34
- Option 35
- Option 36
- Option 37
- Option 38
- Option 39
- Option 40
- Option 41
- Option 42
- Option 43
- Option 44
- Option 45
- Option 46
- Option 47
- Option 48
- Option 49
- Option 50
- Option 51
- Option 52
- Option 53
- Option 54
- Option 55
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
⌘I
Get broadcast chat history
curl --request GET \
--url https://api.x.com/2/broadcasts/{id}/chat \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.x.com/2/broadcasts/{id}/chat"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.x.com/2/broadcasts/{id}/chat', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.x.com/2/broadcasts/{id}/chat",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.x.com/2/broadcasts/{id}/chat"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.x.com/2/broadcasts/{id}/chat")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.x.com/2/broadcasts/{id}/chat")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"data": [
{
"author_id": "<string>",
"author_name": "<string>",
"author_username": "<string>",
"broadcast_id": "<string>",
"created_at_ms": "<string>",
"id": "<string>",
"reply_to": "<string>",
"text": "<string>"
}
],
"errors": [
{
"detail": "<string>",
"resource_type": "<string>",
"title": "<string>",
"type": "https://api.x.com/2/problems/resource-not-found",
"parameter": "<string>",
"resource_id": "<string>",
"status": 123,
"value": "<string>"
}
],
"includes": {
"calls": [
{
"conversation_id": "<string>",
"created_at": "<string>",
"host_id": "<string>",
"id": "<string>",
"join_policy": "<string>",
"join_url": "<string>",
"participant_count": 123,
"title": "<string>",
"viewer_may_join": true
}
],
"media": [
{
"alt_text": "<string>",
"duration_ms": 123,
"height": 123,
"media_key": "<string>",
"non_public_metrics": {
"playback_0_count": 123,
"playback_100_count": 123,
"playback_25_count": 123,
"playback_50_count": 123,
"playback_75_count": 123
},
"organic_metrics": {
"playback_0_count": 123,
"playback_100_count": 123,
"playback_25_count": 123,
"playback_50_count": 123,
"playback_75_count": 123,
"view_count": 123
},
"preview_image_url": "<string>",
"promoted_metrics": {
"playback_0_count": 123,
"playback_100_count": 123,
"playback_25_count": 123,
"playback_50_count": 123,
"playback_75_count": 123,
"view_count": 123
},
"public_metrics": {
"view_count": 123
},
"type": "<string>",
"url": "<string>",
"variants": [
{
"bit_rate": 123,
"content_type": "<string>",
"url": "<string>"
}
],
"width": 123
}
],
"places": [
{
"contained_within": [
"<string>"
],
"country": "<string>",
"country_code": "<string>",
"full_name": "<string>",
"geo": {
"bbox": [
123
],
"properties": {},
"type": "Feature"
},
"id": "<string>",
"name": "<string>",
"place_type": "<string>"
}
],
"polls": [
{
"duration_minutes": 123,
"end_datetime": "<string>",
"id": "<string>",
"options": [
{
"label": "<string>",
"position": 123,
"votes": 123
}
],
"voting_status": "<string>"
}
],
"posts": [
{
"article": {},
"article_title": {},
"attachments": {
"media_keys": [
"<string>"
],
"media_source_tweet_id": [
"<string>"
],
"poll_ids": [
"<string>"
]
},
"author_id": "<string>",
"card_uri": "<string>",
"community_id": "<string>",
"context_annotations": [
{
"domain": {
"description": "<string>",
"id": "<string>",
"name": "<string>"
},
"entity": {
"description": "<string>",
"id": "<string>",
"name": "<string>"
}
}
],
"conversation_id": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"display_text_range": [
123
],
"edit_controls": {
"editable_until": "<string>",
"edits_remaining": 123,
"is_edit_eligible": true
},
"edit_history_post_ids": [
"<string>"
],
"entities": {
"cashtags": [
{
"end": 123,
"start": 123,
"tag": "<string>"
}
],
"hashtags": [
{
"end": 123,
"start": 123,
"tag": "<string>"
}
],
"mentions": [
{
"end": 123,
"start": 123,
"id": "<string>",
"username": "<string>"
}
],
"urls": [
{
"end": 123,
"start": 123,
"description": "<string>",
"display_url": "<string>",
"expanded_url": "<string>",
"images": [
{
"height": 123,
"url": "<string>",
"width": 123
}
],
"media_key": "<string>",
"status": 123,
"title": "<string>",
"unwound_url": "<string>",
"url": "<string>"
}
]
},
"geo": {
"coordinates": {
"coordinates": [
123
],
"type": "Point"
},
"place_id": "<string>"
},
"id": "<string>",
"in_reply_to_user_id": "<string>",
"lang": "<string>",
"matched_media_notes": [
{
"match_status": "<string>",
"note_id": "<string>"
}
],
"media_metadata": [
{
"alt_text": "<string>",
"description": "<string>",
"media_key": "<string>",
"title": "<string>"
}
],
"non_public_metrics": {},
"note_post": {
"text": "<string>",
"entities": {
"cashtags": [
{
"end": 123,
"start": 123,
"tag": "<string>"
}
],
"hashtags": [
{
"end": 123,
"start": 123,
"tag": "<string>"
}
],
"mentions": [
{
"end": 123,
"start": 123,
"id": "<string>",
"username": "<string>"
}
],
"urls": [
{
"end": 123,
"start": 123,
"display_url": "<string>",
"expanded_url": "<string>",
"url": "<string>"
}
]
}
},
"note_request_suggestions": [
{
"source_link": "<string>",
"suggestion": "<string>",
"suggestion_id": "<string>"
}
],
"organic_metrics": {},
"paid_partnership": true,
"possibly_sensitive": true,
"promoted_metrics": {},
"public_metrics": {
"bookmark_count": 123,
"impression_count": 123,
"like_count": 123,
"quote_count": 123,
"reply_count": 123,
"repost_count": 123
},
"referenced_posts": [
{
"id": "<string>",
"type": "retweeted"
}
],
"reply_settings": "<string>",
"scopes": {
"followers": true
},
"source": "<string>",
"suggested_source_links": [
"<string>"
],
"suggested_source_links_with_counts": [
{
"count": 123,
"url": "<string>"
}
],
"text": "<string>",
"username": "<string>",
"withheld": {
"copyright": true,
"country_codes": [
"<string>"
],
"scope": "post"
}
}
],
"topics": [
{
"description": "<string>",
"id": "<string>",
"name": "<string>"
}
],
"users": [
{
"active_follower_count": 123,
"affiliation": {
"badge_url": "<string>",
"description": "<string>",
"url": "<string>",
"user_id": [
"<string>"
]
},
"confirmed_email": "<string>",
"connection_status": [
"blocking"
],
"created_at": "2023-11-07T05:31:56Z",
"description": "<string>",
"entities": {
"description": {
"cashtags": [
{
"end": 123,
"start": 123,
"tag": "<string>"
}
],
"hashtags": [
{
"end": 123,
"start": 123,
"tag": "<string>"
}
],
"mentions": [
{
"end": 123,
"start": 123,
"username": "<string>",
"id": "<string>"
}
],
"urls": [
{
"end": 123,
"start": 123,
"url": "<string>",
"description": "<string>",
"display_url": "<string>",
"expanded_url": "<string>",
"images": [
{
"height": 123,
"url": "<string>",
"width": 123
}
],
"media_key": "<string>",
"status": 123,
"title": "<string>",
"unwound_url": "<string>"
}
]
},
"url": {
"urls": [
{
"end": 123,
"start": 123,
"url": "<string>",
"description": "<string>",
"display_url": "<string>",
"expanded_url": "<string>",
"images": [
{
"height": 123,
"url": "<string>",
"width": 123
}
],
"media_key": "<string>",
"status": 123,
"title": "<string>",
"unwound_url": "<string>"
}
]
}
},
"id": "<string>",
"is_identity_verified": true,
"location": "<string>",
"most_recent_post_id": "<string>",
"name": "<string>",
"parody": true,
"pinned_post_id": "<string>",
"profile_banner_url": "<string>",
"profile_image_url": "<string>",
"protected": true,
"public_metrics": {
"followers_count": 123,
"following_count": 123,
"listed_count": 123,
"post_count": 123,
"like_count": 123,
"media_count": 123
},
"receives_your_dm": true,
"subscriber_count": 123,
"subscribes_to_you": true,
"subscription": {
"subscribes_to_you": true
},
"subscription_type": "<string>",
"url": "<string>",
"username": "<string>",
"verified": true,
"verified_followers_count": 123,
"verified_type": "<string>",
"withheld": {
"country_codes": [
"<string>"
],
"scope": "user"
}
}
]
},
"meta": {
"next_token": "<string>",
"result_count": 123
}
}{
"code": 123,
"message": "<string>"
}