The YouTube Search API provides real-time access to structured YouTube search results.Documentation Index
Fetch the complete documentation index at: https://docs.hasdata.com/llms.txt
Use this file to discover all available pages before exploring further.
Get Your API Key
Sign in at hasdata.com, go to your account settings, and copy your API key. All requests must include your key in thex-api-key header.
Request Cost and API Credits
Each request to the YouTube Search API consumes API Credits from your account balance.- Cost per request: 10 API Credits
- Credits are deducted only for successful requests.
- Your total available credits depend on your active plan.
Make Your First Request
API Parameters
| Parameter | Default Value | Required | Description |
|---|---|---|---|
q | BMW | Yes | Free-text search query, exactly as a user would type it into the YouTube search box. |
gl | - | No | The two-letter country code for the country you want to limit the search to. |
hl | - | No | The two-letter language code for the language you want to use for the search. |
deviceType | - | No | Device type for the request. |
sp | - | No | Raw YouTube sp filter token, copied verbatim from a YouTube search URL (e.g. EgIQAQ%253D%253D). When provided, it overrides sortBy, date, videoType, length, and filters[]. Use only if you need a YouTube-side filter that this API does not expose as a structured parameter. |
sortBy | - | No | Sort order applied to the results page. relevance (default) — best match for the query; date — newest first; views — most viewed first; rating — highest rated first; popularity — trending/most popular. |
date | - | No | Limit results to videos uploaded within this time window relative to now. |
videoType | - | No | Restrict results to a single YouTube content type — regular videos, Shorts, channels, playlists, or movies. |
length | - | No | Filter by video duration bucket: - under4 — under 4 minutes- between420 — 4 to 20 minutes- plus20 — over 20 minutes |
filters[] | - | No | Feature flags to require on results. Multiple values are combined with AND (every flag must apply). - hd — HD quality- k4 — 4K quality- hdr — HDR- subtitles — has subtitles/closed captions- cc — Creative Commons license- d3 — 3D video- d360 — 360° video- vr180 — VR180 video- live — currently live- bought — purchased/paid content- location — has a geographic location tag |
paginationToken | - | No | Token returned in the previous response to fetch the next page. |