Trends API
Twitter (X) Trends API: Trending Topics by Country
Prices checked:
Quick Answer
TwexAPI’s trends API returns the trending topics X shows for a country from one request: GET /twitter/{country}/trending. A call returned 30 trends in our test and is billed per trend at 5 Credits, so it costs 150 Credits, about $0.0015, and checking one country every hour comes to about $1.08 a month. The official X API listed Trends at $0.010 per request on December 1, 2026. You need a TwexAPI key, not an X developer account.
Twitter trends API endpoints
| Endpoint | What it returns | Cost |
|---|---|---|
| GET /twitter/{country}/trending | The trending topics for one of 62 countries, such as united-states or japan: rank, topic and category | 150 Credits (~$0.0015) for 30 trends |
| GET /twitter/global-trending/tweets | Trending posts for a country, optionally narrowed to a topic: full posts with text, author, media and engagement counts | 5 Credits per post; 20 posts (100 Credits) in our test |
| GET /twitter/global-trending/countries | The 68 country options for trending posts, including global | 5 Credits per entry (340 Credits); fetch once and store |
| GET /twitter/global-trending/topics | The 24 topic categories for trending posts, such as cryptocurrency, business & finance and anime | 5 Credits per entry (120 Credits); fetch once and store |
Country slugs are lowercase with hyphens, for example united-kingdom, saudi-arabia and south-africa. The API reference lists all of them.
Every call takes the header "Authorization: Bearer <your key>". Billing is per item returned, at 5 Credits each, and a failed request is not billed.
Example request and response
Each trend has a rank, the topic text, a category line and a last-updated note. In our test every trend came back with tweet_volume 0, so do not rely on that field for volume.
curl https://api.twexapi.io/twitter/united-states/trending \
-H "Authorization: Bearer $TWEXAPI_KEY"
{
"code": 200,
"msg": "success",
"data": [
{"rank": "1", "topic": "Baker Mayfield", "tweet_volume": 0, "last_updated": "1 minutes ago", "domain_context": "Sports · Trending"},
{"rank": "2", "topic": "#WWERaw", "tweet_volume": 0, "last_updated": "1 minutes ago", "domain_context": "Sports · Trending"}
]
}What the trends API costs per month
| Schedule | Calls a month | TwexAPI | Official X API |
|---|---|---|---|
| 1 country, every hour | 720 | 108,000 Credits (~$1.08) | $7.20 |
| 1 country, every 10 minutes | 4,320 | 648,000 Credits (~$6.48) | $43.20 |
| 10 countries, every hour | 7,200 | 1,080,000 Credits (~$10.80) | $72.00 |
| All 62 countries, every hour | 44,640 | 6,696,000 Credits (~$66.96) | $446.40 |
The table assumes a 30-day month and 30 trends per call. The official column is X’s listed price of $0.010 per Trends request on December 1, 2026; what that request returns and which places it covers are described in X’s own documentation.
The 20,000 free Credits on signup cover about 130 trends calls. Free Credits allow one request every 5 seconds, and paid plans allow more.
Source: X API pricing (official)
Python: log trending topics to CSV
This script saves the current trends for three countries to trends.csv and prints any trend that contains a watched word. The API returns only the current trends, so run it from cron every hour to build your own history.
import csv
import os
import time
from datetime import datetime, timezone
import requests
API_KEY = os.environ["TWEXAPI_KEY"]
COUNTRIES = ["united-states", "united-kingdom", "japan"]
WATCH = ["bitcoin", "openai"] # alert when a trend contains one of these
def trends(country):
res = requests.get(
f"https://api.twexapi.io/twitter/{country}/trending",
headers={"Authorization": f"Bearer {API_KEY}"},
timeout=30,
)
res.raise_for_status()
return res.json().get("data") or []
new_file = not os.path.exists("trends.csv")
with open("trends.csv", "a", newline="", encoding="utf-8") as f:
writer = csv.writer(f)
if new_file:
writer.writerow(["checked_at", "country", "rank", "topic", "category"])
now = datetime.now(timezone.utc).isoformat(timespec="seconds")
for country in COUNTRIES:
for t in trends(country):
writer.writerow([now, country, t.get("rank"), t.get("topic"), t.get("domain_context")])
if any(word in (t.get("topic") or "").lower() for word in WATCH):
print(f"{country}: #{t.get('rank')} {t.get('topic')}")
time.sleep(5) # free Credits allow one request every 5 secondsFrom a trend to the posts behind it
To read what people are saying about a trend, pass its topic to the search endpoint, POST /twitter/advanced_search/page, which returns 20 posts a page at 5 Credits each. For the posts that are trending in a country rather than on one topic, call GET /twitter/global-trending/tweets with a country and, if you want, a topic such as cryptocurrency.
Limits to know before you build
- Country level only: 62 countries, and no city-level trends.
- The worldwide slug returns X’s default Explore trends, not a global ranking. In our test most of them were regional, so pass a country slug.
- Current trends only. There is no history endpoint, so store each call if you need a time series.
- tweet_volume was 0 for every trend in our test.
- There is no push or webhook. You check on a schedule.
FAQ
Is there a free Twitter trends API?
X’s pricing page lists no free plan and prices Trends at $0.010 per request (read December 1, 2026). TwexAPI gives 20,000 free Credits on signup, enough for about 130 trends calls, without a credit card.
Which countries does the trends API cover?
62 countries, including the United States, the United Kingdom, Japan, India, Brazil, Germany, France, Turkey, Indonesia and Saudi Arabia. The API reference lists every country slug.
Can I get trends for a city?
No. TwexAPI returns trends by country.
Can I get past trending topics?
No. The API returns the trends at the time of the call. To keep a history, call it on a schedule and store the results, as the Python script on this page does.
How much does it cost to check trends every hour?
About $1.08 a month for one country: 720 calls at 150 Credits each. Checking every 10 minutes costs about $6.48 a month.
Do I need an X developer account?
No. You call TwexAPI with a TwexAPI key, which you get by signing up with an email or Google account.
Is TwexAPI affiliated with X?
No. TwexAPI is an independent third-party provider of public social data and is not affiliated with or endorsed by X Corp.
Related Guides
Sources
Prices change. Confirm current rates on each provider’s pricing page before you buy. TwexAPI is an independent provider and is not affiliated with or endorsed by X Corp.