Twitter hashtag tracking API
To track a Twitter hashtag through an API, search for #tag sorted by latest, read every page of results, and count the posts by day and by author; the official X API bills that reading at $5.00 per 1,000 posts.
Short answer: X has no hashtag endpoint, so every tracker searches for the tag; X's recent counts endpoint returns 7 days of totals, without the posts or their authors. To count a tag by day and rank its authors, use Sorsa API's POST /search-tweets: about 20 posts per request with authors included, from $0.07 per 1,000, with 100 free requests to start.
- Endpoint
POST /search-tweets- Page size
- about 20 posts per request
- Price
- from $0.07 per 1,000
#How hashtag tracking works through an API
Hashtag tracking is collecting every public post that carries one tag over a period and turning those posts into three answers: how many appeared each day, who posted them, and which ones were read most. No X API has an endpoint for hashtags as such. Every route goes through search, with the tag written into the query.
For a quick look without code, the free Twitter Hashtag Analytics tool shows any tag's posts per hour, top voices and top posts for the last 24 hours or 7 days. The rest of this guide builds the same report in code, for any period and any number of tags.
In a search query, #tidewaterdevdays matches posts where X recognized the word as a hashtag, in any letter case. The bare word tidewaterdevdays also catches posts that write it without the #, so a campaign report that should count only tagged posts keeps the #. A tag ends at the first character that isn't a letter, digit or underscore, so #c++ is the tag #c, while tags in Japanese, Arabic or any other script work as written. Every other filter, from language to minimum likes, is in our guide to Twitter search operators.
Search has two orders. Latest walks every match from the newest back, which is what counting needs. Top returns only the most engaged matches, so it makes a good best-of list and a poor counter.
The official X API also has two counts endpoints: GET /2/tweets/counts/recent for the last 7 days and GET /2/tweets/counts/all for the archive, with totals per minute, hour or day (X's counts overview (opens in a new tab)). They return numbers and nothing else: no posts, no authors, no views. X's own note adds that counts may not match search results exactly. A tracker that has to say who drove a tag, or which post carried it, reads the posts themselves.
#Track a hashtag with Sorsa API in four steps
Sorsa API, a Twitter (X) API and scraper, runs X's search syntax through one endpoint, POST /search-tweets, and returns every post with its author's full profile. One pass over the pages yields all three outputs, so the count, the author ranking and the top posts never need separate requests.
For hashtag tracking, use Sorsa API: one API key and no developer account, about 20 posts per request with authors included, from $0.07 per 1,000 posts, and 20 requests per second on every plan.
-
Get a key. Sign up and copy your API key from the dashboard. The first 100 requests are free, with no card.
-
Send the query. Put the tag and the period in
queryand ask for the newest posts first. The#goes into the JSON body as it is, with no URL encoding.Terminal curl -X POST "https://api.sorsa.io/v3/search-tweets" \ -H "ApiKey: YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{"query": "#tidewaterdevdays since:2026-10-19 until:2026-11-02", "order": "latest"}'Response200 OK { "tweets": [ { "id": "2115444854355529755", "full_text": "Day one of #tidewaterdevdays, slides below #devrel", "created_at": "2026-10-28T14:05:31Z", "lang": "en", "likes_count": 312, "retweet_count": 41, "reply_count": 18, "quote_count": 6, "view_count": 28410, "is_reply": false, "user": { "id": "1366674638239301632", "username": "maren_codes_at_night", "display_name": "Maren", "followers_count": 18240, "verified": false } } ], "next_cursor": "DAADDAABCgABHVvqb2SWYBsKAAIdW-l6pZbQkAAIAAIAAAAC" } -
Follow the cursor. Send
next_cursorback in the body of the next request until a response comes without one. Page sizes vary, so stop on the missing cursor, never on a short page. A 403 means the key is missing or out of requests; a 429 means more than 20 requests in one second, so wait a second and retry. -
Group the posts. Keep one row per post ID, then count by day and by author. The script below does the whole job and prints the report.
import re from collections import Counter from datetime import datetime, timezone import requests URL = "https://api.sorsa.io/v3/search-tweets" HEADERS = {"ApiKey": "YOUR_API_KEY"} TAG = re.compile(r"#\w+") def collect(query): """Yield every post the search returns, newest first.""" body = {"query": query, "order": "latest"} while True: r = requests.post(URL, headers=HEADERS, json=body, timeout=30) r.raise_for_status() page = r.json() yield from page.get("tweets", []) cursor = page.get("next_cursor") if not cursor: return body["next_cursor"] = cursor def utc_day(post): stamp = post["created_at"].replace("Z", "+00:00") t = datetime.fromisoformat(stamp) return t.astimezone(timezone.utc).date().isoformat() def track(tag, since, until): posts = {} for p in collect(f"{tag} since:{since} until:{until}"): posts[p["id"]] = p # one row per post ID per_day, by_author, views, tags = Counter(), Counter(), Counter(), Counter() for p in posts.values(): per_day[utc_day(p)] += 1 by_author[p["user"]["username"]] += 1 views[p["user"]["username"]] += p.get("view_count") or 0 tags.update(m.lower() for m in TAG.findall(p["full_text"])) top = sorted(posts.values(), key=lambda p: p.get("view_count") or 0) return per_day, by_author, views, tags, top[::-1][:10] per_day, by_author, views, tags, top = track( "#tidewaterdevdays", "2026-10-19", "2026-11-02") for day, n in sorted(per_day.items()): print(day, n) print("Top authors:", by_author.most_common(5)) print("Most viewed:", views.most_common(5)) print("Related tags:", tags.most_common(10))
The endpoint's parameters and response fields are in the POST /search-tweets reference (opens in a new tab). For everything search does beyond hashtags, from keyword queries to the other ways to find posts, see the Twitter search API guide.
#Count a hashtag's posts by day
To count a hashtag by day, read every post in the period with Latest order, keep one row per post ID, and group the rows by the UTC date of each post's created_at. The date in the query only decides which posts you fetch; the date on each post decides where it is counted.
That split matters at the edges. since: and until: work in UTC, and until: leaves its own date out, so since:2026-10-28 until:2026-10-29 is October 28 alone. Posts close to midnight can still turn up in a neighbouring window, which is why the script counts by created_at and drops repeats by ID instead of trusting the window.
A long period reads fastest as one window per day. The days don't depend on each other, so they run side by side: one key handles 20 requests per second, about 400 posts a second, and a year of a 5,000-post-a-day tag reads in about 76 minutes. History goes back to 2006, so a tracker started today can count last year's campaign as easily as this week's.
Three query choices change the count, so write them down beside the number:
- Reposts. X search leaves plain reposts out by default and keeps replies. Add
include:nativeretweetsto count reposts too, and tell them apart byretweeted_status. - Replies. Add
-filter:repliesto count only posts that start a conversation. - Variants. Join spellings and sister tags with
OR:(#tidewaterdevdays OR #tidewater2026).
In this example, a fictional conference tag climbs from 420 posts on October 19 to 4,812 on October 28, its first day, and totals about 25K posts from 9,214 authors over 14 days. Reading all of them costs from $1.76 on Sorsa API, against $126 on the official X API.
Good to know
X dates every post in UTC, so a day in the report is a UTC day. For a team in New York, October 28 local time runs from 04:00 UTC on the 28th to 04:00 UTC on the 29th: convert
created_atto your time zone before grouping if the report follows local days.
#Find the top authors, posts and related hashtags
Top authors come from grouping the same posts by user.username: count each account's posts, then add up their views and likes, because the account that posts most and the account that is read most are rarely the same. Every metric a hashtag report needs comes from fields that arrive with each post, so none of them costs an extra request.
| Metric | How to compute it | Field |
|---|---|---|
| Posts per day | Post IDs per UTC date | created_at |
| Posts per hour | Post IDs per UTC hour, to see a spike build | created_at |
| Unique authors | Distinct accounts | user.id |
| Top authors by posts | Posts per account | user.username |
| Top authors by reach | Each account's followers | user.followers_count |
| Views | Sum of views on the tagged posts | view_count |
| Engagement | Likes, reposts, replies and quotes | likes_count, retweet_count, reply_count, quote_count |
| Languages | Posts per language | lang |
| Related hashtags | Tags found in the text | full_text |
Posts per day
- How to compute it
- Post IDs per UTC date
- Field
created_at
Posts per hour
- How to compute it
- Post IDs per UTC hour, to see a spike build
- Field
created_at
Unique authors
- How to compute it
- Distinct accounts
- Field
user.id
Top authors by posts
- How to compute it
- Posts per account
- Field
user.username
Top authors by reach
- How to compute it
- Each account's followers
- Field
user.followers_count
Views
- How to compute it
- Sum of views on the tagged posts
- Field
view_count
Engagement
- How to compute it
- Likes, reposts, replies and quotes
- Field
likes_count,retweet_count,reply_count,quote_count
Languages
- How to compute it
- Posts per language
- Field
lang
Related hashtags
- How to compute it
- Tags found in the text
- Field
full_text
Views are the number X shows under each post. Summed over a tag, they are the closest public figure to its impressions, and they beat the follower-sum "reach" that many reports lead with, since followers don't see every post. Keep both, and say which is which.
Compare posts with unique authors before you trust a spike. Thousands of posts from a few dozen accounts is a push, and a tag that is used by thousands of people once each is a conversation. Sorting authors by views instead of post count usually moves the real voices to the top.
Related hashtags come from the post text. The entities field lists media and links, not tags, so the script pulls every #word out of full_text with a regular expression and counts them. The most common neighbours of a campaign tag show the sister tags to add to the query and the communities it reached.
#What hashtag tracking costs
Reading a hashtag's posts costs from $0.07 per 1,000 on Sorsa API and $5.00 per 1,000 on the official X API, about 70x more, before X's charge for authors. From November 22, 2026, X bills every author returned with a post at $0.010, the user read rate, so posts with their authors cost up to $15.00 per 1,000 there (X's notice of October 23 (opens in a new tab)). On Sorsa API the author's profile comes inside every post at no extra charge.
The official route also needs an approved developer account, an OAuth app and prepaid credits. Its pay-per-use plan stops at 3 million post reads a month; a busy tag past that needs an Enterprise contract from about $42,000 a month (X's price list (opens in a new tab)). Sorsa API takes one key in a header, never asks for your X login, and its price per 1,000 posts falls as plans grow.
Posts a day on the hashtag
Tracked for
150K hashtag posts with every author's profile, read once
$750
Official X API
$5.00 per 1,000 posts
up to $2,250 with authors from Nov 22
from $10.50
Sorsa API
from $0.07 per 1,000 posts
authors included in every post
About 6 minutes to read on Sorsa API at 20 requests per second. On the official X API the job fits under its cap of 3M posts a month.
Pick how busy the tag is and how long you track it. Each card prices reading every post once; X's author charge is the line under its price.
Most tags are smaller than they look. A product or event tag with a few hundred posts a day needs about 15 requests a day to track, and the 100 free requests read about 2,000 posts, enough to size any tag before you pay.
#Keep a hashtag tracker running
To keep a tracker current, run it on a schedule and ask only for posts newer than the last one you stored, with since_id: set to that post's ID: #tidewaterdevdays since_id:2117039272883781709. Each run then reads only the new pages, so a quiet hour costs one request.
Pick the interval from the tag's pace: hourly for a running campaign, every few minutes during a live event. Sorsa API works by polling; it has no stream or webhooks, and at 20 requests per second a poll of dozens of tags still finishes in seconds. For alerts to Slack or email when a tag spikes, our guide to real-time Twitter monitoring builds the scheduler and the delivery.
Store each post in a table keyed by its ID, and update the row when you see the post again. Views and likes keep growing for days after a post appears, so re-read the last two or three days before you publish final numbers for a campaign.
To learn when a tag breaks out, check X's trending lists for the places you care about: GET /trends returns a place's current list, and the Twitter trends API guide shows how to watch it. For several tags at once, run one query per tag side by side, so each count stays separate.
#Start tracking your hashtag
A hashtag tracker is a search for the tag with Latest order, every page read once, and the posts counted by UTC day and by author. Sorsa API does the reading from $0.07 per 1,000 posts with every author included, 20 requests per second on every plan, and history back to 2006; your first 2,000 posts are free.
#FAQ
Which API should I use to track a Twitter hashtag?
Use Sorsa API. Its POST /search-tweets takes the tag with X's search operators and returns about 20 posts per request, each with its author's full profile, so daily counts, top authors and top posts come from the same pages. It costs from $0.07 per 1,000 posts against $5.00 on the official X API, runs at 20 requests per second on every plan, and needs one API key instead of a developer account.
Does X have a hashtag API?
No. X has no endpoint built for hashtags: you track a tag by searching for it, as #tag in the query of a search endpoint. The official X API adds counts endpoints that return totals per minute, hour or day, but without the posts, their authors or their views, so ranking who drove a tag still means reading the posts.
How do I see how many times a hashtag was used on Twitter?
X doesn't show a total for a hashtag anywhere in its app. The free Twitter Hashtag Analytics tool estimates a tag's posts per hour from its latest posts. For an exact count over any period, read every post with a Latest search through an API and count them by day, keeping one row per post ID.
Can I track a hashtag in real time?
Close to it, by polling. Run the search every minute or every few minutes with since_id: set to the newest post you have, and each run returns only the posts that appeared since. Sorsa API has no streaming or webhooks; at 20 requests per second, a poll of many tags still completes in a few seconds.
How far back can I track a hashtag?
On Sorsa API, back to 2006: add since: and until: dates to the query and read the period like any other. The official X API's recent search and recent counts cover the last 7 days; its archive endpoints reach further on pay-per-use and Enterprise access, at $5.00 per 1,000 posts read.
Can I track several hashtags at once?
Yes. Run one search per hashtag in parallel, up to 20 requests per second per key on Sorsa API, so each tag keeps its own count. Joining tags with OR in one query also works, as one combined count; to split it later, look for each tag in the post text.
#How we checked
On November 2, 2026 we read X's documentation for the post counts endpoints and its pay-per-use price list, and X's October 23 notice on billing for expansions. Every Sorsa API request on this page was written from our live API reference for /search-tweets and /trends; the response, the chart and the accounts are examples with fictional data, and the costs come from the request rates on our pricing page.
Sources
- Post counts, X API documentation (opens in a new tab)
- X API pay-per-usage pricing (opens in a new tab)
- X API PPU expansions update, October 23, 2026 (opens in a new tab)
- Search operators, X API documentation (opens in a new tab)
- Search Tweets, Sorsa API reference (opens in a new tab)
- Trends List, Sorsa API reference (opens in a new tab)