Retrieves a batch of video statistics for the specified video IDs. This method isn't atomic; invalid, missing, or inaccessible video IDs are omitted from items rather than failing the batch.
Authorization: Public video queries work with an API key. OAuth 2.0 authorization is required for non-public videos and onBehalfOfContentOwner.
Quota impact: A call to this method uses the dedicated Video Batch Get Stats quota bucket (1 unit per call, with default limits of 10,000 calls per day and 600 calls per minute per project).
For error responses, see YouTube Data API errors.
HTTP request
GET https://youtube.googleapis.com/youtube/v3/videos:batchGetStats
The URL uses gRPC Transcoding syntax.
Query parameters
| Parameters | |
|---|---|
id[] |
Required. Specifies a comma-separated list (or repeated query parameters) of YouTube video IDs. The number of IDs specified can't exceed 50. Invalid or inaccessible video IDs are omitted from |
part[] |
Required. Specifies a comma-separated list of one or more Valid values are |
onBehalfOfContentOwner |
Optional. 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
Returns video statistics for the requested videos.
If successful, the response body contains data with the following structure:
| JSON representation |
|---|
{ "kind": string, "etag": string, "items": [ { "etag": string, "id": string, "snippet": { "publishTime": string }, "statistics": { "viewCount": string, "likeCount": string, "commentCount": string }, "contentDetails": { "duration": string } } ] } |
| Fields | |
|---|---|
kind |
Identifies what kind of resource this is. Value: the fixed string |
etag |
Etag of this resource. |
items[] |
The videos' stats information. |
items[].etag |
Output only. Etag of this resource. |
items[].id |
Output only. The ID that YouTube uses to uniquely identify the video. |
items[].snippet |
Output only. The |
items[].snippet.publishTime |
Output only. The date and time that the video was published (or uploaded, if never published). Uses RFC 3339, where generated output will always be Z-normalized and use 0, 3, 6 or 9 fractional digits. Offsets other than "Z" are also accepted. Examples: |
items[].statistics |
Output only. The |
items[].statistics.viewCount |
Output only. The number of times the video has been viewed. For all video formats (long-form, Live, and Shorts), |
items[].statistics.likeCount |
Output only. The number of users who have indicated that they liked the video by giving it a positive rating. |
items[].statistics.commentCount |
Output only. The number of comments for the video. |
items[].contentDetails |
Output only. The |
items[].contentDetails.duration |
Output only. The length of the video. A duration in seconds with up to nine fractional digits, ending with ' |
Authorization scopes
Requires one of the following OAuth scopes:
https://www.googleapis.com/auth/youtubehttps://www.googleapis.com/auth/youtubepartnerhttps://www.googleapis.com/auth/youtube.readonlyhttps://www.googleapis.com/auth/youtube.force-ssl
For more information, see the OAuth 2.0 Overview.