Short answer: POST a word to /google/trends/autocomplete and you get the topics Google Trends offers for it, each with its topic ID and type — the /m/... or /g/... code that tells Trends you mean the car maker and not the band.
In Google Trends a plain word is a "search term": it matches the letters. A "topic" matches the thing, in every language and spelling. To chart a topic from code you need its ID, and this endpoint is how you look it up.
The request
curl -X POST 'https://api.serpbase.dev/google/trends/autocomplete' \
-H 'Content-Type: application/json' \
-H 'X-API-Key: YOUR_API_KEY' \
-d '{"q":"tesla"}'
What comes back
We ran this on 26 November 2026. tesla returned 5 suggestions in about 3 seconds:
text | type | id |
|---|---|---|
| Tesla | Automobile make | /m/0j6n6s8 |
| Tesla Model Y | SUV | /g/11gb_4f22x |
| Tesla | Band | /m/036wfx |
| Tesla | Automotive company | /m/0dr90d |
| Tesla Model 3 | Luxury vehicle | /g/11c3x48pb7 |
Three different things are called "Tesla" here, which is exactly why the ID matters. A second test, coffee, also returned 5 suggestions, in under a second, ranging from Coffee Makers & Espresso Machines (Topic) to a novelist.
Each item in suggestions has three fields: text, type and id.
Using the ID
We then sent the first ID as the query to the Trends endpoint:
curl -X POST 'https://api.serpbase.dev/google/trends' \
-H 'Content-Type: application/json' \
-H 'X-API-Key: YOUR_API_KEY' \
-d '{"q":"/m/0j6n6s8"}'
It returned one series for the past 12 months (time_range: today 12-m) with 53 weekly points for the topic.
Python: resolve a name, then chart the topic
import requests
API = "https://api.serpbase.dev"
H = {"X-API-Key": "YOUR_API_KEY"}
def topic_id(name, wanted_type):
r = requests.post(f"{API}/google/trends/autocomplete", headers=H,
json={"q": name}, timeout=30).json()
if r["status"] != 0:
raise SystemExit(r.get("error"))
for s in r["suggestions"]:
if s["type"] == wanted_type:
return s["id"]
return None
tid = topic_id("tesla", "Automobile make")
r = requests.post(f"{API}/google/trends", headers=H, json={"q": tid}, timeout=60).json()
for point in r["trends"]["series"][0]["points"][-4:]:
print(point["timestamp"][:10], point["value"])
Things that trip people up
- Pick by
type, not by position. The first suggestion forcoffeewas "Coffee Carafe", not coffee the drink. Read the types and choose. - Five at most. Both tests returned 5. If the thing you want is not listed, type more of its name.
- Same
text, different IDs. "Tesla" appeared three times. Store the ID, not the label. - Types are Google's free-form labels (
Topic,SUV,Novelist,Automotive company). Match them loosely; do not build a fixed list. - The latest Trends point can be partial. The last weekly point came back flagged
partial: true; leave it out of week-over-week maths.
Related endpoints
The interest-over-time endpoint is covered in Google Trends API: get interest over time as JSON. For what people type into Google itself, see Google autocomplete.
Cost and limits
Each request costs 2 credits; failed requests are not charged. The response is always HTTP 200 with a status field: 0 means success, anything else comes with an error string. Credits cost $0.25–$0.50 per 1,000 depending on the plan, and new accounts get 500 free credits without a card.
- Parameters and the full response: Google Trends autocomplete docs
- Try it in the browser: Google Trends autocomplete
- Credit packs: pricing