Method: videos.list

Returns a list of videos that match the API request parameters.

Authorization: Public video queries using id or chart work with an API key. OAuth 2.0 authorization is required for myRating, private videos, the brandPartner part, owner-only parts (fileDetails, processingDetails, and suggestions), and onBehalfOfContentOwner.

For method-specific error responses, see videos.list errors. For code examples, see videos.list code snippets.

HTTP request

GET https://youtube.googleapis.com/youtube/v3/videos

The URL uses gRPC Transcoding syntax.

Query parameters

Parameters
id[]

string

Specifies a comma-separated list of YouTube video IDs (up to 50 IDs per request).

Specify exactly one of chart, id, or myRating. Invalid or inaccessible video IDs are omitted from items.

myRating

enum

Returns videos rated like or dislike by the authenticated user. Specify exactly one of chart, id, or myRating.

Requires OAuth 2.0 authorization. Setting this parameter to none skips the rating lookup and returns an empty items list. Pagination stops at 1,000 videos even if pageInfo.totalResults is higher.

Valid values of this enum field are:

  • none
  • like
  • dislike
chart

enum

Identifies the chart that you want to retrieve. Specify exactly one of chart, id, or myRating.

Set to mostPopular to return the most popular videos for the specified regionCode and videoCategoryId.

This enum field has the one valid value:

  • mostPopular
videoCategoryId

string

Identifies the video category for which the chart should be retrieved. Use only with chart; the default value is "0", which doesn't restrict the chart to a category.

regionCode

string

Instructs the API to return a chart specific to the specified ISO 3166-1 alpha-2 country code. Use only with chart; the default value is "US".

maxWidth

integer

Specifies the maximum width in pixels of the embedded player returned in the player.embedHtml property. Acceptable values are 72 to 8192, inclusive.

If both maxWidth and maxHeight are specified, the embedded player might be narrower than maxWidth to preserve the video's aspect ratio.

maxHeight

integer

Specifies the maximum height in pixels of the embedded player returned in the player.embedHtml property. Acceptable values are 72 to 8192, inclusive.

If both maxWidth and maxHeight are specified, the embedded player might be shorter than maxHeight to preserve the video's aspect ratio.

hl

string

Specifies the localization language for metadata in snippet.localized. The value must be a language code from i18nLanguages.list (for example, en-GB or es-419; see i18nLanguages). Falls back to default-language metadata if no localization exists.

maxResults

integer (uint32 format)

Specifies the maximum number of items returned in the result set. Acceptable values are 1 to 50, inclusive. The default value is 5.

Supported with myRating and chart; ignored when using id.

pageToken

string

Identifies a specific page in the result set to return. In an API response, nextPageToken and prevPageToken identify other pages that can be retrieved.

Supported with myRating and chart; not supported with id.

part[]

string

Required. Specifies a comma-separated list of one or more video resource properties that the API response includes.

Valid values are brandPartner, contentDetails, fileDetails, id, liveStreamingDetails, localizations, paidProductPlacementDetails, player, processingDetails, recordingDetails, snippet, statistics, status, suggestions, and topicDetails.

onBehalfOfContentOwner

string

Indicates that the request's authorization credentials identify a YouTube CMS user who is acting on behalf of the content owner specified in the parameter value. This parameter can only be used in a properly authorized request and is intended exclusively for YouTube content partners.

It allows content owners that own and manage multiple YouTube channels to authenticate once and access their video and channel data without providing separate authentication credentials for each individual channel. The CMS account that the user authenticates with must be linked to the specified YouTube content owner.

Request body

The request body must be empty.

Response body

If successful, the response body contains data with the following structure:

JSON representation
{
  "kind": string,
  "etag": string,
  "items": [
    {
      object (Video)
    }
  ],
  "nextPageToken": string,
  "prevPageToken": string,
  "pageInfo": {
    "totalResults": integer,
    "resultsPerPage": integer
  }
}
Fields
kind

string

Identifies what kind of resource this is. Value: the fixed string "youtube#videoListResponse".

etag

string

Etag of this resource.

items[]

object (Video)

A list of videos that match the request criteria.

nextPageToken

string

The token that can be used as the value of pageToken to retrieve the next page in the result set.

prevPageToken

string

The token that can be used as the value of pageToken to retrieve the previous page in the result set.

pageInfo

object

General pagination information.

pageInfo.totalResults

integer

The total number of results in the result set.

pageInfo.resultsPerPage

integer

The number of results included in the API response.

Authorization scopes

Requires one of the following OAuth scopes:

  • https://www.googleapis.com/auth/youtube
  • https://www.googleapis.com/auth/youtubepartner
  • https://www.googleapis.com/auth/youtube.readonly
  • https://www.googleapis.com/auth/youtube.force-ssl

For more information, see the OAuth 2.0 Overview.