X (Twitter) trending posts API
The posts X’s Explore shows as trending worldwide today, about 20, in X API v2 shapes.
GET /v1/x/trends/tweets1 credit per callRefunded on failureimport os, requests
res = requests.get(
"https://api.groundsocial.dev/v1/x/trends/tweets",
headers={"Authorization": f"Bearer {os.environ['GROUNDSOCIAL_API_KEY']}"},
)
res.raise_for_status()
data = res.json()Response
200 · 1 credit{ "data": [ { "id": "2125235212363682098", "text": "🚨🇸🇳 BREAKING: SENEGAL ARE AFCON 2025 WINNERS, CAS VERDICT ANNOUNCE.", "created_at": "2026-11-24T14:28:54.000Z", "author_id": "330262748", "conversation_id": "2125235212363682098", "lang": "en", "edit_history_tweet_ids": [ "2125235212363682098" ], "public_metrics": { "like_count": 304305, "retweet_count": 42537, "reply_count": 6619, "quote_count": 7923, "bookmark_count": 7160, "impression_count": 9956432 } }, "… 7 more" ], "includes": { "users": [ { "id": "330262748", "name": "Fabrizio Romano", "username": "FabrizioRomano", "description": "Here we go! fabrizio.romano93@gmail.com 📩", "location": "Milan, Lombardy", "profile_image_url": "https://pbs.twimg.com/profile_images/1741753635158024192/j0m8Ucvv_normal.jpg", "protected": false, "verified": true, "verified_type": "blue", "public_metrics": { "…": "3 fields" } }, "… 9 more" ], "tweets": [ { "id": "2124205331290943576", "text": "shits just so beautiful it could make a grown woman cry https://t.co/9cLivlfHLA", "created_at": "2026-11-21T18:16:31.000Z", "author_id": "1484930734666174470", "conversation_id": "2124205331290943576", "lang": "en", "possibly_sensitive": false, "edit_history_tweet_ids": [ "…" ], "public_metrics": { "…": "5 fields" }, "entities": { "…": "1 fields" }, "…": "1 more fields" }, "… 1 more" ], "media": [ { "media_key": "13_2125082276371496960", "type": "video", "preview_image_url": "https://pbs.twimg.com/amplify_video_thumb/2125082276371496960/img/0GW6mn2g8OuMxK…", "width": 1280, "height": 720, "duration_ms": 682733, "variants": [ "…" ] }, "… 5 more" ] }, "meta": { "result_count": 8, "newest_id": "2125235212363682098", "oldest_id": "2125040590371082405" }}Response fields
200 with a XTimelineResponse, in the shape of X’s API v2 Tweet and User objects.
| Field | Type | Description |
|---|---|---|
data | XTweet[] | |
includes | XIncludes | Objects the response refers to by id, each once: authors, quoted and reposted posts, media, polls. |
meta | XTimelineMeta |
Status codes
| Status | Meaning |
|---|---|
200 | Trending posts. |
400 | Invalid input. Nothing was charged. |
401 | Missing or invalid API key. |
402 | Not enough credits, a spend cap was reached, or payment is required. |
403 | The target is private, or the account is suspended. |
404 | The post or account does not exist, was deleted, or is suspended. |
429 | Too many requests. Wait for Retry-After seconds. |
503 | X is temporarily unavailable. Retryable; nothing was charged. |
Every error has code, message, hint and retryable. All error codes
Questions
Can I pick a country?
Not yet: this is the worldwide list X shows a logged-out visitor.
X is a trademark of X Corp. We are not affiliated with or endorsed by X Corp.