Skip to content
twitch.apiv2.0

Reference / API groups

twitch.streams

Streams: who is live, stream keys and markers.

Every method of twitch.streams, with its parameters, what it returns and the token it needs.

twitch.streams.get(params?, options?): Paginator<Stream>

Lists live streams, most viewers first. Without filters this is every stream on Twitch. Viewer counts move while you page, so a stream can show up twice or be skipped.

Token: app or user.

NameTypeDescription
user_idstring | readonly string[]Only streams of these users. Up to 100 IDs.
user_loginstring | readonly string[]Only streams of these users. Up to 100 login names.
game_idstring | readonly string[]Only streams in these categories. Up to 100 IDs.
type"live" | "all"Kind of stream. Twitch defaults to "all".
languagestring | readonly string[]Only streams in these languages: ISO 639-1 codes, or "other". Up to 100.
firstnumberItems per page, 1 to 100. Twitch defaults to 20.
beforestringCursor of the previous page.
afterstringCursor of the next page.

options: Request options for this call: as, token, signal, timeout, retries.

Paginator<Stream>

Fields of Stream
NameTypeDescription
idstringID of the stream. The VOD of the broadcast can be looked up with it later.
user_idstringID of the broadcaster.
user_loginstringLogin name of the broadcaster.
user_namestringDisplay name of the broadcaster.
game_idstringID of the category being streamed. An empty string when none is set.
game_namestringName of the category being streamed. An empty string when none is set.
type"" | "live""live", or an empty string when Twitch hit an error.
titlestringTitle of the stream. An empty string when none is set.
tagsstring[]Tags applied to the stream.
viewer_countnumberNumber of viewers right now.
started_atstringWhen the broadcast started, as an RFC 3339 timestamp.
languagestringLanguage of the stream: an ISO 639-1 code, or "other".
thumbnail_urlstringURL of a recent frame of the stream. Replace &#123;width} and &#123;height} with the size you want, in pixels.
tag_idsstring[]Deprecated. Always empty. Use tags.
is_maturebooleanDeprecated. Always false.
const live = await twitch.streams.get({ user_login: ["twitchdev"] });
for await (const stream of twitch.streams.get({ language: "fr" })) {
console.log(stream.user_name, stream.viewer_count);
}

Twitch reference

twitch.streams.followed(params?, options?): Paginator<Stream>

Lists the live streams of the channels a user follows, most viewers first.

Token: user, scope user:read:follows.

NameTypeDescription
user_idstringUser whose followed channels to check. Defaults to the user making the call.
firstnumberItems per page, 1 to 100. Twitch defaults to 100.
afterstringCursor of the next page.

options: Request options for this call: as, token, signal, timeout, retries.

Paginator<Stream>

Fields of Stream
NameTypeDescription
idstringID of the stream. The VOD of the broadcast can be looked up with it later.
user_idstringID of the broadcaster.
user_loginstringLogin name of the broadcaster.
user_namestringDisplay name of the broadcaster.
game_idstringID of the category being streamed. An empty string when none is set.
game_namestringName of the category being streamed. An empty string when none is set.
type"" | "live""live", or an empty string when Twitch hit an error.
titlestringTitle of the stream. An empty string when none is set.
tagsstring[]Tags applied to the stream.
viewer_countnumberNumber of viewers right now.
started_atstringWhen the broadcast started, as an RFC 3339 timestamp.
languagestringLanguage of the stream: an ISO 639-1 code, or "other".
thumbnail_urlstringURL of a recent frame of the stream. Replace &#123;width} and &#123;height} with the size you want, in pixels.
tag_idsstring[]Deprecated. Always empty. Use tags.
is_maturebooleanDeprecated. Always false.
const streams = await twitch.streams.followed().all();

Twitch reference

twitch.streams.key(params?, options?): Promise<string>

Gets the stream key of a channel. Treat it like a password.

Token: user, scope channel:read:stream_key.

NameTypeDescription
broadcaster_idstringBroadcaster who owns the channel. Defaults to the user making the call.

options: Request options for this call: as, token, signal, timeout, retries.

Promise<string>

const key = await twitch.streams.key();

Twitch reference

twitch.streams.createMarker(params?, options?): Promise<StreamMarker>

Marks the current position of a live stream. Fails when the channel is offline, has VODs disabled or is airing a rerun.

Token: user, scope channel:manage:broadcast.

NameTypeDescription
user_idstringBroadcaster who is live. Defaults to the user making the call.
descriptionstringNote to attach to the marker, 140 characters at most.

options: Request options for this call: as, token, signal, timeout, retries.

Promise<StreamMarker>

Fields of StreamMarker
NameTypeDescription
idstringID of the marker.
created_atstringWhen the marker was created, as an RFC 3339 timestamp.
position_secondsnumberOffset of the marker from the start of the stream, in seconds.
descriptionstringNote attached to the marker. An empty string when there is none.
const marker = await twitch.streams.createMarker({ description: "Boss fight" });

Twitch reference

twitch.streams.markers(params, options?): Paginator<StreamMarkerGroup>

Lists the markers of a user’s most recent video, or of a given video.

Token: user, scope user:read:broadcast or channel:manage:broadcast.

NameTypeDescription
user_idstringReads the markers of this user’s most recent video.
video_idstringReads the markers of this video.
firstnumberItems per page, 1 to 100. Twitch defaults to 20.
beforestringCursor of the previous page.
afterstringCursor of the next page.

options: Request options for this call: as, token, signal, timeout, retries.

Paginator<StreamMarkerGroup>

Fields of StreamMarkerGroup
NameTypeDescription
user_idstringID of the user who created the markers.
user_namestringDisplay name of that user.
user_loginstringLogin name of that user.
videos{ video_id: string; markers: VideoStreamMarker[]; }[]Videos that contain markers. Holds a single video.
const [group] = (await twitch.streams.markers({ video_id: "1234567890" })).data;

Twitch reference