Skip to content

Latest commit

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date

Repository files navigation

Trends API

POST https://api.trendsapi.ai/api returns a 0-100 demand index for Google, TikTok, Amazon, Reddit, YouTube, Steam, npm, and related feeds.

Three operations (mode): history, growth, live ranks. One Bearer key covers all of them.

Get a free key · Pricing · llms.txt

License: MITRESTFree tier

Table of contents

Authentication

ItemValue
HeaderAuthorization: Bearer <key>
KeyIssued at trendsapi.ai/#get-key
Free quota100 successful calls / month, no card

Do not put the key in client-side JavaScript or a public repo.

Quickstart

Prefer a client. It returns decoded objects. You do not parse body.

pip install trendsapi
export TRENDSAPI_KEY=your_key
fromtrendsapiimportTrendsAPIclient=TrendsAPI()
print(client.get_top_trends(type="Google Trends", limit=5))
npm install trendsapi
import{TrendsAPI}from"trendsapi";constclient=newTrendsAPI({apiKey: process.env.TRENDSAPI_KEY});console.log(awaitclient.getTopTrends({type: "Google Trends",limit: 5}));

Same call over HTTP:

curl -sS -X POST https://api.trendsapi.ai/api \
-H "Authorization: Bearer $TRENDSAPI_KEY" \
-H "Content-Type: application/json" \
-d '{"mode":"get_top_trends","type":"Google Trends","limit":5}'

If you skip the SDK, read HTTP response before you parse anything.

HTTP response

Successful JSON always looks like this:

FieldTypeMeaning
statusCodeintegerApplication status. 200 means the payload in body is usable
bodystringJSON text. Parse it a second time
{
"statusCode": 200,
"body": "[{\"date\":\"2026-03-21\",\"value\":47,\"keyword\":\"bitcoin\",\"source\":\"google search\"}]"
}

Python: data = json.loads(res.json()["body"])
Node: const data = JSON.parse((await res.json()).body)

If the HTTP status is not 200, the gateway may return HTML (504). Check HTTP status before .json(). Only envelope statusCode == 200 counts against quota.

Methods

One URL. The JSON field mode selects the operation.

modeReturnsRequired
get_time_seriesWeekly history for one keyword on one sourcesource, keyword
get_growthPercent change over one or more windowssource, keyword
get_top_trendsLive ranked list for one feedtype

get_trends is an alias of get_time_series. Use get_time_series in new code.

Not available: geo / region breakdown, related queries, related topics, hourly series, category filters on keyword sources.

Request fields

FieldTypeUsed byRequiredNotes
modestringallyesOne of the three values above
sourcestringtime series, growthyesLowercase. See keyword sources
keywordstringtime series, growthyesFormat depends on source
percent_growtharraygrowthnoDefault ["12M"]. Strings and/or {recent, baseline} objects
typestringtop trendsyes (prefer)Exact feed name. See live feeds
limitintegertop trendsnoDefault 25, max 200
offsetintegertop trendsnoDefault 0
categorystringtop trendsnoOnly Amazon Best Sellers by Category and Top Websites

source and type are different catalogs. source: "Google Trends" is 400. type: "google search" is 400.

Keyword sources

source on get_time_series and get_growth. One source per time-series call. Growth may take a comma-separated list ("amazon, tiktok, youtube").

