YouTube search API
YouTube search as the site runs it: videos, Shorts, channels, playlists or movies, sorted by relevance, popularity, date or rating, with upload date, duration and feature filters, by region and language.
GET /v1/youtube/searchBeta1 credit per callRefunded on failureimport os, requests
res = requests.get(
"https://api.groundsocial.dev/v1/youtube/search?q=sourdough%20starter&upload_date=week&type=video",
headers={"Authorization": f"Bearer {os.environ['GROUNDSOCIAL_API_KEY']}"},
)
res.raise_for_status()
data = res.json()Response
200 · 1 credit{ "kind": "youtube#searchListResponse", "items": [ { "kind": "youtube#searchResult", "id": { "kind": "youtube#video", "videoId": "QkQLnrnzfKM" }, "snippet": { "publishedAt": "2025-11-24T12:00:00.000Z", "publishedAtIsApproximate": true, "publishedTimeText": "1 year ago", "title": "Easy how to make sourdough bread", "thumbnails": { "default": { "url": "https://i.ytimg.com/vi/QkQLnrnzfKM/default.jpg", "width": 120, "height": 90 }, "medium": { "url": "https://i.ytimg.com/vi/QkQLnrnzfKM/mqdefault.jpg", "width": 320, "height": 180 }, "high": { "url": "https://i.ytimg.com/vi/QkQLnrnzfKM/hqdefault.jpg", "width": 480, "height": 360 }, "standard": { "url": "https://i.ytimg.com/vi/QkQLnrnzfKM/sddefault.jpg", "width": 640, "height": 480 } }, "liveBroadcastContent": "none" }, "statistics": { "viewCount": "4000000" }, "statisticsAreApproximate": true, "isShort": true }, { "kind": "youtube#searchResult", "id": { "kind": "youtube#video", "videoId": "TnSS96piq2U" }, "snippet": { "publishedAt": "2026-04-28T12:00:00.000Z", "publishedAtIsApproximate": true, "publishedTimeText": "7 months ago", "title": "Sourdough Bread Recipe for Beginners: Step-by-Step Tutorial #sourdough", "thumbnails": { "default": { "url": "https://i.ytimg.com/vi/TnSS96piq2U/default.jpg", "width": 120, "height": 90 }, "medium": { "url": "https://i.ytimg.com/vi/TnSS96piq2U/mqdefault.jpg", "width": 320, "height": 180 }, "high": { "url": "https://i.ytimg.com/vi/TnSS96piq2U/hqdefault.jpg", "width": 480, "height": 360 }, "standard": { "url": "https://i.ytimg.com/vi/TnSS96piq2U/sddefault.jpg", "width": 640, "height": 480 } }, "liveBroadcastContent": "none" }, "statistics": { "viewCount": "820000" }, "statisticsAreApproximate": true, "isShort": true }, "… 1 more" ], "pageInfo": { "resultsPerPage": 17, "totalResults": 3219788 }, "estimatedResults": 3219788}Parameters
| Name | Type | Description |
|---|---|---|
qquery · required | string | What to search for. Example: sourdough starter. |
typequery | "all" | "video" | "short" | "channel" | "playlist" | "movie" | One of all, video, short, channel, playlist, movie. |
sortquery | "relevance" | "popular" | "date" | "rating" | One of relevance, popular, date, rating. |
upload_datequery | "hour" | "today" | "week" | "month" | "year" | One of hour, today, week, month, year. |
durationquery | "short" | "medium" | "long" | One of short, medium, long. |
featuresquery | string | Comma list of: live, 4k, hd, subtitles, creative_commons, 360, vr180, 3d, hdr, location, purchased. |
regionquery | string | ISO 3166-1 alpha-2 country: the results a visitor there sees. Example: US. |
languagequery | string | ISO 639-1 language code (en, es, pt-BR). Example: en. |
detailsquery | "0" | "1" | "true" | "false" | One of 0, 1, true, false. |
afterquery | string | The previous page’s nextPageToken. Tokens last 6 hours. |
Response fields
200 with a YouTubeSearchList, in the shape of YouTube Data API v3 resources.
| Field | Type | Description |
|---|---|---|
kind | "youtube#searchListResponse" | |
items | YouTubeSearchResult[] | |
nextPageToken | string | Pass as after for the next page. Absent on the last page. Lasts 6 hours. |
pageInfo | object | |
regionCode | string | |
estimatedResults | integer |
Status codes
| Status | Meaning |
|---|---|
200 | A page of results. |
400 | Invalid input. Nothing was charged. |
401 | Missing or invalid API key. |
402 | Not enough credits, a spend cap was reached, or payment is required. |
403 | The target is private, or the account is suspended. |
404 | The video, channel, playlist or post does not exist, was removed, or has nothing there. |
429 | Too many requests. Wait for Retry-After seconds. |
503 | YouTube is temporarily unavailable. Retryable; nothing was charged. |
Every error has code, message, hint and retryable. All error codes
Questions
Can I filter by exact dates?
The filters are YouTube’s own (last hour, today, week, month, year).
YouTube is a trademark of Google LLC. We are not affiliated with or endorsed by Google or YouTube.