Broadcasts
Get Live Categories
GET /2/broadcasts/categories returns the live categories a host can pick when going live. Pass a category’s id as live_category_id on POST /2/broadcasts.
GET
/
2
/
broadcasts
/
categories
List Live Categories
curl --request GET \
--url https://api.x.com/2/broadcasts/categories \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.x.com/2/broadcasts/categories"
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/categories', 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/categories",
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/categories"
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/categories")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.x.com/2/broadcasts/categories")
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": [
{
"id": "<string>",
"name": "<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>"
}
],
"meta": {
"result_count": 123
}
}{
"code": 123,
"message": "<string>"
}Returns the live categories a host can pick when going live, in display order. Use it to build a category picker, then pass the chosen category’s
This example is shortened to three categories.
id as live_category_id to Go Live (POST /2/broadcasts).
The whole list is returned in one response: there are no query parameters and no paging. The list is the same for every user.
{
"data": [
{ "id": "gaming", "name": "Gaming" },
{ "id": "music", "name": "Music" },
{ "id": "sports", "name": "Sports" }
],
"meta": { "result_count": 3 }
}
meta.result_count is the number of categories in data.
Using the list
- Store the
id, show thename. Ids are permanent. Names can change, so read the current name from this route instead of saving it. - Keep the order. Categories are returned in the order to display them.
- Don’t hard-code the list. Categories can be added, so fetch the list instead of shipping a copy of it. An id that isn’t in the list is rejected by Go Live with
400.
Authentication and rate limit
Requires user context authentication: OAuth 2.0 with thebroadcast.read scope, or OAuth 1.0a. The route allows 450 requests per 15 minutes per user.
Errors
Errors use the standard X API problem format.| Status | Problem type | When | What to do |
|---|---|---|---|
401 | about:blank | The request isn’t authenticated. | Send a valid user-context access token. |
403 | https://api.x.com/2/problems/missing-scopes | The OAuth 2.0 token lacks broadcast.read. | Re-authorize the user with the broadcast.read scope. |
403 | about:blank | The account isn’t permitted to list live categories. | Don’t retry. |
503 | about:blank | Temporary failure. | Retry with backoff. |
Authorizations
OAuth2UserTokenUserToken
Response
The request has succeeded.
- 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
- Option 56
- Option 57
- Option 58
- Option 59
- Option 60
- Option 61
Show child attributes
Show child attributes
⌘I
List Live Categories
curl --request GET \
--url https://api.x.com/2/broadcasts/categories \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.x.com/2/broadcasts/categories"
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/categories', 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/categories",
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/categories"
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/categories")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.x.com/2/broadcasts/categories")
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": [
{
"id": "<string>",
"name": "<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>"
}
],
"meta": {
"result_count": 123
}
}{
"code": 123,
"message": "<string>"
}