The Google Trends Autocomplete API for topic IDs
Send a keyword to get matching Google Trends topics as JSON, each with a topic ID. Pass that ID to the interest API next.
Google Trends Autocomplete API at a glance
This API turns a keyword into Google Trends topics. Send a POST request with a keyword, then read each topic from the topics array. Run the example below to see the exact shape.
- Endpoint
POST /v1/data/google-trends/autocomplete- Authentication
- API key as
Authorization: Bearer wh_… - Stage
- Stable
- Output
- A topics array with position, title, type, mid and url, plus the keyword and total_results
- Topic ID
- The mid field, such as /m/01vk_m, is the ID that Google Trends Interest accepts
- Results per request
- 1 to 50 with num_results. The default is 10.
- Locale
- hl sets the Google Trends locale and timezone sets an offset in minutes. Defaults are en-US and -330.
- Timeout
- timeout_ms from 3000 to 60000. The default is 20000.
- Credit weight
- 1. See the pricing page for current rates.
One request, structured JSON.
This request asks for three topics that match espresso machine. The response below shows two of the three topics returned. Run the request in a terminal to see it live.
curl -X POST "https://api.datablue.dev/v1/data/google-trends/autocomplete" \
-H "Authorization: Bearer wh_..." \
-H "Content-Type: application/json" \
-d '{
"keyword": "espresso machine",
"hl": "en-US",
"timezone": -330,
"num_results": 3
}'{
"success": true,
"source": "google_trends",
"operation": "autocomplete",
"keyword": "espresso machine",
"total_results": 3,
"topics": [
{
"position": 1,
"title": "Espresso machine",
"type": "Topic",
"mid": "/m/01vk_m",
"url": "https://trends.google.com/trends/explore?q=%2Fm%2F01vk_m&hl=en-US"
},
{
"position": 3,
"title": "Breville Bambino Plus Espresso Machine",
"type": "Espresso machine",
"mid": "/g/11hzmd9mq2",
"url": "https://trends.google.com/trends/explore?q=%2Fg%2F11hzmd9mq2&hl=en-US"
}
]
}What a topic returns.
Each topic arrives as one object with named fields.
Title
Every topic has a title such as Commercial Espresso Machines, so show it to users when they pick one.
Topic ID
The mid field holds the topic ID, for example /m/01vk_m. Pass it to Google Trends Interest to chart the topic.
Type
Each result carries a type label, so one sample result reads Topic while the other reads Espresso machine. Read type before you chart a result.
Position
Each topic has a position from 1 upward, so take position 1 when you need one best match.
Request details
The response echoes your keyword and locale settings, and the total_results field counts the topics returned.
Topic link
Each topic includes a url for its Google Trends page. Open the link to check any result by eye.
Options that shape your lookup.
Only the keyword field is required for a request. Add the other options when you need tighter control.
Keyword
Set keyword to the term you would type into Trends, and try a short phrase such as espresso machine first.
Result count
Ask for 1 to 50 topics per request with num_results, and the default is 10.
Locale and timezone
Set hl to choose a Google Trends locale like en-US. Set timezone as an offset in minutes, for example -330. Both options keep their defaults when you leave them out.
Timeout
Set timeout_ms from 3000 to 60000 for the provider timeout, with 20000 as the default.
Topic IDs for Interest
Pass the mid in the keywords array of Trends Interest, then show users the title.
What teams build with it.
Topic IDs make trend work precise and repeatable.
Keyword research tools
Offer a topic picker as users type a term, then show each title and keep the mid behind the scenes.
Trend dashboards
Resolve each tracked subject to a topic ID once. Store the ID beside the label, then chart it weekly.
Product and brand matching
Search a product name to see if Trends lists it. Our sample returned a Breville model as its own topic.
Content planning
Check which topics exist before you choose an article subject. Compare the titles against your own list of subjects.
Why use an API instead of building a topic lookup.
Google Trends Interest accepts search terms or topic IDs. This API is where you find those IDs. A single request returns up to 50 topics.
DataBlue runs the lookup for you and returns parsed JSON. Your code reads named fields such as title and mid, so there is no browser session or page markup to maintain.
Every field on this page comes from a live response. Build against those fields first, then add locale options later. Pair it with Google Trends Interest to chart any result.
Your first topic lookup in a minute.
Get a key, send a keyword and read the topics.
Create an account
Register for an account to receive an API key.
Look up a keyword
POST a keyword to /v1/data/google-trends/autocomplete with a Bearer key. Set num_results to keep the response short.
Pick a topic
Loop over topics in the response and read each mid. Pass the one you want to Google Trends Interest.
Google Trends Autocomplete API questions.
These answers cover topics and billing before you start.
It turns a keyword into Google Trends topics as JSON. It also has a topic ID in the mid field.
Still have a question?Ask us anything
Send a POST request to /v1/data/google-trends/autocomplete with a keyword. Read the mid field of the topic you want.
The fields section above lists every field. Compare it with the sample response above.
Set num_results between 1 and 50 to control the count, and the default is 10 topics per request.
Autocomplete resolves a keyword to a topic ID, so pass that mid to Google Trends Interest.
Set hl to choose the Google Trends locale for results. The default is en-US for hl and -330 for timezone.
This API is stable, so build against the documented fields. Check the changelog before each upgrade you ship.
This API has a credit weight of 1. Check the pricing page for current rates.
Find a Google Trends topic ID in a minute.
Open an account to receive your key. Then send the example keyword and read the topics.
Start free
