Playlists & Search¶
Use these endpoints to inspect YouTube playlists and run programmatic searches across videos, channels, and playlists.
Endpoints¶
| Endpoint |
Purpose |
GET /v1/youtube/playlist |
Title, description, video count, and metadata for a playlist |
GET /v1/youtube/playlist/videos |
Ordered list of video IDs in a playlist |
GET /v1/youtube/search |
Search YouTube for videos, channels, and playlists |
REST API Examples¶
Get playlist info¶
curl "https://youtube.toolkitapi.io/v1/youtube/playlist?url=https://www.youtube.com/playlist?list=PLxxxxxx" \
-H "X-API-Key: YOUR_KEY"
const params = new URLSearchParams({ url: "https://www.youtube.com/playlist?list=PLxxxxxx" });
const resp = await fetch(`https://youtube.toolkitapi.io/v1/youtube/playlist?${params}`, {
headers: { "X-API-Key": "YOUR_KEY" },
});
const data = await resp.json();
console.log(`${data.title} — ${data.video_count} videos`);
List playlist videos¶
curl "https://youtube.toolkitapi.io/v1/youtube/playlist/videos?playlist_id=PLxxxxxx&limit=20" \
-H "X-API-Key: YOUR_KEY"
Search YouTube¶
curl "https://youtube.toolkitapi.io/v1/youtube/search?query=web+scraping+api&limit=10" \
-H "X-API-Key: YOUR_KEY"
Python SDK examples¶
from toolkitapi import Media
with Media(api_key="tk_...") as media:
playlist = media.youtube_playlist("PLbpi6ZahtOH6Ar_3GPy3workEnCu-Q5MB")
print(playlist["title"], "—", playlist["videoCount"], "videos")
Playlist from URL¶
from toolkitapi import Media
with Media(api_key="tk_...") as media:
playlist = media.youtube_playlist(
"https://www.youtube.com/playlist?list=PLbpi6ZahtOH6Ar_3GPy3workEnCu-Q5MB"
)
print(playlist["channelTitle"])
List video IDs in a playlist¶
from toolkitapi import Media
with Media(api_key="tk_...") as media:
result = media.youtube_playlist_videos("PLbpi6ZahtOH6Ar_3GPy3workEnCu-Q5MB")
print(f"{len(result['videoIds'])} videos in playlist")
for vid_id in result["videoIds"]:
print(f" https://www.youtube.com/watch?v={vid_id}")
Search YouTube¶
from toolkitapi import Media
with Media(api_key="tk_...") as media:
results = media.youtube_search("Python tutorial for beginners", limit=10)
for item in results["results"]:
print(f"[{item['type']}] {item['title']} — {item['id']}")
Playlist response fields¶
| Field |
Type |
Description |
id |
string |
Playlist ID |
title |
string |
Playlist title |
description |
string |
Playlist description |
videoCount |
integer |
Number of videos in the playlist |
channelId |
string |
Owning channel ID |
channelTitle |
string |
Owning channel name |
publishedAt |
string |
ISO 8601 creation timestamp |
thumbnails |
object |
Thumbnail URLs by size |
Playlist videos response fields¶
| Field |
Type |
Description |
playlistId |
string |
Playlist ID |
videoIds |
string[] |
Ordered list of video IDs |
videoCount |
integer |
Number of IDs returned |
Search response fields¶
| Field |
Type |
Description |
query |
string |
The search query string |
results |
array |
List of search result items (see below) |
results[] item fields¶
| Field |
Type |
Description |
id |
string |
Video ID, channel ID, or playlist ID |
type |
string |
video, channel, or playlist |
title |
string |
Result title |
description |
string |
Short description or snippet |
channelId |
string |
Associated channel ID (nullable for channel-type results) |
channelTitle |
string |
Associated channel name |
publishedAt |
string |
ISO 8601 publish date (nullable) |
thumbnails |
object |
Thumbnail URLs by size |
Tips¶
playlist and playlist/videos both accept a playlist ID or a full YouTube playlist URL.
playlist/videos returns IDs in playlist order — useful for building ordered content queues or course outlines.
- The
search endpoint's limit parameter accepts 1–50. Default is 20.
- Search results mix
video, channel, and playlist types — filter by type if you need only one kind.
- Combine
playlist/videos with the video or transcript endpoint to bulk-enrich every video in a playlist.
- https://youtube.toolkitapi.io/tools/youtube/youtube-playlist/
- https://youtube.toolkitapi.io/tools/youtube/youtube-playlist-videos/
- https://youtube.toolkitapi.io/tools/youtube/youtube-search/