Is there any way to find playlist ID of youtube video using API, like through videoID? I looked into /playlistItems
endpoint but I'm not sure where I can find the playlist item ID? I've tried to look this over everywhere but I'm at lost.
2 Answers
I looked a bit, and the only method I can find would be limited to your own playlists and playlists on the video's channel (or other channels that you specify):
- Get the video ID
- If you want to check playlists on the same channel, get the channel ID from the video (see https://developers.google.com/youtube/v3/docs/videos#resource)
- Get the playlists you want to check (https://developers.google.com/youtube/v3/docs/playlists/list) - either your own playlists or playlists on
- Loop through and get the items on each playlist (https://developers.google.com/youtube/v3/docs/playlistItems/list as you found)
- Look for the playlist item that has the same video ID as the one you're examining (https://developers.google.com/youtube/v3/docs/playlistItems#resource)
It's a bit ugly, and limited of course - maybe someone else will share a better method with us.

- 359
- 1
- 8
-
In step 4, instead of loop, you can use the approach I show in [my answer](https://stackoverflow.com/a/71163891/12511801). – Marco Aurelio Fernandez Reyes Feb 08 '23 at 15:31
-
Thanks for suggesting this workaround. I was looking for a straightforward way with minimum API calls but I believe it's not possible. I think it's a pretty good solution cause it works perfectly in my case. Also, the quota cost won't be so high. – Afifa Feb 09 '23 at 08:47
An alternative could be:
- Since you have the
video_id
, get the title of the video as well. - With the title of the video, use the search:list endpoint for search playlists that matches with the query/criteria - that is, the title of the video.
- Loop the results from the search request and use the code I show in my answer for check if the
video_id
is on the playlist.
Example:
video_id:
eJjbnFZ6yA8
title:
FULL MATCH - The Rock vs. Mankind – WWE Championship Match: Raw, Jan. 4, 1999
Make search to get playlists that matches the search term: "FULL MATCH - The Rock vs. Mankind – WWE Championship Match: Raw, Jan. 4, 1999
"
URL:
https://youtube.googleapis.com/youtube/v3/search?part=id%2Csnippet&maxResults=50&q=FULL%20MATCH%20-%20The%20Rock%20vs.%20Mankind%20%E2%80%93%20WWE%20Championship%20Match%3A%20Raw%2C%20Jan.%204%2C%201999&type=playlist&key=[YOUR_API_KEY]
From the results of the search, get the playlist - for this example I took the first result I got from the search, then, I check if the video_id eJjbnFZ6yA8
is on the playlist PLAamU2iv-fSuxZrVqQIBcrrZMTCMbBt2W
URL:
https://youtube.googleapis.com/youtube/v3/playlistItems?part=id%2Csnippet&playlistId=PLAamU2iv-fSuxZrVqQIBcrrZMTCMbBt2W&videoId=eJjbnFZ6yA8&key=[YOUR_API_KEY]
Try-it here for check the results.
Keep in mind that the search:list
endpoint consumes 100 quota points, so, the quota might be drain rather quickly - depending of the intensity of the search.

- 2,071
- 2
- 9
- 33
-
Thanks for suggesting this workaround. I was looking for a straightforward way with minimum API calls but I believe it's not possible. I think it's a good solution, the only downside of this approach is the quota cost of search endpoint. – Afifa Feb 09 '23 at 08:52