How to run a YouTube search
GET request to /v1/youtube/search with your input. You get clean JSON back in seconds for ~20 credits (1/result) per call — no OAuth, scraping or platform SDKs. Search YouTube programmatically and get structured, ranked results.How to run a YouTube search (step by step)
- 1
Get a free API key
Create a free Captapi account (100 credits, no card) and generate an API key from the dashboard.
- 2
Call the YouTube Search API
Send an authenticated GET request to /v1/youtube/search with your input. No OAuth, no scraping setup.
- 3
Read the JSON response
Parse the clean JSON response. Pass cache=true for a free 24h cache hit; default is always fresh.
Code example
curl "https://api.captapi.com/v1/youtube/search?q=lofi%20hip%20hop" \
-H "Authorization: Bearer capt_live_..."
# or: -H "x-api-key: capt_live_..."What the response looks like
{
"success": true,
"data": {
"query": "lofi hip hop",
"totalReturned": 5,
"results": [
{
"url": "https://www.youtube.com/watch?v=m8WjnuhoeDg&list=RDm8WjnuhoeDg&start_radio=1",
"title": "remember when lofi hip-hop was smooth like this.",
"publishedAt": "2025-08-14T21:00:50.000Z",
"viewCount": 467760,
"durationSeconds": 3722,
"thumbnailUrl": "https://i.ytimg.com/vi/m8WjnuhoeDg/maxresdefault.jpg",
"channelName": "the bootleg boy 2"
},
{
"url": "https://www.youtube.com/watch?v=kyqpSycLASY&list=RDkyqpSycLASY&start_radio=1",
"title": "Chill Summer Lofi [chill lo-fi hip hop beats]",
"publishedAt": "2023-06-09T10:00:41.000Z",
"viewCount": 12408733,
"durationSeconds": 7392,
"thumbnailUrl": "https://i.ytimg.com/vi/kyqpSycLASY/maxresdefault.jpg?sqp=-oaymwEmCIAKENAF8quKqQMa8AEB-AH-CYAC0AWKAgwIABABGEsgZSg5MA8=&rs=AOn4CLDQYDgEy1zHyg9iWjAb5jbRR3nHjg",
"channelName": "Settle"
},
{
"url": "https://www.youtube.com/watch?v=zW5wpJY1rgQ&list=RDzW5wpJY1rgQ&start_radio=1",
"title": "Night Drive ~ lofi hip hop mix ~ beats to chill / drive to",
"publishedAt": "2022-09-21T13:00:26.000Z",
"viewCount": 5733837,
"durationSeconds": 88623,
"thumbnailUrl": "https://i.ytimg.com/vi/zW5wpJY1rgQ/maxresdefault.jpg?sqp=-oaymwEmCIAKENAF8quKqQMa8AEB-AH-CYAC0AWKAgwIABABGHQgOih_MA8=&rs=AOn4CLCbYF2Kdc7dhlw8v8nlHQCZui9nXw",
"channelName": "Mimi Lofi Chill"
},
{
"url": "https://www.youtube.com/watch?v=CFGLoQIhmow&list=RDCFGLoQIhmow&start_radio=1",
"title": "lofi hip hop mix 📚 beats to relax/study to (Part 1)",
"publishedAt": "2024-10-17T19:00:07.000Z",
"viewCount": 7687081,
"durationSeconds": 10240,
"thumbnailUrl": "https://i.ytimg.com/vi/CFGLoQIhmow/maxresdefault.jpg",
"channelName": "Lofi Girl"
},
{
"url": "https://www.youtube.com/watch?v=n61ULEU7CO0&list=RDn61ULEU7CO0&start_radio=1",
"title": "Best of lofi hip hop 2021 ✨ [beats to relax/study to]",
"publishedAt": "2021-12-31T16:30:13.000Z",
"viewCount": 55716218,
"durationSeconds": 22258,
"thumbnailUrl": "https://i.ytimg.com/vi/n61ULEU7CO0/maxresdefault.jpg",
"channelName": "Lofi Girl"
}
]
}
}Billing metadata (credits charged, cache hit/miss) is returned in the X-Captapi-Credits and X-Captapi-Cache response headers.
Request parameters
| Name | Type | Required | Description |
|---|---|---|---|
| q | string | Yes | Search query or keywords (min 2 characters). |
| limit | integer | No | Max items to return (default 20, max 200). Billed per result. |
| cache | boolean | No | Set true to serve from the 24h response cache. Default false — always fetch fresh data. |
Frequently asked questions
What does the YouTube Search API do?
The YouTube Search API lets you search and return matching results from a public YouTube query using one GET request to /v1/youtube/search. It returns clean JSON — no OAuth or infrastructure setup required.
How many credits does the YouTube Search API cost?
At the default limit this endpoint costs 20 credits (1 per result). Billing scales with how many results you request. Pass cache=true to serve from the 24h shared cache (0 credits on hit); default is always fresh. Failed or empty results are never charged.
Do I need a YouTube API key or OAuth?
No. A single Captapi key works across every platform Captapi supports — YouTube, TikTok, Instagram, Facebook, Twitter/X, Reddit, Threads, Bluesky, Pinterest, LinkedIn, Rumble, Spotify, Kwai, and more. We handle proxies, rate limits, retries, and authentication for you.
Is the YouTube Search API suitable for production use?
Yes. It is a stable REST endpoint with predictable JSON and automatic retries. Pass cache=true to serve from the 24h shared cache (0 credits on hit); default is always fresh. Use it for analytics, monitoring, and content automation.
Ready to run a YouTube search?
Start free with 100 credits — no credit card required.
Get your free API key