YouTube API
Playlist
Get playlist details and all videos in a YouTube playlist.
POST
$0.01/call/v1/youtube/playlistUsage
const res = await fetch('https://api.yepapi.com/v1/youtube/playlist', {
method: 'POST',
headers: {
'x-api-key': 'YOUR_API_KEY',
'Content-Type': 'application/json',
},
body: JSON.stringify({ id: 'PLrAXtmErZgOeiKm4sgNOknGvNjby9efdf' }),
});
const { data } = await res.json();
console.log(data.meta, data.data);curl -X POST https://api.yepapi.com/v1/youtube/playlist \
-H "x-api-key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"id": "PLrAXtmErZgOeiKm4sgNOknGvNjby9efdf"}'Request Body
| Parameter | Type | Required | Description | Default |
|---|---|---|---|---|
id | string | Yes | YouTube playlist ID | — |
token | string | No | Continuation token for pagination | — |
Response
{
"ok": true,
"data": {
"meta": {
"playlistId": "PLRqwX-V7Uu6ZiZxtDDRCi6uhfTH4FilpH",
"title": "Coding Challenges",
"channelTitle": "The Coding Train",
"channelId": "UCvjgXvBlbQiydffZU7m1_aw",
"channelHandle": "@TheCodingTrain",
"description": "Is it the gravy train or a train wreck? Watch me take on some viewer submitted coding projects!",
"videoCount": 245,
"videoCountText": "245 videos",
"viewCount": 2704837,
"viewCountText": "2,704,837 views",
"lastUpdated": "Last updated on Aug 18, 2024"
},
"continuation": "4qmF...",
"data": [
{
"videoId": "17WoOqgXsRM",
"title": "Coding Challenge 1: Starfield Simulation",
"channelTitle": "The Coding Train",
"channelId": "UCvjgXvBlbQiydffZU7m1_aw",
"channelHandle": "@TheCodingTrain",
"index": "1",
"isPlayable": true,
"lengthSeconds": "834",
"lengthText": "13:54",
"viewCount": 1300000,
"viewCountText": "1.3M views",
"videoInfo": "1.3M views \u2022 10 years ago",
"publishDate": "2016-04-13",
"publishedAt": "2016-04-13T00:00:00Z",
"publishedTimeText": "10 years ago",
"thumbnail": [
{ "url": "https://i.ytimg.com/vi/17WoOqgXsRM/hqdefault.jpg", "width": 168, "height": 94 }
]
}
]
}
}Response Fields
| Field | Type | Description |
|---|---|---|
ok | boolean | Whether the request succeeded |
data.meta | object | Playlist metadata |
data.meta.playlistId | string | Unique YouTube playlist identifier |
data.meta.title | string | Playlist title |
data.meta.channelTitle | string | Name of the channel that created the playlist |
data.meta.channelId | string | Channel ID of the playlist creator |
data.meta.channelHandle | string | Channel handle (e.g. @TheCodingTrain) |
data.meta.description | string | Playlist description text |
data.meta.videoCount | number | Total number of videos in the playlist |
data.meta.videoCountText | string | Formatted video count (e.g. 245 videos) |
data.meta.viewCount | number | Total view count across all playlist videos |
data.meta.viewCountText | string | Formatted view count (e.g. 2,704,837 views) |
data.meta.lastUpdated | string | When the playlist was last updated |
data.continuation | string | Token to fetch the next page of playlist videos |
data.data | object[] | Array of playlist video objects |
data.data[].videoId | string | Unique YouTube video identifier |
data.data[].title | string | Video title as displayed on YouTube |
data.data[].channelTitle | string | Name of the video's channel |
data.data[].channelId | string | Channel ID of the video uploader |
data.data[].index | string | Position of the video within the playlist |
data.data[].isPlayable | boolean | Whether the video is currently playable |
data.data[].lengthSeconds | string | Video duration in seconds |
data.data[].lengthText | string | Video duration in H:MM:SS or MM:SS format |
data.data[].viewCount | number | Total view count for this video |
data.data[].viewCountText | string | Formatted view count (e.g. 1.3M views) |
data.data[].videoInfo | string | Combined view count and publish time (e.g. 1.3M views * 10 years ago) |
data.data[].publishDate | string | Publish date in YYYY-MM-DD format |
data.data[].publishedAt | string | Publish date as ISO 8601 timestamp |
data.data[].publishedTimeText | string | Relative publish time (e.g. 10 years ago) |
data.data[].thumbnail | object[] | Video thumbnail images at various resolutions |
Use the continuation token from the response to paginate through large playlists.