YouTube search suggestions API
The live suggestions YouTube shows while a user types.
- Cost
- 1 credit
- Cached repeats
- 0 creditssend max_age_days, results kept 1 day
- Failed requests
- 0 credits
- Status
- Betashape may still gain fields
Channel suggestions carry the channel id, handle, name and thumbnail.
You send query.
Request
Send your key in the x-api-key header.
curl -G "https://api.socialscrape.io/v1/youtube/search/typeahead" \
-H "x-api-key: $SOCIALSCRAPE_API_KEY" \
--data-urlencode 'query=mr beast'import os
import requests
params = {
"query": "mr beast",
}
res = requests.get(
"https://api.socialscrape.io/v1/youtube/search/typeahead",
headers={"x-api-key": os.environ["SOCIALSCRAPE_API_KEY"]},
params=params,
timeout=60,
)
body = res.json()
if body["ok"]:
print(body["data"])
else:
print(body["error"]["code"], body["error"]["message"])const url = new URL("https://api.socialscrape.io/v1/youtube/search/typeahead");
url.search = new URLSearchParams({
query: "mr beast",
}).toString();
const res = await fetch(url, {
headers: { "x-api-key": process.env.SOCIALSCRAPE_API_KEY! },
});
const body = await res.json();
if (body.ok) {
console.log(body.data);
} else {
console.error(body.error.code, body.error.message);
}{
"nodes": [
{
"name": "SocialScrape YouTube search suggestions",
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.2,
"position": [
0,
0
],
"parameters": {
"method": "GET",
"url": "https://api.socialscrape.io/v1/youtube/search/typeahead",
"sendQuery": true,
"queryParameters": {
"parameters": [
{
"name": "query",
"value": "mr beast"
}
]
},
"sendHeaders": true,
"headerParameters": {
"parameters": [
{
"name": "x-api-key",
"value": "={{ $env.SOCIALSCRAPE_API_KEY }}"
}
]
}
}
}
],
"connections": {}
}Parameters
| Name | Type | Required | Description |
|---|---|---|---|
query | string | yes | Partial or complete search text. Also accepted as keyword, q. |
cursor | string | Opaque cursor from the previous page; pass it back unchanged. Also accepted as continuationToken, continuation_token, next_max_id, max_id, max_cursor, min_time, after, page_token, pageToken, paginationToken, next_page_id, page. |
Every request also accepts trim, raw and max_age_days.
Response
Sample from a recorded response, shortened. Values are public data, not yours.
{
"ok": true,
"credits_charged": 1,
"credits_remaining": 4999,
"cached": false,
"cached_at": null,
"request_id": "req_d54c36b356abf4168bb9709c",
"data": {
"object": "list",
"items": [
{
"object": "suggestion",
"platform": "youtube",
"kind": "channel",
"text": "MrBeast",
"id": "UCX6OQ3DkcsbYNE6H8uQQuVA",
"handle": "MrBeast",
"url": "https://www.youtube.com/@MrBeast",
"image_url": "https://yt3.googleusercontent.com/nxYrc_1_2f77DoBadyxMTmv7ZpRZapHR5jbuYe7PlPd5cIRJxtNNEYyOC0ZsxaDyJJzXrnJiuDE=s88-c-k-c0x00ffffff-no-rj",
"verified": null,
"extra": {
"query": "mrbeast"
}
},
{
"object": "suggestion",
"platform": "youtube",
"kind": "query",
"text": "mr beast give me some money",
"id": null,
"handle": null,
"url": null,
"image_url": null,
"verified": null,
"extra": null
}
],
"cursor": null,
"has_more": false,
"parent": null
},
"cursor": null,
"has_more": false
}Fields
A page of results. Each entry in items is a Suggestion. cursor and has_more page through the rest.
A field the platform does not give is null, never made up. Extra platform details are in extra.
| Field | Type | Always | Notes |
|---|---|---|---|
object | "suggestion" | ||
platform | Platform | yes | |
kind | "query" or "channel" or "user" or "hashtag" or "place" or "product" or "unknown" | ||
text | string | yes | |
id | string or null | channel / user / hashtag / place id when the platform gives one | |
handle | string or null | ||
url | string or null | ||
image_url | string or null | ||
verified | boolean or null | ||
extra | object or null |
Full field list in the reference for this endpoint and the data models. Errors are listed under Errors.
Questions
Which errors can it return?
invalid_params (do not retry), not_found (do not retry). Account and platform errors from the errors list can also happen. A failure always costs 0 credits.
How do I get more than one page?
Send the same request with cursor set to the cursor you received, until has_more is false. Each page costs its own price. See pagination.
Is there an SDK call for it?
The preview Python client has client.youtube.search_typeahead(...) and the TypeScript client client.youtube.searchTypeahead(). Both return the same envelope as the HTTP API. The packages are not published yet; plain HTTP works today in any language.
Can an AI agent call it?
Yes. The MCP server reaches every built endpoint, with the same prices.