Sources › Social media › Youtube › Search
Youtube Search API
Cari video, channel, atau playlist di YouTube.
Request
https://api.zapi.ink/v1/social-media:youtube-scraper/searchSend your key in the x-api-key header. The response is JSON in the { project, data, timestamp } envelope, and an identical request is served from cache for 15 minutes.
Parameters
| Name | Type | In | Required | Description |
|---|---|---|---|---|
| query | string | query | Yes | Search terms Example: lofi hip hop |
| type | enum: videos | channels | playlists | query | No | Result type. Default videos — an unfiltered search mixes shelves and returns an uneven count per page Example: videos |
| sort | enum: relevance | viewCount | query | No | Ordering. Default relevance Example: relevance |
| gl | string | query | No | Two-letter country code. Changes ranking and locale text Example: ID |
| hl | string | query | No | Interface language code Example: id |
| page | number | query | No | Page number. Default 1 — each page past the first costs one extra upstream round Example: 1 |
Code examples
curl -X GET "https://api.zapi.ink/v1/social-media:youtube-scraper/search?query=lofi+hip+hop&type=videos&sort=relevance&gl=ID&hl=id&page=1" \ -H "x-api-key: zpi_xxxxxxxxxxxxxxxxxxxxxxxx"
const res = await fetch("https://api.zapi.ink/v1/social-media:youtube-scraper/search?query=lofi+hip+hop&type=videos&sort=relevance&gl=ID&hl=id&page=1", { method: "GET", headers: { "x-api-key": "zpi_xxxxxxxxxxxxxxxxxxxxxxxx" }, }); const data = await res.json(); console.log(data);
import requests res = requests.get( "https://api.zapi.ink/v1/social-media:youtube-scraper/search", params={"query":"lofi hip hop","type":"videos","sort":"relevance","gl":"ID","hl":"id","page":"1"}, headers={"x-api-key":"zpi_xxxxxxxxxxxxxxxxxxxxxxxx"}, ) print(res.json())
Example response
{ "project": "social-media:youtube-scraper", "data": { "page": 1, "sort": "relevance", "type": "videos", "count": 20, "items": [ { "url": "https://www.youtube.com/watch?v=n61ULEU7CO0", "title": "Best of lofi hip hop 2021 ✨ [beats to relax/study to]", "isLive": false, "channel": { "name": "Lofi Girl", "channelId": "UCSJ4gkVC6NrvII8umztf0Ow" }, "videoId": "n61ULEU7CO0", "duration": 22258, "thumbnail": "https://i.ytimg.com/vi/n61ULEU7CO0/hq720.jpg?sqp=-oaymwEcCNAFEJQDSFXyq4qpAw4IARUAAIhCGAFwAcABBg==&rs=AOn4CLAi4TCpAtbxLFIBULRlcZHudl1uFw", "viewCount": 56337339, "description": "Listen on Spotify, Apple music and more → https://fanlink.tv/BestofLofi2021 The new Lofi Girl compilation “Best of 2021” is out now ...", "durationText": "6:10:58", "viewCountText": "56,337,339 views", "publishedTimeText": "4 years ago" }, { "url": "https://www.youtube.com/watch?v=X4VbdwhkE10", "title": "lofi hip hop radio 📚 beats to relax/study to", "isLive": true, "channel": { "name": "Lofi Girl", "channelId": "UCSJ4gkVC6NrvII8umztf0Ow" }, "videoId": "X4VbdwhkE10", "thumbnail": "https://i.ytimg.com/vi/X4VbdwhkE10/hq720.jpg?v=6a212016&sqp=-oaymwEcCNAFEJQDSFXyq4qpAw4IARUAAIhCGAFwAcABBg==&rs=AOn4CLAgn4FKbiWr9gXiEhIf0t5Y6y9TuQ", "viewCount": 12776, "description": "Listen on Spotify, Apple music and more → https://lnk.to/lofi-hiphop-beats-to-relax-study-to02 | Lofi Girl on all social media ...", "viewCountText": "12,776 watching" }, { "url": "https://www.youtube.com/watch?v=CLeZyIID9Bo", "title": "Chill Lofi Mix [chill lo-fi hip hop beats]", "isLive": false, "channel": { "name": "Settle", "channelId": "UCkKT4qf-TcPFOmpqhTawrGA" }, "videoId": "CLeZyIID9Bo", "duration": 6292, "thumbnail": "https://i.ytimg.com/vi/CLeZyIID9Bo/hq720.jpg?sqp=-oaymwE2CNAFEJQDSFXyq4qpAygIARUAAIhCGAFwAcABBvABAfgB_gmAAtAFigIMCAAQARhDIGQoZTAP&rs=AOn4CLCljfsoUy4QvdaH9IydXKSjwkcbgg", "viewCount": 34051654, "description": "YouTube Playlists: http://listen.settle.fm/youtube Listen on Spotify, Apple Music & more: https://listen.settle.fm/playlists Tracklist ...", "durationText": "1:44:52", "viewCountText": "34,051,654 views", "publishedTimeText": "3 years ago" } ], "query": "lofi hip hop", "total": 9365428, "hasMore": true, "nextPage": 2 }, "timestamp": "2026-05-27T13:36:09Z" }
Frequently asked questions
How do I call the Youtube Search API?
Send a GET request to https://api.zapi.ink/v1/social-media:youtube-scraper/search?query=lofi+hip+hop with your Zapi key in the x-api-key header. Parameters — required: query; optional: type, sort, gl, hl, page. The response is JSON in the { project, data, timestamp } envelope.
What does the Youtube Search API return?
Cari video, channel, atau playlist di YouTube. The example response has the fields page, sort, type, count, items, query, total, hasMore. Each item in items has fields such as url, title, isLive, channel, videoId, duration, thumbnail, viewCount.
Is the Youtube Search API free?
Yes. It is on the Zapi free tier: 600 Zap a month with one API key and no credit card. Each call costs 1 Zap. Paid plans raise the limits.
Can an AI assistant call the Youtube Search API?
Yes. Add the Zapi MCP server (https://mcp.zapi.ink/mcp) to Claude, Cursor or another MCP client and ask in plain words; it calls run_scraper with scraper "youtube-scraper" and endpoint "search".
What other Youtube API endpoints are there?
It has 12 endpoints. Besides Search: Get User Profile, Get User Videos, Get Video Detail, Get Video Comments, Get Playlist, Search Within Channel, and 5 more.