YouTube autocomplete API
What YouTube’s search box suggests for a partial query, localised by region and language.
GET /v1/youtube/search/suggestionsBeta1 credit per callRefunded on failureimport os, requests
res = requests.get(
"https://api.groundsocial.dev/v1/youtube/search/suggestions?q=how%20to%20make",
headers={"Authorization": f"Bearer {os.environ['GROUNDSOCIAL_API_KEY']}"},
)
res.raise_for_status()
data = res.json()Response
200 · 1 credit{ "kind": "youtube#suggestions", "query": "how to make", "suggestions": [ "how to make a paper airplane", "how to make slime", "… 12 more" ]}Parameters
| Name | Type | Description |
|---|---|---|
qquery · required | string | The partial query. Example: how to make. |
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. |
Response fields
200 with a YouTubeSuggestions, in the shape of YouTube Data API v3 resources.
| Field | Type | Description |
|---|---|---|
kind | "youtube#suggestions" | |
query | string | |
suggestions | string[] |
Status codes
| Status | Meaning |
|---|---|
200 | The suggestions. |
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
How many?
About 14 per query.
YouTube is a trademark of Google LLC. We are not affiliated with or endorsed by Google or YouTube.