It unfortunately seems like this feature has been put to sleep by the YouTube API team.
In August 11, 2016, they announced that they would be deprecating the APIs for watch later and watch history playlists:
The channel resource's contentDetails.relatedPlaylists.watchHistory
and contentDetails.relatedPlaylists.watchLater
properties are only visible to an authorized user retrieving data about the user's own channel. After September 12, 2016, the contentDetails.relatedPlaylists.watchHistory
will return a value of HL
and the contentDetails.relatedPlaylists.watchLater
property will return a value of WL
for all channels.
Requests to retrieve playlist details (playlists.list
) for a channel's watch history or watch later playlist will return an empty list after September 12, 2016. Requests to retrieve playlist items (playlistItems.list
) in either of those playlists will also return an empty list after that time. This is true for the new values, HL
and WL
, as well as for any watch history or watch later playlist IDs that your API Client may have already stored.
On September 15, 2016, they announced they had removed this information from the APIs: (emphasis mine)
The channel resource's contentDetails.relatedPlaylists.watchHistory
and contentDetails.relatedPlaylists.watchLater
properties now contain values of HL
and WL
, respectively, for all channels.
To be clear, these properties are only visible to an authorized user retrieving data about the user's own channel. The properties always contain the values HL
and WL
, even for an authorized user retrieving data about the user's own channel. Thus, the watch history and watch later playlist IDs cannot be retrieved via the API.
In addition, requests to retrieve playlist details (playlists.list
) or playlist items (playlistItems.list
) for a channel's watch history or watch later playlist now return empty lists. This behavior is true for the new values, HL
and WL
, as well as for any watch history or watch later playlist IDs that your API Client may have already stored.
On November 2, 2016, they even announced new errors indicating that such contents cannot be retrieved from the API:
The playlistItems.list
method returns this error to indicate that the request tried to retrieve "watch history" playlist items, but those cannot be retrieved using the API.
On the other hand, there are documentation like the overview page and the migration from v2 guide that still indicate the old method of getting the IDs through the playlist API. I personally think these docs are just outdated.
If I was in your position, I'd just work my requirement around it, avoiding this. You can go back to v2 or do some other stuff like scraping the website, but if the YouTube API is explicitly preventing these to be available to third parties, it might seem you could get into legal trouble.