1
Get the recommended region
GET /2/region → obtain the recommended region (follow the 307 redirect). See Get Recommended Region.2
Create (or reuse) a stream source
POST /2/users/:user_id/sources → create a source for that region. Record rtmps_url + rtmp_stream_key. See Create Stream Source.3
Start your encoder
Configure and start your encoder, pushing to the RTMPS URL + key. Wait until
is_stream_active is true (poll List/Get Source if desired).4
Create a broadcast
POST /2/users/:user_id/broadcasts with the source_id, region, and is_low_latency. Note the media_key, id, share_url, and video_access URLs. The broadcast starts in NOT_STARTED. See Create Broadcast.5
(Optional) Prepare chat access
Subscribe to the user’s
broadcast.chat events in the X Activity API. If you have already done this previously, you don’t need to resubscribe — the subscription covers all broadcasts for the user. See Accessing Live Chat.6
Publish (go live)
PUT …/broadcasts/:id/state with state: "PUBLISH" (+ title, chat_option, etc.). The broadcast becomes RUNNING and publicly visible. See Publish or End a Broadcast.7
While live
Poll
GET /2/broadcasts/:id for viewer counts, thumbnails, and state; read chat via the X Activity API; optionally post messages with POST /2/broadcasts/:id/chat.8
End the broadcast
When done: stop your encoder, then
PUT …/state with { "state": "END" }. The broadcast transitions to ENDED.9
(Optional) Pull chat history
GET /2/broadcasts/:id/chat returns the broadcast’s chat history. This endpoint is only valid after the broadcast has ended. See Get Chat History.10
(Optional) Clean up
Delete the broadcast record or source if no longer needed.
Sources are reusable. Create a new source only when you need a different region or want to isolate encoder configs.