Google Trends API
Query trend interest over time, related topics, and related queries.
Endpoint
GET https://api.goanyapi.com/api/v1/google-trendsThe current configured cost is 6 credits per keyword.
Authentication
Authorization: Bearer YOUR_API_KEYRequest parameters
| Parameter | Required | Description |
|---|---|---|
q | Yes | Search query. TIMESERIES accepts up to five comma-separated queries; the other modes accept one query only. Each query is at most 100 characters. |
date | No | One of now 1-H, now 4-H, now 1-d, now 7-d, today 1-m, today 3-m, today 12-m, today 5-y, or all. Defaults to today 12-m. |
geo | No | Region code such as US. TIMESERIES may provide comma-separated regions matching the query count. |
data_type | No | TIMESERIES, RELATED_TOPICS, or RELATED_QUERIES. Defaults to TIMESERIES. |
Examples
Interest over time
curl --get 'https://goanyapi.com/api/v1/google-trends' \
--header 'Authorization: Bearer YOUR_API_KEY' \
--data-urlencode 'q=ai video,chatgpt'Related topics
curl --get 'https://goanyapi.com/api/v1/google-trends' \
--header 'Authorization: Bearer YOUR_API_KEY' \
--data-urlencode 'q=ai video' \
--data-urlencode 'data_type=RELATED_TOPICS'Related queries
curl --get 'https://goanyapi.com/api/v1/google-trends' \
--header 'Authorization: Bearer YOUR_API_KEY' \
--data-urlencode 'q=ai video' \
--data-urlencode 'data_type=RELATED_QUERIES'Only TIMESERIES supports comma-separated values in q. The same mode is the only mode that supports multiple comma-separated geo values, and their count must match the query count.
Response
{
"code": "ok",
"message": "ok",
"data": {
"endpoint": "google-trends",
"remainingCredits": 96,
"query": {
"q": "ai video,chatgpt",
"date": "today 12-m",
"data_type": "TIMESERIES"
},
"q": "ai video,chatgpt",
"date": "today 12-m",
"tz": 420,
"dataType": "TIMESERIES",
"interestOverTime": {
"timeline_data": [],
"averages": []
}
}
}Response object fields
| Field | Type | Description |
|---|---|---|
code | string | Public response status, normally ok for a successful request. |
message | string or null | Public response message. |
data.endpoint | string | Fixed value google-trends. |
data.costCredits | number | Credits charged for the request, calculated from the number of keywords. |
data.remainingCredits | number | Account credits remaining after the request. |
data.query.q | string | Normalized query string. |
data.query.date | string | Normalized date range. |
data.query.geo | string | Optional normalized region code(s). |
data.query.data_type | string | Normalized selected data type. |
data.q | string | Query returned by the trend data service. |
data.date | string | Date range returned by the trend data service. |
data.geo | string or null | Region returned by the trend data service. |
data.tz | number | Time-zone offset returned with the trend data. |
data.dataType | string | Returned data type. |
data.interestOverTime | object | Present for TIMESERIES; contains timeline_data and averages. |
data.relatedTopics | object | Present for RELATED_TOPICS; contains top and rising. |
data.relatedQueries | object | Present for RELATED_QUERIES; contains top and rising. |
For RELATED_TOPICS, the response contains relatedTopics with top and rising arrays. For RELATED_QUERIES, it contains relatedQueries with top and rising arrays. Fields not returned for the selected mode are omitted.
TIMESERIES response fields
All modes return the normalized q, date, optional geo, tz, and dataType fields. TIMESERIES additionally returns:
| Field | Description |
|---|---|
data.interestOverTime.timeline_data[] | Timeline points. |
data.interestOverTime.timeline_data[].date | Display date or date range. |
data.interestOverTime.timeline_data[].timestamp | Point timestamp. |
data.interestOverTime.timeline_data[].partial_data | Optional flag for an incomplete point. |
data.interestOverTime.timeline_data[].values[] | Values for each query. |
data.interestOverTime.timeline_data[].values[].query | Query text. |
data.interestOverTime.timeline_data[].values[].query_index | Zero-based query index. |
data.interestOverTime.timeline_data[].values[].value | Display interest value. |
data.interestOverTime.timeline_data[].values[].extracted_value | Numeric interest value. |
data.interestOverTime.averages[] | Average value for each query. |
data.interestOverTime.averages[].query | Query text. |
data.interestOverTime.averages[].value | Average interest value. |
RELATED_TOPICS response fields
| Field | Description |
|---|---|
data.relatedTopics.top[] | Top related topics. |
data.relatedTopics.rising[] | Rising related topics. |
data.relatedTopics.*[].topic.value | Topic identifier. |
data.relatedTopics.*[].topic.title | Topic title. |
data.relatedTopics.*[].topic.type | Topic type. |
data.relatedTopics.*[].value | Display relevance value. |
data.relatedTopics.*[].extracted_value | Numeric relevance value. |
data.relatedTopics.*[].link | Public trend link. |
RELATED_QUERIES response fields
| Field | Description |
|---|---|
data.relatedQueries.top[] | Top related queries. |
data.relatedQueries.rising[] | Rising related queries. |
data.relatedQueries.*[].query | Related query text. |
data.relatedQueries.*[].value | Display relevance value. |
data.relatedQueries.*[].extracted_value | Numeric relevance value. |
data.relatedQueries.*[].link | Public trend link. |
The value fields are the display values, while extracted_value contains the numeric value when available. partial_data is present only for incomplete timeline points.
Billing
Each keyword uses the current configured per-keyword rate shown above. TIMESERIES accepts at most five keywords, so one request charges up to five times that rate. Credits are deducted only after a valid response is returned. Invalid parameters, failed requests, and incomplete responses do not consume credits.