Skip to main content
To use the Livestream API, you need the following:
1

X developer app

An X developer app (OAuth client) to authenticate requests.
2

OAuth credentials

All Livestream endpoints support both OAuth 2.0 and OAuth 1.0a. OAuth 2.0 is the recommended method: request the broadcast.read and broadcast.write scopes at minimum, which cover most operations. OAuth 1.0a is still accepted for existing integrations. Store your credentials securely.
3

User permissions

The broadcasting account must have permission to go live. Protected/private X accounts are not permitted to create broadcasts.
4

RTMP encoder

You will need an external encoder (e.g., ffmpeg or similar) to push video to the RTMPS ingest URL provided by a stream source.

Finding your user ID

The /2/sources and /2/broadcasts routes take the user from the access token, so you don’t need the user ID to call them. The deprecated /2/users/:user_id/sources and /2/users/:user_id/broadcasts routes, which will be removed on January 1, 2027, require the numeric X user ID from the access token to exactly match the :user_id in the URL path. Mismatches are rejected with HTTP 400 Bad Request. See the migration guide to move off these routes. If you need the user ID, a common way to obtain the user ID is to call GET /2/users/me using the same credentials you will use for the Livestream endpoints.
When using OAuth 1.0a, the numeric user ID is also the prefix of the access token, before the - — e.g. 172483972-xxxxx → 172483972 — so you can avoid an extra request.
Example response from GET /2/users/me:

Next steps

Authentication

How to sign requests with OAuth 2.0 or OAuth 1.0a.

Typical workflow

The end-to-end flow from source to live broadcast.