We are updating the Data API to match how YouTube counts views for Shorts.
Learn more
Implementation: Ratings
Stay organized with collections
Save and categorize content based on your preferences.
The following examples show how to use the YouTube Data API (v3) to perform functions related to video ratings.
Rate a video
Call the videos.rate
method to submit a user's rating for a video. This request must be authorized using OAuth 2.0.
Set the following two parameters in your request:
- The
id
parameter specifies the YouTube video ID of the video that is being rated (or having its rating removed).
- The
rating
parameter specifies the rating that the user authorizing the request wishes to record. Valid parameter values are like
, dislike
, and none
. The first two values set a rating, and the third removes any rating that previously existed for the user.
The sample request below gives a positive (like) rating to the video of the keynote speech at the 2014 Google I/O conference:
https://developers.google.com/apis-explorer/#p/youtube/v3/youtube.videos.rate?
id=wtLJPvx7-ys
&rating=like
Retrieve the current user's rating of a video
The videos.getRating
method lets you retrieve the currently authenticated user's rating of one or more videos. In your request, set the id
parameter's value to a comma-separated list of YouTube video IDs for the resources for which you are retrieving rating data. Note that this request must be authorized using OAuth 2.0.
The sample request below retrieves the current user's rating of the video of the keynote speech at the 2014 Google I/O conference. (If you executed the previous example in the APIs Explorer, the API response should indicate that the rating is like
.
https://developers.google.com/apis-explorer/#p/youtube/v3/youtube.videos.getRating?
id=wtLJPvx7-ys
Retrieve videos rated by the current user
The videos.list
method's myRating
parameter lets you retrieve a list of videos rated by the user authorizing the API request. The parameter value indicates whether you want to retrieve liked or disliked videos.
The sample request below retrieves a list of videos to which the current user gave a like
rating. The request must be authorized using OAuth 2.0.
https://developers.google.com/apis-explorer/#p/youtube/v3/youtube.videos.list?
part=snippet
&myRating=like
Note: You can also retrieve a list of the user's liked videos (but not disliked videos) by following the flow for
retrieving a channel's favorite videos. In step 1 of that process, instead of retrieving the playlist ID for the channel's favorite videos, retrieve the playlist ID for the channel's liked videos. The
contentDetails.relatedPlaylists.likes
property contains the value.
Thus, the API allows you to retrieve a list of videos that the user liked using either the
videos.list
method or the
playlistItems.list
method. Since different information is returned in a
video
resource than a
playlistItem
resource, you can choose the method that best suits your needs.
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-03-31 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-03-31 UTC."],[[["The YouTube Data API (v3) allows users to rate videos using the `videos.rate` method, with options to `like`, `dislike`, or remove a rating (`none`), requiring OAuth 2.0 authorization."],["You can retrieve the currently authenticated user's rating for specific videos by using the `videos.getRating` method and providing a comma-separated list of video IDs, also requiring OAuth 2.0."],["The API enables the retrieval of a list of videos rated by the current user, either liked or disliked, through the `videos.list` method and its `myRating` parameter, which also requires OAuth 2.0."],["Alternatively, users can retrieve a list of their liked videos by using the `playlistItems.list` method and accessing the `contentDetails.relatedPlaylists.likes` property, which offers an alternative to the `videos.list` method."]]],["The YouTube Data API (v3) facilitates video rating management. Using `videos.rate`, users can set or remove ratings (`like`, `dislike`, `none`) for specific videos via the `id` and `rating` parameters. `videos.getRating` retrieves a user's rating for videos, referencing video IDs. The `videos.list` method, with the `myRating` parameter, fetches videos the user has rated as \"like\", and similar functionality is available via the `playlistItems.list` method. All requests require OAuth 2.0 authorization.\n"]]