How to run a YouTube search
GET request to /v1/youtube/search with your input. You get clean JSON back in seconds for 2 credits 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=space" \
-H "Authorization: Bearer capt_live_..."
# or: -H "x-api-key: capt_live_..."What the response looks like
{
"success": true,
"data": {
"query": "space",
"totalReturned": 5,
"results": [
{
"url": "https://www.youtube.com/watch?v=KvrxcrlG6Mo",
"title": "SpaceX set to attempt starship rocket launch in South Texas",
"publishedAt": "5 days ago",
"viewCount": 41084,
"durationSeconds": 35,
"thumbnailUrl": "https://i.ytimg.com/vi/KvrxcrlG6Mo/hqdefault.jpg?sqp=-oaymwEcCOADEI4CSFXyq4qpAw4IARUAAIhCGAFwAcABBg==&rs=AOn4CLBvGaxl9zxxMlI9UvgXerbpjUI0pg",
"channelName": "WFAA"
},
{
"url": "https://www.youtube.com/watch?v=kBHfGJ76GlY",
"title": "SpaceX is learning as much as it can about rocket updates in test launch: Former SpaceX engineer",
"publishedAt": "5 days ago",
"viewCount": 17838,
"durationSeconds": 210,
"thumbnailUrl": "https://i.ytimg.com/vi/kBHfGJ76GlY/hq720.jpg?sqp=-oaymwEcCNAFEJQDSFXyq4qpAw4IARUAAIhCGAFwAcABBg==&rs=AOn4CLC1mzXfCTVM5XmdCSHQnrpdqEbbFA",
"channelName": "CNBC Television"
},
{
"url": "https://www.youtube.com/watch?v=gYCmoZCSqkI",
"title": "The Most Disturbing Events in Space",
"publishedAt": "5 months ago",
"viewCount": 1891769,
"durationSeconds": 1254,
"thumbnailUrl": "https://i.ytimg.com/vi/gYCmoZCSqkI/hq720.jpg?sqp=-oaymwEcCNAFEJQDSFXyq4qpAw4IARUAAIhCGAFwAcABBg==&rs=AOn4CLAeIltRB8k6SADrQC5wKX6UQSOiPg",
"channelName": "The Paint Explainer"
},
{
"url": "https://www.youtube.com/watch?v=SvwfkTmyHFU",
"title": "Why Space Is Genuinely Terrifying",
"publishedAt": "6 months ago",
"viewCount": 3019696,
"durationSeconds": 2298,
"thumbnailUrl": "https://i.ytimg.com/vi/SvwfkTmyHFU/hq720.jpg?sqp=-oaymwEcCNAFEJQDSFXyq4qpAw4IARUAAIhCGAFwAcABBg==&rs=AOn4CLDlvwzdnNDl-ZwXafY3GMI18oDXWA",
"channelName": "Joe Bart Philosophy"
},
{
"url": "https://www.youtube.com/watch?v=UiZRQBOs4Sk",
"title": "Undeniable proof that humans walked on the moon (six times) #space #astronomy #science #nasa",
"publishedAt": "8 days ago",
"viewCount": 283980,
"durationSeconds": 94,
"thumbnailUrl": "https://i.ytimg.com/vi/UiZRQBOs4Sk/hq720.jpg?sqp=-oaymwE2CNAFEJQDSFXyq4qpAygIARUAAIhCGABwAcABBvABAfgBtgiAAoAPigIMCAAQARhjIGMoYzAP&rs=AOn4CLBl05WqCDjAc9UuFJnRaEs94ADrRw",
"channelName": "ASTRO ALEXANDRA"
}
]
}
}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?
Each successful call costs 2 credits. 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