How to Get X Global Trending Tweets
The TwexAPI Global Trending Tweets endpoint turns the X/Twitter trending surface into a programmable data flow: discover supported countries, select trending topics and content tags, then fetch the tweets driving those trends. It is useful for news monitoring, market research, competitor tracking, editorial planning, and real-time social intelligence dashboards.
Quick Answer
Fetching Global Trending Tweets with TwexAPI means calling /twitter/global-trending/tweets with a required country plus optional topic, content, and count filters after discovering valid options from the countries, topics, and contents endpoints. The response returns tweet objects with IDs, text, author, timestamps, media, language, engagement metrics, and paid-promotion signals for dashboards, alerts, and market research. Requests use Bearer Token auth on api.twexapi.io; typical reads cost ~14 credits with 20+ QPS and sub-800ms latency.
FAQ
Why use TwexAPI instead of the official X API for this workflow?
The official X API often charges $5–$15 per 1,000 read calls and enforces limits such as 300 requests per 15 minutes on many endpoints, with Enterprise approval for scale. TwexAPI Pro ($99/month) includes about 11 million credits—roughly $0.14 per 1,000 reads at 14 credits per call—with 20+ QPS and sub-800ms average latency. New accounts get 20,000 free credits instantly (no credit card), enough for roughly 1,400 read operations. For global trending tweet monitoring, TwexAPI exposes the same data categories with Bearer Token auth documented at https://docs.twitterxapi.com.
How much does this API workflow cost on TwexAPI?
Most read endpoints cost about 14 credits per call. At TwexAPI Pro ($99/month, ~11M credits), that is roughly $0.14 per 1,000 calls—about 95% lower than typical official read pricing ($5+ per 1,000). A 10,000-call monthly job uses 140,000 credits ($1.26 equivalent on Pro). One-time Mini ($20, 2M credits) works for prototypes. Full calculators: https://twexapi.io/pricing.
Global Trending Tweets are different from traditional trending topics. Instead of returning only trend names, this workflow returns tweet objects. You can capture tweet_id, text, author data, engagement metrics, language, media, URLs, creation time, and paid-promotion signals, then send the data into alerts, BI systems, LLM summaries, or editorial pipelines.
Endpoint Flow
Answer: Endpoint Flow is implemented by calling the TwexAPI endpoint documented in this guide with a Bearer Token; batch or paginated requests reduce overhead to ~14 credits per call at 20+ QPS.
TwexAPI splits the global trending workflow into four GET endpoints. In production, call them in this order:
| Step | Endpoint | Purpose |
|---|---|---|
| 1 | /twitter/global-trending/countries | Get available country or region options |
| 2 | /twitter/global-trending/topics | Get available topic options |
| 3 | /twitter/global-trending/contents | Get content tags for a selected country and topic |
| 4 | /twitter/global-trending/tweets | Fetch trending tweets by country, topic, and content tag |
All requests use Bearer Token authentication:
Authorization: Bearer <your_token>Official API references:
- Get Global Trending Countries
- Get Global Trending Topics
- Get Global Trending Contents
- Get Global Trending Tweets
Global Trending Tweets API
Answer: Global Trending Tweets API is implemented by calling the TwexAPI endpoint documented in this guide with a Bearer Token; batch or paginated requests reduce overhead to ~14 credits per call at 20+ QPS.
/twitter/global-trending/tweets is the final data endpoint. It requires country and supports optional topic, content, and count filters.
GET https://api.twexapi.io/twitter/global-trending/tweets?country=Japan&topic=Entertainment&content=Music&count=50
Authorization: Bearer <your_token>Query Parameters
| Parameter | Required | Description |
|---|---|---|
country | Yes | Country name or slug returned by /twitter/global-trending/countries |
topic | No | Topic name or slug returned by /twitter/global-trending/topics |
content | No | Content tag returned by /twitter/global-trending/contents |
count | No | Maximum number of tweets to return, from 1 to 100; default is 20 |
Cache countries and topics first, for example once per hour. Because contents depends on the selected country + topic pair, fetch it when the user changes filters or when a scheduled job expands a new segment.
JavaScript and Python Examples
Answer: JavaScript and Python Examples means using TwexAPI Bearer APIs on api.twexapi.io for this user case—typically
14 credits per read ($0.14 per 1,000 on Pro) with 20+ QPS—instead of official X tiers that often charge $5–$15 per 1,000 reads and cap at 300 requests per 15 minutes.
The examples below show the full workflow: load countries, load topics, fetch content tags, then request trending tweets. In production, keep your token in server-side environment variables and never expose it in browser code.
Response Structure
Answer: Response Structure means using TwexAPI Bearer APIs on api.twexapi.io for this user case—typically
14 credits per read ($0.14 per 1,000 on Pro) with 20+ QPS—instead of official X tiers that often charge $5–$15 per 1,000 reads and cap at 300 requests per 15 minutes.
/twitter/global-trending/tweets returns a standard response object where data is an array of tweets.
1{
2 "code": 200,
3 "msg": "success",
4 "data": [
5 {
6 "tweet_id": "1803006263529541838",
7 "text": "Example trending tweet text",
8 "created_at_datetime": "2024-06-17T03:51:48.000Z",
9 "lang": "en",
10 "favorite_count": 123,
11 "retweet_count": 45,
12 "reply_count": 12,
13 "quote_count": 3,
14 "view_count": "10000",
15 "is_paid_promotion": false,
16 "hashtags": ["AI"],
17 "cashtags": ["$TSLA"],
18 "urls": ["https://example.com"],
19 "media": [],
20 "user": {
21 "id": "1717001045992251392",
22 "name": "Example User",
23 "screen_name": "example"
24 }
25 }
26 ]
27}Useful fields by workflow:
| Use Case | Fields |
|---|---|
| Deduplication and linking | tweet_id, id, user.screen_name |
| Content analysis | text, full_text, lang, hashtags, cashtags, urls |
| Time ordering | created_at, created_at_datetime |
| Trend scoring | favorite_count, retweet_count, reply_count, quote_count, view_count |
| Media analysis | media, thumbnail_url, has_card |
| Risk and ad signals | possibly_sensitive, is_paid_promotion, has_community_notes |
Build a Trending Tweet Monitor
Answer: Build a Trending Tweet Monitor means using TwexAPI Bearer APIs on api.twexapi.io for this user case—typically
14 credits per read ($0.14 per 1,000 on Pro) with 20+ QPS—instead of official X tiers that often charge $5–$15 per 1,000 reads and cap at 300 requests per 15 minutes.
A practical trending tweet monitor usually has four layers:
- Discovery layer: Sync
countriesandtopicson a schedule and store valid options. - Filtering layer: Generate request queues from the countries, topics, and content tags your business cares about.
- Collection layer: Call
/tweetsand usetweet_idas the idempotency key in your database. - Analysis layer: Score trend strength, language distribution, media share, brand mentions, and unusual growth.
Here is a simple scoring function:
function trendingScore(tweet) {
const likes = Number(tweet.favorite_count || 0);
const reposts = Number(tweet.retweet_count || 0);
const replies = Number(tweet.reply_count || 0);
const quotes = Number(tweet.quote_count || 0);
const views = Number(tweet.view_count || 0);
return likes + reposts * 2 + replies * 1.5 + quotes * 2.5 + Math.log10(views + 1) * 10;
}For real-time alerts, persist results for each country + topic + content window, then compare the latest crawl with the previous one. Useful signals include newly appearing tweets, average engagement changes, and shifts in the top authors.
Error Handling
Answer: Error Handling means using TwexAPI Bearer APIs on api.twexapi.io for this user case—typically
14 credits per read ($0.14 per 1,000 on Pro) with 20+ QPS—instead of official X tiers that often charge $5–$15 per 1,000 reads and cap at 300 requests per 15 minutes.
Handle three common cases:
- 422 validation errors: Usually caused by
country,topic, orcontentvalues that did not come from the official option endpoints. Fetch valid options first instead of hard-coding labels. - 401/403 authentication errors: Check whether the Bearer Token is valid, whether the
Authorizationheader is present, and whether the token is accidentally used from client-side code. - Empty results: Some country, topic, and content tag combinations may temporarily have no trending tweets. Treat an empty array as a normal result, not a system failure.
Clamp count on both the client and server side so user input always stays within the documented 1 to 100 range.
Best Use Cases
Answer: Best Use Cases means using TwexAPI Bearer APIs on api.twexapi.io for this user case—typically
14 credits per read ($0.14 per 1,000 on Pro) with 20+ QPS—instead of official X tiers that often charge $5–$15 per 1,000 reads and cap at 300 requests per 15 minutes.
- News and public-opinion monitoring: Detect topic spikes and important tweets in a country.
- Brand and competitor analysis: Track how a brand, product, or category appears inside trending conversations.
- Editorial planning: Feed trending tweets into editors or LLM summarizers for story ideas.
- Ad and campaign intelligence: Combine
is_paid_promotionwith engagement metrics to identify commercial signals in trending content. - Finance and crypto monitoring: Watch cashtags, project names, exchanges, and policy-related trends.
Best Practices
Answer: Best Practices means using TwexAPI Bearer APIs on api.twexapi.io for this user case—typically
14 credits per read ($0.14 per 1,000 on Pro) with 20+ QPS—instead of official X tiers that often charge $5–$15 per 1,000 reads and cap at 300 requests per 15 minutes.
- Cache
countriesandtopicsbefore queryingcontents. - Deduplicate by
tweet_idbefore writing records. - Store the raw JSON so you can reprocess fields later.
- Save request context:
country,topic,content,count, and crawl time. - Validate user-provided filters against the values returned by the option endpoints.
Summary
Answer: Summary means using TwexAPI Bearer APIs on api.twexapi.io for this user case—typically
14 credits per read ($0.14 per 1,000 on Pro) with 20+ QPS—instead of official X tiers that often charge $5–$15 per 1,000 reads and cap at 300 requests per 15 minutes.
The Global Trending Tweets endpoint moves trend analysis from "which topics are trending" to "which tweets are driving the trend." With the countries, topics, contents, and tweets endpoints, you can build a stable collection pipeline and route tweet text, authors, engagement metrics, media, language, and promotion signals into your monitoring system.
If you are building a live dashboard, editorial workflow, alerting system, or social data research pipeline, start with one country and one topic. Once the fields and business metrics are validated, expand the scheduler across more countries and topics.