Skip to content
twitch.apiv2.0

Reference / API groups

twitch.polls

Polls: create, read and end them.

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

twitch.polls.get(params?, options?): Paginator<Poll>

Lists the polls of a channel, most recent first. Twitch keeps them for 90 days.

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

NameTypeDescription
broadcaster_idstringBroadcaster whose polls to list. Defaults to the user making the call.
idstring | readonly string[]Only these polls. Up to 20 IDs.
firstnumberItems per page, 1 to 20. Twitch defaults to 20.
afterstringCursor of the next page.

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

Paginator<Poll>

Fields of Poll
NameTypeDescription
idstringID of the poll.
broadcaster_idstringID of the broadcaster who ran the poll.
broadcaster_namestringDisplay name of the broadcaster.
broadcaster_loginstringLogin name of the broadcaster.
titlestringQuestion put to the viewers, 60 characters at most.
choicesPollChoice[]Choices of the poll, two to five of them.
bits_voting_enabledbooleanDeprecated. Always false. Bits voting no longer exists.
bits_per_votenumberDeprecated. Always 0. Bits voting no longer exists.
channel_points_voting_enabledbooleanWhether viewers can buy extra votes with Channel Points.
channel_points_per_votenumberPrice of one extra vote, in Channel Points.
statusPollStatusState of the poll: ACTIVE while it runs, COMPLETED when it reached its end, TERMINATED when it was stopped early, ARCHIVED when it is hidden from the channel, MODERATED when it was deleted, INVALID when Twitch could not work it out.
durationnumberPlanned length of the poll, in seconds.
started_atstringWhen the poll started, as an RFC 3339 timestamp.
ended_atstringWhen the poll ended, as an RFC 3339 timestamp. null or absent while it is running.
const latest = await twitch.polls.get().first();

Twitch reference

twitch.polls.create(params, options?): Promise<Poll>

Starts a poll in a channel. It opens at once, and a channel can only run one poll at a time.

Token: user, scope channel:manage:polls.

NameTypeDescription
broadcaster_idstringBroadcaster who runs the poll. Defaults to the user making the call.
title requiredstringQuestion put to the viewers, 60 characters at most.
choices requiredreadonly (string | { title: string; })[]Two to five choices, each 25 characters at most. Plain strings work too.
duration requirednumberLength of the poll in seconds, 15 to 1800.
channel_points_voting_enabledbooleanLets viewers buy extra votes with Channel Points. Twitch defaults to false.
channel_points_per_votenumberPrice of one extra vote in Channel Points, 1 to 1000000.

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

Promise<Poll>

Fields of Poll
NameTypeDescription
idstringID of the poll.
broadcaster_idstringID of the broadcaster who ran the poll.
broadcaster_namestringDisplay name of the broadcaster.
broadcaster_loginstringLogin name of the broadcaster.
titlestringQuestion put to the viewers, 60 characters at most.
choicesPollChoice[]Choices of the poll, two to five of them.
bits_voting_enabledbooleanDeprecated. Always false. Bits voting no longer exists.
bits_per_votenumberDeprecated. Always 0. Bits voting no longer exists.
channel_points_voting_enabledbooleanWhether viewers can buy extra votes with Channel Points.
channel_points_per_votenumberPrice of one extra vote, in Channel Points.
statusPollStatusState of the poll: ACTIVE while it runs, COMPLETED when it reached its end, TERMINATED when it was stopped early, ARCHIVED when it is hidden from the channel, MODERATED when it was deleted, INVALID when Twitch could not work it out.
durationnumberPlanned length of the poll, in seconds.
started_atstringWhen the poll started, as an RFC 3339 timestamp.
ended_atstringWhen the poll ended, as an RFC 3339 timestamp. null or absent while it is running.
const poll = await twitch.polls.create({
title: "Which game next?",
choices: ["Celeste", "Hades", "Outer Wilds"],
duration: 120,
});

Twitch reference

twitch.polls.end(params, options?): Promise<Poll>

Ends a running poll before its time is up, and optionally hides it.

Token: user, scope channel:manage:polls.

NameTypeDescription
broadcaster_idstringBroadcaster who runs the poll. Defaults to the user making the call.
id requiredstringID of the poll to end.
status required"TERMINATED" | "ARCHIVED""TERMINATED" leaves the results on screen, "ARCHIVED" also hides the poll.

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

Promise<Poll>

Fields of Poll
NameTypeDescription
idstringID of the poll.
broadcaster_idstringID of the broadcaster who ran the poll.
broadcaster_namestringDisplay name of the broadcaster.
broadcaster_loginstringLogin name of the broadcaster.
titlestringQuestion put to the viewers, 60 characters at most.
choicesPollChoice[]Choices of the poll, two to five of them.
bits_voting_enabledbooleanDeprecated. Always false. Bits voting no longer exists.
bits_per_votenumberDeprecated. Always 0. Bits voting no longer exists.
channel_points_voting_enabledbooleanWhether viewers can buy extra votes with Channel Points.
channel_points_per_votenumberPrice of one extra vote, in Channel Points.
statusPollStatusState of the poll: ACTIVE while it runs, COMPLETED when it reached its end, TERMINATED when it was stopped early, ARCHIVED when it is hidden from the channel, MODERATED when it was deleted, INVALID when Twitch could not work it out.
durationnumberPlanned length of the poll, in seconds.
started_atstringWhen the poll started, as an RFC 3339 timestamp.
ended_atstringWhen the poll ended, as an RFC 3339 timestamp. null or absent while it is running.
const poll = await twitch.polls.end({ id: pollId, status: "TERMINATED" });

Twitch reference