Get Videos
You may get videos by ID, by user, or by game/category.
You must specify exactly one of the id, user_id and game_id query parameters; the request fails if you specify none of them or more than one.
You may apply several filters to get a subset of the videos. The filters are applied as an AND operation to each video. For example, if language is set to 'de' and game_id is set to 21779, the response includes only videos that show playing League of Legends by users that stream in German. The filters apply only if you get videos by user ID or game ID.
Endpoint
GEThttps://api.twitch.tv/helix/videos
Authorization
Requires one of the following:
Query Parameters
idStringA list of IDs that identify the videos you want to get. To get more than one video, include this parameter for each video you want to get. For example, 'id=1234&id=5678'. You may specify a maximum of 100 IDs. The endpoint ignores duplicate IDs and IDs that weren't found.
The id, user_id, and game_id parameters are mutually exclusive.
user_idStringThe ID of the user whose list of videos you want to get. The id, user_id, and game_id parameters are mutually exclusive.game_idStringA category or game ID. The response contains a maximum of 500 videos that show this content. To get category/game IDs, use the Search Categories endpoint.
The id, user_id, and game_id parameters are mutually exclusive.
languageStringA filter used to filter the list of videos by the language that the video owner broadcasts in. For example, to get videos that were broadcast in German, set this parameter to the ISO 639-1 two-letter code for German (i.e., DE). For a list of supported languages, see Supported Stream Language. If the language is not supported, use "other." To filter by more than one language, separate the codes with commas (for example, de,en).
Specify this parameter only if you specify the game_id or user_id query parameter. If you specify game_id but not language, the API filters by the first language in the request's Accept-Language header, if the request includes one.
periodStringA filter used to filter the list of videos by when they were created. For example, videos created in the last week. The default is all.Possible values
alldaymonthweek
sortStringThe order to sort the returned videos in. The default is time.Possible values
timeSort the results in descending order by when they were created (i.e., latest video first). If you specify user_id, the API sorts by when the videos were published, or by when they were created if they weren't published.trendingSort the results in descending order by biggest gains in viewership (i.e., highest trending video first).viewsSort the results in descending order by most views (i.e., highest number of views first).
typeStringA filter used to filter the list of videos by the video's type. The default is all.Possible values
allarchiveOn-demand videos (VODs) of past streams.highlightHighlight reels of past streams.uploadExternal videos that the broadcaster uploaded using the Video Producer.
firstIntegerThe maximum number of items to return per page in the response. The minimum page size is 1 item per page and the maximum is 100. The default is 20.
Specify this parameter only if you specify the game_id or user_id query parameter.
afterStringThe cursor used to get the next page of results. The Pagination object in the response contains the cursor's value. Read More
Specify this parameter only if you specify the game_id or user_id query parameter.
beforeStringThe cursor used to get the previous page of results. The Pagination object in the response contains the cursor's value. Read More
Specify this parameter only if you specify the game_id or user_id query parameter.
Response Body
dataObject[]The list of published videos that match the filter criteria. The list is always empty if the request comes from a region where videos aren't available.Hide child attributesShow child attributes
data.idStringAn ID that identifies the video.data.stream_idStringThe ID of the stream that the video originated from if the video's type is "archive;" otherwise, null.data.user_idStringThe ID of the broadcaster that owns the video.data.user_loginStringThe broadcaster's login name.data.user_nameStringThe broadcaster's display name.data.titleStringThe video's title.data.descriptionStringThe video's description.data.created_atStringThe date and time, in UTC, of when the video was created. The timestamp is in RFC3339 format.data.published_atStringNullableThe date and time, in UTC, of when the video was published. The timestamp is in RFC3339 format.data.urlStringThe video's URL.data.thumbnail_urlStringA URL to a thumbnail image of the video. Before using the URL, you must replace the '%{width}' and '%{height}' placeholders with the width and height of the thumbnail you want returned. Due to current limitations, '${width}' must be 320 and '${height}' must be 180.data.viewableStringThe video's viewable state. Always set to public.data.view_countIntegerThe number of times that users have watched the video.data.languageStringThe ISO 639-1 two-letter language code that the video was broadcast in. For example, the language code is DE if the video was broadcast in German. For a list of supported languages, see Supported Stream Language. The language value is "other" if the video was broadcast in a language not in the list of supported languages.data.typeStringThe video's type.Possible values
archiveAn on-demand video (VOD) of one of the broadcaster's past streams.highlightA highlight reel of one of the broadcaster's past streams. See Creating Highlights.uploadA video that the broadcaster uploaded to their video library. See Upload under Video Producer.past_premiereA past Premiere. Returned only when you get videos by id.premiere_uploadA video uploaded for a Premiere. Returned only when you get videos by id.
data.durationStringThe video's length in hours (h), minutes (m), and seconds (s), with leading zero units left out. For example, 3m21s represents 3 minutes, 21 seconds, and 1h0m5s represents 1 hour, 5 seconds.data.muted_segmentsObject[]NullableThe segments that Twitch Audio Recognition muted; otherwise, null. Always null if you use an app access token.Hide child attributesShow child attributes
data.muted_segments.durationIntegerThe duration of the muted segment, in seconds.data.muted_segments.offsetIntegerThe offset, in seconds, from the beginning of the video to where the muted segment begins.
paginationObjectContains the information used to page through the list of results. The object is empty if the page has no videos, if you get videos by id, or if you specify game_id and reach the 500-video limit. The last page of results may still include a cursor; the page after it is empty. Read MoreHide child attributesShow child attributes
pagination.cursorStringThe cursor used to get the next page of results. Use the cursor to set the request's after or before query parameter depending on whether you're paging forwards or backwards through the results.
Response Codes
- 200OK
- Successfully retrieved the list of videos.
- 400Bad Request
- The request must specify either the id or user_id or game_id query parameter.
- The id, user_id, and game_id query parameters are mutually exclusive; you must specify only one of them.
- The value in the id query parameter is not valid.
- The ID in the game_id query parameter is not valid.
- The value in the type query parameter is not valid.
- The value in the period query parameter is not valid.
- The value in the sort query parameter is not valid.
- The ID in the user_id query parameter is not valid.
- The first query parameter is outside the allowed range of values.
- The cursor specified in the after or before query parameter is not valid.
- The request may specify either the after or before query parameter but not both.
- 401Unauthorized
- The Authorization header is required and must contain an app access token or user access token.
- The access token is not valid.
- The ID specified in the Client-Id header does not match the client ID specified in the access token.
- 404Not Found
- The ID in the game_id query parameter was not found.
- 503Service Unavailable
- The API couldn't get the videos. Try the request again.
curl -X GET 'https://api.twitch.tv/helix/videos?id=335921245' \
-H 'Authorization: Bearer YOUR_ACCESS_TOKEN' \
-H 'Client-Id: YOUR_CLIENT_ID'$headers = @{
"Authorization" = "Bearer YOUR_ACCESS_TOKEN"
"Client-Id" = "YOUR_CLIENT_ID"
}
$response = Invoke-RestMethod -Uri "https://api.twitch.tv/helix/videos?id=335921245" `
-Method Get -Headers $headersconst response = await fetch("https://api.twitch.tv/helix/videos?id=335921245", {
method: "GET",
headers: {
"Authorization": "Bearer YOUR_ACCESS_TOKEN",
"Client-Id": "YOUR_CLIENT_ID",
},
});
const data = await response.json();import requests
response = requests.get(
"https://api.twitch.tv/helix/videos",
headers={
"Authorization": "Bearer YOUR_ACCESS_TOKEN",
"Client-Id": "YOUR_CLIENT_ID",
},
params={
"id": "335921245",
},
)
data = response.json()req, _ := http.NewRequest("GET", "https://api.twitch.tv/helix/videos?id=335921245", nil)
req.Header.Set("Authorization", "Bearer YOUR_ACCESS_TOKEN")
req.Header.Set("Client-Id", "YOUR_CLIENT_ID")
res, err := http.DefaultClient.Do(req)
if err != nil {
panic(err)
}
defer res.Body.Close()
data, _ := io.ReadAll(res.Body)$ch = curl_init("https://api.twitch.tv/helix/videos?id=335921245");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET");
curl_setopt($ch, CURLOPT_HTTPHEADER, [
"Authorization: Bearer YOUR_ACCESS_TOKEN",
"Client-Id: YOUR_CLIENT_ID",
]);
$response = curl_exec($ch);
curl_close($ch);using var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Get, "https://api.twitch.tv/helix/videos?id=335921245");
request.Headers.Add("Authorization", "Bearer YOUR_ACCESS_TOKEN");
request.Headers.Add("Client-Id", "YOUR_CLIENT_ID");
var response = await client.SendAsync(request);
var data = await response.Content.ReadAsStringAsync();let client = reqwest::Client::new();
let response = client
.get("https://api.twitch.tv/helix/videos?id=335921245")
.header("Authorization", "Bearer YOUR_ACCESS_TOKEN")
.header("Client-Id", "YOUR_CLIENT_ID")
.send()
.await?;
let data = response.text().await?;{
"data": [
{
"id": "335921245",
"stream_id": null,
"user_id": "141981764",
"user_login": "twitchdev",
"user_name": "TwitchDev",
"title": "Twitch Developers 101",
"description": "Welcome to Twitch development! Here is a quick overview of our products and\ninformation to help you get started.",
"created_at": "2018-11-14T21:30:18Z",
"published_at": "2018-11-14T22:04:30Z",
"url": "https://www.twitch.tv/videos/335921245",
"thumbnail_url": "https://static-cdn.jtvnw.net/cf_vods/d2nvs31859zcd8/twitchdev/335921245/ce0f3a7f-57a3-4152-bc06-0c6610189fb3/thumb/index-0000000000-%{width}x%{height}.jpg",
"viewable": "public",
"view_count": 1863062,
"language": "en",
"type": "upload",
"duration": "3m21s",
"muted_segments": [
{
"duration": 30,
"offset": 120
}
]
}
],
"pagination": {}
}Delete Videos
You may delete past broadcasts, highlights, or uploads. The user in the access token must own the videos or be an editor for the channel that owns them.
Endpoint
DELETEhttps://api.twitch.tv/helix/videos
Authorization
Requires one of the following:
- A user access token that includes the channel:manage:videos scope.
Query Parameters
idStringRequiredThe list of videos to delete. To specify more than one video, include the id parameter for each video to delete. For example, 'id=1234&id=5678'. You can delete a maximum of 5 videos per request.
If any ID doesn't identify a video that the user has permission to delete, none of the videos are deleted.
Response Body
dataString[]The list of IDs of the videos that were deleted.
Response Codes
- 200OK
- Successfully deleted the list of videos.
- 400Bad Request
- The id query parameter is required.
- The request exceeded the number of allowed id query parameters.
- 401Unauthorized
- The caller is not authorized to delete one of the specified videos, or one of the IDs doesn't identify a video.
- The Authorization header is required and must contain a user access token.
- The user access token must include the channel:manage:videos scope.
- The access token is not valid.
- The ID specified in the Client-Id header does not match the client ID specified in the access token.
curl -X DELETE 'https://api.twitch.tv/helix/videos?id=9876' \
-H 'Authorization: Bearer YOUR_ACCESS_TOKEN' \
-H 'Client-Id: YOUR_CLIENT_ID'$headers = @{
"Authorization" = "Bearer YOUR_ACCESS_TOKEN"
"Client-Id" = "YOUR_CLIENT_ID"
}
$response = Invoke-RestMethod -Uri "https://api.twitch.tv/helix/videos?id=9876" `
-Method Delete -Headers $headersconst response = await fetch("https://api.twitch.tv/helix/videos?id=9876", {
method: "DELETE",
headers: {
"Authorization": "Bearer YOUR_ACCESS_TOKEN",
"Client-Id": "YOUR_CLIENT_ID",
},
});
const data = await response.json();import requests
response = requests.delete(
"https://api.twitch.tv/helix/videos",
headers={
"Authorization": "Bearer YOUR_ACCESS_TOKEN",
"Client-Id": "YOUR_CLIENT_ID",
},
params={
"id": "9876",
},
)
data = response.json()req, _ := http.NewRequest("DELETE", "https://api.twitch.tv/helix/videos?id=9876", nil)
req.Header.Set("Authorization", "Bearer YOUR_ACCESS_TOKEN")
req.Header.Set("Client-Id", "YOUR_CLIENT_ID")
res, err := http.DefaultClient.Do(req)
if err != nil {
panic(err)
}
defer res.Body.Close()
data, _ := io.ReadAll(res.Body)$ch = curl_init("https://api.twitch.tv/helix/videos?id=9876");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "DELETE");
curl_setopt($ch, CURLOPT_HTTPHEADER, [
"Authorization: Bearer YOUR_ACCESS_TOKEN",
"Client-Id: YOUR_CLIENT_ID",
]);
$response = curl_exec($ch);
curl_close($ch);using var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Delete, "https://api.twitch.tv/helix/videos?id=9876");
request.Headers.Add("Authorization", "Bearer YOUR_ACCESS_TOKEN");
request.Headers.Add("Client-Id", "YOUR_CLIENT_ID");
var response = await client.SendAsync(request);
var data = await response.Content.ReadAsStringAsync();let client = reqwest::Client::new();
let response = client
.delete("https://api.twitch.tv/helix/videos?id=9876")
.header("Authorization", "Bearer YOUR_ACCESS_TOKEN")
.header("Client-Id", "YOUR_CLIENT_ID")
.send()
.await?;
let data = response.text().await?;{
"data": [
"9876"
]
}