Skip to content
twitch.apiv2.0

Reference / API groups

twitch.videos

Videos: VODs, highlights and uploads.

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

twitch.videos.get(params, options?): Paginator<Video>

Gets videos by ID, or lists the videos of a user or of a category. The filters only apply when listing by user or by category.

Token: app or user.

NameTypeDescription
idstring | readonly string[]These videos. Up to 100 IDs.
user_idstringVideos of this user.
game_idstringVideos in this category. Twitch returns 500 of them at most.
languagestringOnly videos in this language: an ISO 639-1 code, or "other". Only with game_id.
period"day" | "week" | "month" | "all"Only videos published within this period. Twitch defaults to "all". Only with game_id or user_id.
sort"time" | "trending" | "views"Order of the results: newest first, fastest growing first or most viewed first. Twitch defaults to "time". Only with game_id or user_id.
type"archive" | "highlight" | "upload" | "all"Only videos of this kind. Twitch defaults to "all". Only with game_id or user_id.
firstnumberItems per page, 1 to 100. Twitch defaults to 20. Only with game_id or user_id.
afterstringCursor of the next page. Only with user_id.
beforestringCursor of the previous page. Only with user_id.

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

Paginator<Video>

Fields of Video
NameTypeDescription
idstringID of the video.
stream_idstring | nullID of the stream the video was recorded from. null unless type is "archive".
user_idstringID of the broadcaster who owns the video.
user_loginstringLogin name of the broadcaster.
user_namestringDisplay name of the broadcaster.
titlestringTitle of the video.
descriptionstringDescription of the video.
created_atstringWhen the video was created, as an RFC 3339 timestamp.
published_atstringWhen the video was published, as an RFC 3339 timestamp.
urlstringURL of the video page.
thumbnail_urlstringURL of a preview image. Replace %&#123;width} and %&#123;height} with the size you want, in pixels. Twitch currently only serves 320 by 180.
viewable"public"Who can watch the video. Always "public".
view_countnumberNumber of views.
languagestringLanguage of the video: an ISO 639-1 code, or "other".
type"archive" | "highlight" | "upload"Kind of video: a past broadcast, a highlight or an upload.
durationstringLength of the video, written like "3m21s".
muted_segmentsVideoMutedSegment[] | nullPassages muted by Twitch, or null when there are none.
const [video] = (await twitch.videos.get({ id: "1234567890" })).data;
for await (const vod of twitch.videos.get({ user_id: "141981764", type: "archive" })) {
console.log(vod.title, vod.duration);
}

Twitch reference

twitch.videos.delete(params, options?): Promise<string[]>

Deletes videos and resolves with the IDs that were deleted. Twitch takes 5 IDs per request, so longer lists go out as several requests, one after the other. Within one request, a single video the user may not delete keeps all 5 from being deleted.

Token: user, scope channel:manage:videos.

NameTypeDescription
id requiredstring | readonly string[]IDs of the videos to delete. Any number: long lists are split for you.

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

Promise<string[]>

const deleted = await twitch.videos.delete({ id: ["1234567890", "1234567891"] });

Twitch reference