API · YouTube
GET /youtube/search
Search YouTube: videos, Shorts, channels or playlists, with sort, date, duration and feature filters.
| Request | GET /v1/youtube/search |
| Operation id | youtube.search.videos |
| Cost | 1 credit, refunded if the call fails |
| Auth | API key: Authorization: Bearer <key> or x-api-key. |
Search YouTube: videos, Shorts, channels or playlists, with sort, date, duration and feature filters.
Query parameters
| Name | Type | Required | Description |
|---|---|---|---|
q | string | yes | What to search for. Example: sourdough starter. |
type | "all" | "video" | "short" | "channel" | "playlist" | "movie" | no | One of all, video, short, channel, playlist, movie. |
sort | "relevance" | "popular" | "date" | "rating" | no | One of relevance, popular, date, rating. |
upload_date | "hour" | "today" | "week" | "month" | "year" | no | One of hour, today, week, month, year. |
duration | "short" | "medium" | "long" | no | One of short, medium, long. |
features | string | no | Comma list of: live, 4k, hd, subtitles, creative_commons, 360, vr180, 3d, hdr, location, purchased. |
region | string | no | ISO 3166-1 alpha-2 country: the results a visitor there sees. Example: US. |
language | string | no | ISO 639-1 language code (en, es, pt-BR). Example: en. |
details | "0" | "1" | "true" | "false" | no | One of 0, 1, true, false. |
after | string | no | The previous page’s nextPageToken. Tokens last 6 hours. |
Responses
| Status | Meaning | Schema |
|---|---|---|
200 | A page of results. | YouTubeSearchList |
400 | Invalid input. Nothing was charged. | Error |
401 | Missing or invalid API key. | Error |
402 | Not enough credits, a spend cap was reached, or payment is required. | Error |
403 | The target is private, or the account is suspended. | Error |
404 | The video, channel, playlist or post does not exist, was removed, or has nothing there. | Error |
429 | Too many requests. Wait for Retry-After seconds. | Error |
503 | YouTube is temporarily unavailable. Retryable; nothing was charged. | Error |
YouTubeSearchList fields
| 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 |
Errors use one shape everywhere; see Errors for every code and what to do.