sourceSignalkeyword must be
google searchGoogle search volumeAny phrase
google imagesImage search volumeAny phrase
google newsNews-tab search volumeAny phrase
google shoppingShopping-tab search volumeAny phrase
youtubeYouTube search volumeAny phrase
tiktokTikTok hashtag volumeHashtag or topic (# optional)
redditCommunity / topic attentionSubreddit name, no r/
amazonAmazon product search volumeProduct name or category
wikipediaWikipedia page viewsArticle title or topic
news volumeArticle mention volumeAny phrase
news sentimentNews toneAny phrase
app downloadsAndroid download interestBundle ID, e.g. com.openai.chatgpt
app rankingsAndroid chart positionBundle ID, e.g. com.himshers.hims
npmnpm weekly downloadsExact package name (react, @babel/core)
steamMonthly concurrent playersGame display name (Elden Ring)

chatgpt on app downloads is 404. Use the Play Store id after ?id=.

iOS charts, GitHub repos, Spotify, IMDb, Open Library, and global site rank are live feeds, not source values. There is no source: "web traffic".

Live feeds

type on get_top_trends. No keyword. Match spelling and capitalization exactly.

typeRanks
Google TrendsGoogle searches right now
Google News Top NewsGoogle News stories
TikTok Trending HashtagsTikTok hashtags
TikTok Trending SearchesTikTok in-app searches
TikTok Shop Hot ProductsTikTok Shop products
YouTube TrendingYouTube videos
X (Twitter) TrendingTopics on X
Reddit Hot PostsReddit front page
Reddit World Newsr/worldnews
Wikipedia TrendingMost-viewed articles today
Amazon Best Sellers Top RatedTop-rated Amazon sellers
Amazon Best Sellers by CategoryCategory sellers (category filter)
App Store Top FreeiOS free chart
App Store Top PaidiOS paid chart
Google PlayPlay chart
Top WebsitesGlobal traffic rank
Spotify Top PodcastsSpotify podcasts
Steam Most PlayedLive concurrent players
GitHub Trending ReposDaily repos
IMDb MOVIEmeterMovie activity
Open Library Trending BooksBooks

get_time_series

Weekly history for one source + keyword.

{"mode": "get_time_series", "source": "google search", "keyword": "bitcoin"}

Parsed body is an array of points.

FieldTypePresentMeaning
datestringalwaysISO date (YYYY-MM-DD)
valuenumberalways0-100 index for this series (100 = peak in the returned window)
keywordstringalwaysEcho of the request
volumenumberwhen the pipeline has itAbsolute volume (search, pageviews, downloads, and similar)
sourcestringGoogle / YouTube / TikTok / Reddit-style seriesEcho of source
datatypestringWikipedia / Amazon / npm / app seriesSame role as source on those pipelines
volume_cumulativenumberapp downloadsCumulative downloads when provided

Read date and value in application code. Treat source / datatype / volume as optional extras.

Free keys: 90 days, 24h delay. Paid: up to about five years weekly.

get_growth

Point-to-point percent change. Several windows in one call still count as one request.

{
"mode": "get_growth",
"source": "google search",
"keyword": "nike",
"percent_growth": ["12M", "3M", "YTD"]
}

Window strings:7D, 14D, 30D, 1M, 2M, 3M, 6M, 9M, 12M (1Y), 18M, 24M (2Y), 36M (3Y), 48M, 60M (5Y), MTD, QTD, YTD.

Custom window: {"name": "Launch", "recent": "2024-06-01", "baseline": "2024-01-01"}.

Default if omitted: ["12M"].

Parsed body object:

FieldTypeMeaning
search_termstringKeyword
data_sourcestringSource
resultsarrayOne object per requested window
metadataobjecttotal_data_points, calculations_completed, all_successful

Each results[] item:

FieldTypePresentMeaning
periodstringalwaysWindow label
growthnumberon successPercent change
directionstringon successincrease or decrease
statusstringalwayse.g. success
recent_datestringon successEnd of window
baseline_datestringon successStart of window
recent_valuenumberon successIndex at recent_date
baseline_valuenumberon successIndex at baseline_date
growth_unitstringoftene.g. percent
calculation_methodstringoftenHow the % was computed
volume_availablebooleanwhen volume exists
recent_volumenumberwhen volume exists
baseline_volumenumberwhen volume exists
volume_growthnumberwhen volume exists

get_top_trends

Live ranked feed. No keyword.

{"mode": "get_top_trends", "type": "Google Trends", "limit": 10}

Parsed body object:

FieldTypeMeaning
as_of_tsstringSnapshot time (ISO 8601)
typestringFeed name
limitintegerRequested cap
offsetintegerPagination offset
countintegerRows in data
dataarray[rank, label] pairs

Labels are feed-specific (search term, video title, hostname, app name). They are not IDs.

Omitting type on REST returns every feed and is billed per feed. Send one type per call.

Errors

Use envelope statusCode, not only HTTP status.

CodeWhenRetry?
400Bad mode / source / type, or missing fieldNo. Fix the body
401Missing or invalid keyNo. Fix the key
404No series for that keyword + sourceNo. Wrong spelling or wrong keyword format
429Monthly quota usedNo until the next cycle, or upgrade
500Upstream errorYes, with backoff
HTTP 504 HTMLGateway timeout (seen on news volume)Yes. Not billed
{
"statusCode": 404,
"body": "{\"error\":\"no_data\",\"message\":\"No data available for this keyword and source combination.\",\"keyword\":\"chatgpt\",\"source\":\"app downloads\"}"
}

Quota

Only statusCode 200 is billed.

PlanRequests / monthFreshnessHistory
Free10024h delay90 days
Starter5,000real-time1 year
Pro25,000real-time5 years
Business100,000real-timefull archive

One billed request =

  • get_time_series: 1 source + 1 keyword
  • get_growth: 1 source + 1 keyword (all windows included)
  • get_top_trends: 1 type

SDKs

LanguageInstallRepo
Pythonpip install trendsapiTrendsAPI-py
JavaScript / TypeScriptnpm install trendsapitrendsapi-js

MCP transport (same data): trends-mcp.

Raw HTTP

Use this only if you are not installing a client.

importjson, os, requestsres=requests.post(
"https://api.trendsapi.ai/api",
headers={"Authorization": f"Bearer {os.environ['TRENDSAPI_KEY']}"},
json={"mode": "get_time_series", "source": "google search", "keyword": "heat pump"},
timeout=60,
)
res.raise_for_status()
env=res.json()
ifenv["statusCode"] !=200:
raiseRuntimeError(env)
series=json.loads(env["body"])
constres=awaitfetch("https://api.trendsapi.ai/api",{method: "POST",headers: {Authorization: `Bearer ${process.env.TRENDSAPI_KEY}`,"Content-Type": "application/json",},body: JSON.stringify({mode: "get_time_series",source: "google search",keyword: "heat pump",}),});if(!res.ok)thrownewError(`HTTP ${res.status}`);constenv=awaitres.json();if(env.statusCode!==200)thrownewError(String(env.body));constseries=JSON.parse(env.body);

Per-source guides

Job-specific. Not copies of this file.

JobRepository
Google search interestgoogle-trends-api
Replace pytrendspytrends-alternative
TikTok hashtag volumetiktok-trends-api
YouTube search interestyoutube-trends-api
Reddit attentionreddit-trends-api
Amazon search demandamazon-trends-api
Wikipedia page viewswikipedia-trends-api
npm downloadsnpm-trends-api
Steam concurrent playerssteam-trends-api
App Store / Play chartsapp-store-trends-api
News mention volumenews-trends-api
News tonenews-sentiment-api
Site traffic rankweb-traffic-api

Site: trendsapi.ai/trends.

License

MIT. See LICENSE. Hosted use follows the plan on the key.