YouTube Search API
YouTube search with cursor pagination — typed hits, ids, canonical URLs, filters (2 credits/page).
GET request to /v1/youtube/search that responds with clean JSON and costs 2 credits. Pass cache=true for a free 24h cache hit; default is always fresh. Start with 100 free credits — no credit card.What is the YouTube Search API?
Search YouTube by keyword and get a cursor-paginated page of clean JSON: results[] with type (video|short|channel|playlist|live), id, canonical url, title, publishedTimeApprox + publishedTimeIsApproximate + publishedTimeText, viewCount + viewCountText + viewCountIsApproximate, durationSeconds, thumbnailUrl, channel{id,title,handle,url,thumbnail}, badges[], and subscriberCount on channel hits. Typed arrays videos[] / shorts[] / channels[] / playlists[] / lives[] / shelves[] are disjoint partitions of results (a live is only in lives[], never also in videos[]) — Σ typed === results.length. Filter with type, sortBy, uploadDate, duration, region. Pass nextCursor as cursor for the next page. Flat 2 credits per page.
What you get
- Disjoint typed arrays: videos / shorts / channels / playlists / lives
- cursor ↔ nextCursor round-trip (hasMore)
- subscriberCount on channel hits; publishedTimeIsApproximate null when no time
- viewCountIsApproximate false on exact rows; channel{} only
Try it
Fill in the parameters below and copy a ready-to-run request, or open the live Playground to run it against your account (no API key paste).
Parameters
curl "https://api.captapi.com/v1/youtube/search?q=space" \
-H "Authorization: Bearer capt_live_..."
# or: -H "x-api-key: capt_live_..."Edit the parameters and the code updates instantly. Switch languages and hit copy.
Example response
{
"success": true,
"data": {
"query": "space",
"totalReturned": 5,
"nextCursor": "EtACEgVzcGFjZRrGAlNCU0NBUXRxUm14WGQyaFFVbUpRZDRJQkMwdzVUazFTUzFsVE5uYzBnZ0VMUVhVeWJEWk9iMlo0TUVXQ0FRc3pXamh1TkRONWNDMXRaNElCQzJseU9HcE5lVXhDVXpacmdnRUxaeTFuYTJOM1dXdGtSRUdDQVF0R1RsSTNZVGhxYjBOSGM0SUJDMkpvTVd4amJqSlRVRTVuZ2dFTFZVdHJMV2hWUVd0UGQydUNBUXRvWjAxcVlqVjJhbWhtYTRJQkN6SlVhbnBKTXpWSk5sTmpnZ0VMV2xWMVVVMUtOVTh6V0UyQ0FRdFliWGxrTjBWRFZHeEpXWUlCQzFWek1sb3RWME01Y21GdmdnRUxaVmRmYlc5V05uWnZkRUdDQVF0WloyTlVkMlY1Vmt0a2I3SUJCZ29FQ0JZUUF1b0JCQWdDRUJrJTNEGIHg6BgiC3NlYXJjaC1mZWVk",
"hasMore": true,
"results": [
{
"type": "video",
"id": "jFlWwhPRbPw",
"url": "https://www.youtube.com/watch?v=jFlWwhPRbPw",
"title": "James Webb Found a Structure So Big It Breaks Known Physics",
"publishedAt": "2026-07-23T19:42:10.000Z",
"viewCount": 38769,
"durationSeconds": 7924,
"thumbnailUrl": "https://i.ytimg.com/vi/jFlWwhPRbPw/hq720.jpg?sqp=-oaymwEcCNAFEJQDSFXyq4qpAw4IARUAAIhCGAFwAcABBg==&rs=AOn4CLA7UvQbAJ_-ucLxF_Y5rLx6Et8OqQ",
"channelName": "Late Science",
"channelId": "UCIqH5kGFOM_lP9x_AmPodjQ",
"channel": {
"id": "UCIqH5kGFOM_lP9x_AmPodjQ",
"title": "Late Science",
"handle": "@Late_Science",
"url": "https://www.youtube.com/@Late_Science",
"thumbnail": null
},
"badges": [
"4K"
],
"publishedTimeText": "10 days ago"
},
{
"type": "video",
"id": "L9NMRKYS6w4",
"url": "https://www.youtube.com/watch?v=L9NMRKYS6w4",
"title": "James Webb Detected a Sign of a Different Universe That Shattered Every Model Built Since Einstein",
"publishedAt": "2026-06-03T19:42:10.000Z",
"viewCount": 151088,
"durationSeconds": 6441,
"thumbnailUrl": "https://i.ytimg.com/vi/L9NMRKYS6w4/hq720.jpg?sqp=-oaymwEcCNAFEJQDSFXyq4qpAw4IARUAAIhCGAFwAcABBg==&rs=AOn4CLDucFGeHFH4XAYqCTdLsGr5dul9IA",
"channelName": "SPACE BEFOREAFTER",
"channelId": "UCxbnsftoQou1IfWZlEb_1iA",
"channel": {
"id": "UCxbnsftoQou1IfWZlEb_1iA",
"title": "SPACE BEFOREAFTER",
"handle": "@space-before-after",
"url": "https://www.youtube.com/@space-before-after",
"thumbnail": null
},
"badges": [],
"publishedTimeText": "2 months ago"
}
],
"videos": [
{
"type": "video",
"id": "jFlWwhPRbPw",
"url": "https://www.youtube.com/watch?v=jFlWwhPRbPw",
"title": "James Webb Found a Structure So Big It Breaks Known Physics",
"publishedAt": "2026-07-23T19:42:10.000Z",
"viewCount": 38769,
"durationSeconds": 7924,
"thumbnailUrl": "https://i.ytimg.com/vi/jFlWwhPRbPw/hq720.jpg?sqp=-oaymwEcCNAFEJQDSFXyq4qpAw4IARUAAIhCGAFwAcABBg==&rs=AOn4CLA7UvQbAJ_-ucLxF_Y5rLx6Et8OqQ",
"channelName": "Late Science",
"channelId": "UCIqH5kGFOM_lP9x_AmPodjQ",
"channel": {
"id": "UCIqH5kGFOM_lP9x_AmPodjQ",
"title": "Late Science",
"handle": "@Late_Science",
"url": "https://www.youtube.com/@Late_Science",
"thumbnail": null
},
"badges": [
"4K"
],
"publishedTimeText": "10 days ago"
},
{
"type": "video",
"id": "L9NMRKYS6w4",
"url": "https://www.youtube.com/watch?v=L9NMRKYS6w4",
"title": "James Webb Detected a Sign of a Different Universe That Shattered Every Model Built Since Einstein",
"publishedAt": "2026-06-03T19:42:10.000Z",
"viewCount": 151088,
"durationSeconds": 6441,
"thumbnailUrl": "https://i.ytimg.com/vi/L9NMRKYS6w4/hq720.jpg?sqp=-oaymwEcCNAFEJQDSFXyq4qpAw4IARUAAIhCGAFwAcABBg==&rs=AOn4CLDucFGeHFH4XAYqCTdLsGr5dul9IA",
"channelName": "SPACE BEFOREAFTER",
"channelId": "UCxbnsftoQou1IfWZlEb_1iA",
"channel": {
"id": "UCxbnsftoQou1IfWZlEb_1iA",
"title": "SPACE BEFOREAFTER",
"handle": "@space-before-after",
"url": "https://www.youtube.com/@space-before-after",
"thumbnail": null
},
"badges": [],
"publishedTimeText": "2 months ago"
}
],
"shorts": [],
"channels": [],
"playlists": []
}
}Billing metadata is returned in response headers: X-Captapi-Credits (credits charged), X-Captapi-Cache (hit or miss), and X-Captapi-Source. Failed requests (4xx/5xx) are never charged. See the full list of error codes in the error reference.
Response structure
A successful call returns success and a data object with the following fields:
Top-level fields
queryThe search query you sent.totalReturnedNumber of items returned in this response.nextCursorCursor to pass for the next page of results. May be null when the platform does not expose deep pagination (e.g. some Facebook Ad Library searches).hasMoreWhether more results are available beyond this page. When true, pass nextCursor to fetch the next page.shortsShorts (array).channelsChannels (array).playlistsPlaylists (array).
Results
Each item in results contains:
typeContent type of the item.idId of this results item.urlCanonical URL of the item.titleTitle of this results item.publishedAtPublish time as ISO-8601 when YouTube exposes an absolute timestamp; approximate when derived from a relative label — see publishedTimeText.viewCountView count.durationSecondsLength in seconds for this item (full media length, or a segment span when the endpoint documents a start/end).thumbnailUrlThumbnail image URL.channelNameName of the channel.channelIdStable channel id (YouTube UC… when applicable).channelYouTube channel object for the result when present.badgesPlatform badges on the result (SoundCloud pro/verified; YouTube 4K/LIVE/New; etc.).publishedTimeTextOriginal relative publish label from the platform when an exact timestamp was not available (e.g. "1 year ago").
Videos
Each item in videos contains:
typeContent type of the item.idId of this videos item.urlCanonical URL of the item.titleTitle of this videos item.publishedAtPublish time as ISO-8601 when YouTube exposes an absolute timestamp; approximate when derived from a relative label — see publishedTimeText.viewCountView count.durationSecondsLength in seconds for this item (full media length, or a segment span when the endpoint documents a start/end).thumbnailUrlThumbnail image URL.channelNameName of the channel.channelIdStable channel id (YouTube UC… when applicable).channelYouTube channel object for the result when present.badgesPlatform badges on the result (SoundCloud pro/verified; YouTube 4K/LIVE/New; etc.).publishedTimeTextOriginal relative publish label from the platform when an exact timestamp was not available (e.g. "1 year ago").
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). Flat 2 credits per call. |
| cursor | string | No | Pagination cursor. Leave empty for the first page; then pass the nextCursor value returned in the previous response. |
| type | string | No | all | videos | shorts | channels | playlists. |
| sortBy | string | No | relevance | date | views | rating (alias: popular→views). |
| uploadDate | string | No | any | today | this_week | this_month | this_year. |
| duration | string | No | any | under_4 | 4_20 | over_20. Applies to long-form videos (not Shorts). |
| region | string | No | ISO country code for localized results (default US). |
| cache | boolean | No | Set true to serve from the 24h response cache (0 credits on hit). Default false — always fetch fresh. |
Authentication: send your key as Authorization: Bearer capt_live_.... A typical call costs 2 credits. Pass cache=true for a free 24h cache hit; default is always fresh.
How it works
- 1. Sign up — get 100 free credits, no card required.
- 2. Create a key from your dashboard.
- 3. Send one request to
/v1/youtube/searchand parse the JSON response.
Use cases
Trend Discovery
Find trending content by keyword or hashtag.
Content Sourcing
Build feeds and playlists programmatically.
Monitoring
Track topics, brands, and competitors.
Research
Sample large sets of content for analysis.
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 cache (0 credits on hit); default is always fresh. Selected profile endpoints also accept cacheMaxAge=1d|3d|7d|14d|30d. 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 cache (0 credits on hit); default is always fresh. Selected profile endpoints also accept cacheMaxAge=1d|3d|7d|14d|30d. Use it for analytics, monitoring, and content automation.
More YouTube APIs
Ready to use the YouTube Search API?
Sign up, grab your key, and make your first call in 60 seconds.