YouTube Search API
Search YouTube for videos, Shorts, channels, playlists or live streams, filtered by upload date and length and sorted by relevance, date, views or rating.
- 1 credit per call
- Failed calls are free
- Updated
- youtube.search.query
{ "has_more": true, "pages": 2, "results_count": 40, "results": [ { "title": "Sony WH-1000XM6 Review: Back on the Throne!", "views": "4,925,722 views", "view_count": 4925722, "channel": "Marques Brownlee", "channel_id": "UCBJycsmduvYEL83R_U4JriQ", "duration": "9:17", "duration_seconds": 557, "type": "video", "video_id": "XbXXKhfvSF0", "thumbnails": [ { "height": 202, "width": 360 }, { "height": 404, "width": 720 } ] }, { "title": "The Only ANC Headphones Worth Buying in 2026", "views": "132,845 views", "view_count": 132845, "channel": "Mark Ellis Reviews", "channel_id": "UCwwuSBYcErVlOpveYubHv4g", "duration": "18:37", "duration_seconds": 1117, "type": "video", "video_id": "ljV1iOJmE_E", "thumbnails": [ { "height": 202, "width": 360 }, { "height": 404, "width": 720 } ] } ]}
| # | Title | Views | View count | Channel | Duration | Duration seconds | Type | Channel id | Video id |
|---|---|---|---|---|---|---|---|---|---|
| 1 | Sony WH-1000XM6 Review: Back on the Throne! | 4,925,722 views | 4,925,722 | Marques Brownlee | 9:17 | 557 | video | UCBJycsmduvYEL83R_U4JriQ | XbXXKhfvSF0 |
| 2 | The Only ANC Headphones Worth Buying in 2026 | 132,845 views | 132,845 | Mark Ellis Reviews | 18:37 | 1117 | video | UCwwuSBYcErVlOpveYubHv4g | ljV1iOJmE_E |
| 3 | The Best Noise Cancelling Headphones To Buy In 2026 | 77,487 views | 77,487 | RTINGS Audio | 8:59 | 539 | video | UCz4geqN2YY6gktLikAKMvlw | -eLeP7MdoHI |
What you send
The input
object of the request, with every field the endpoint accepts.
| Field | Type | Required | What it does | Example |
|---|---|---|---|---|
| query | string | yes | What to search for. | noise cancelling headphones review |
| duration | string | no | Only short, medium or long videos. | short · long · medium |
| filter | string | no | One quick filter: videos, channels, playlists, live, Shorts, or uploads from today, this week, month or year. Use it alone, not with the filters below. | videos |
| limit | integer | no | How many results to return. | 40 |
| max_pages | integer | no | How many pages to read in this call. | 3 |
| sort | string | no | Relevance, rating, upload date or view count. | relevance · rating · upload_date · view_count |
| type | string | no | Only videos, channels, playlists or movies. | video · channel · playlist · movie |
| upload_date | string | no | Only uploads from the last hour, today, this week, month or year. | hour · today · week · month · year |
Fields it returns
What each record in the response holds, with the values from the sample above.
| Field | Type | What it is | Example |
|---|---|---|---|
| results[].title | string | The video's title. | Sony WH-1000XM6 Review: Back on the Throne! |
| results[].views | string | Views as YouTube writes them. | 4,925,722 views |
| results[].view_count | integer | Views as a number, read from what YouTube shows. | 4,925,722 |
| results[].channel | string | The channel that posted it. | Marques Brownlee |
| results[].channel_id | string | YouTube's ID for the channel. | UCBJycsmduvYEL83R_U4JriQ |
| results[].duration | string | The video's length as YouTube shows it. | 9:17 |
| results[].duration_seconds | integer | The video's length, in seconds. | 557 |
| results[].thumbnails | array | Thumbnail images in different sizes. | 2 records |
| results[].thumbnails[].height | integer | 202 | |
| results[].thumbnails[].width | integer | 360 | |
| results[].type | string | What kind of item it is, such as video. | video |
| results[].video_id | string | YouTube's ID for the video. | XbXXKhfvSF0 |
| has_more | boolean | Whether more results are available. | true |
| pages | integer | How many pages were read for this answer. | 2 |
| results | array | The matching videos. | 3 records |
| results_count | integer | How many results YouTube reports for the search. | 40 |
Call it from your code, or ask your agent
Set UPSCRAPE_API_KEY to your key and copy a working request.
curl --request POST \ --url https://data.upscrape.com/execute \ --header "Authorization: Bearer $UPSCRAPE_API_KEY" \ --header "Content-Type: application/json" \ --header "Prefer: wait=30" \ --data '{ "capability": "youtube.search.query", "input": { "filter": "videos", "limit": 40, "max_pages": 3, "query": "noise cancelling headphones review" }}'
import jsonimport osimport requestspayload = json.loads(r'''{ "capability": "youtube.search.query", "input": { "filter": "videos", "limit": 40, "max_pages": 3, "query": "noise cancelling headphones review" }}''')response = requests.post( "https://data.upscrape.com/execute", headers={ "Authorization": f"Bearer {os.environ['UPSCRAPE_API_KEY']}", "Content-Type": "application/json", "Prefer": "wait=30", }, json=payload,)response.raise_for_status()print(json.dumps(response.json(), indent=2))
const response = await fetch("https://data.upscrape.com/execute", { method: "POST", headers: { "Authorization": `Bearer ${process.env.UPSCRAPE_API_KEY}`, "Content-Type": "application/json", "Prefer": "wait=30", }, body: JSON.stringify({ "capability": "youtube.search.query", "input": { "filter": "videos", "limit": 40, "max_pages": 3, "query": "noise cancelling headphones review" }}),});if (!response.ok) { throw new Error(`Upscrape request failed: ${response.status}`);}console.log(JSON.stringify(await response.json(), null, 2));
https://data.upscrape.com/mcp
With Upscrape, get the YouTube search for filter "videos" and query "noise cancelling headphones review". Tell me what it costs before you run it, then show the results as a table.
More from the YouTube API
- YouTube Video API1 credit
- YouTube Channel API1 credit
- YouTube Channel Videos API1 credit
- YouTube Comments API1 credit
- YouTube Channel Shorts API1 credit
- YouTube Channel Live Streams API1 credit
- YouTube Channel Playlists API1 credit
- YouTube Playlist API1 credit
- YouTube Channel Community API1 credit
- YouTube Community Post API1 credit
- YouTube Hashtag Videos API1 credit
- YouTube Typeahead Search API1 credit
- YouTube Trending Shorts API1 credit
YouTube Search API FAQ
The short answers. The docs have the long ones.
How much does the YouTube Search API cost?
1 credit per successful call, shown before it runs. You buy credits once, and paid credits never expire.
What do I send?
Send query. The input fields below list every option with its type and limits.
Do I need a YouTube login?
No. It reads public YouTube data; nothing runs on your account.
Can my AI agent call it?
Yes, over MCP: the agent finds youtube.search.query, checks its price and runs it with the same credits as the REST API.
Your first YouTube call is free.
Up to 100 free credits to start, no card needed.