Twitter streaming API: how it works and what to use now
The Twitter streaming API explained: how X's filtered stream works, what it needs, and how to get a live tweet feed by polling search on a schedule.
Piyushh · November 13, 2026 · 4 min read

The Twitter streaming API keeps one connection open and pushes matching posts to you as they are published. On X's current API, that's the filtered stream. You need it if you want a Twitter live streaming API feed with only seconds of delay. If a few minutes of delay is fine, you can skip the stream and poll a search endpoint on a schedule. ChatterAPI takes the polling route because it has no push stream. This post explains what the stream is, then shows the polling alternative with working code.
What is the Twitter streaming API
A stream is a long-lived HTTP connection. You tell the server once what you care about, and it sends you matches as they happen, without you asking again.
On X's v2 API, the filtered stream docs (checked 2026-11-13) describe it as a way to "receive near real-time Posts that match your filter rules". There are three endpoints:
POST /2/tweets/search/stream/rulesadds or deletes rulesGET /2/tweets/search/stream/ruleslists your rulesGET /2/tweets/search/streamconnects and streams matches
A rule uses the same operators as search. X's docs give (AI OR "machine learning") lang:en -is:retweet as an example.
The same page lists what you need: an approved developer account, a project and app in the Developer Console, and your app's Bearer Token. On pay-per-use you get 1,000 rules per project, 1,024 characters per rule and 1 connection, with higher limits on Enterprise. X quotes P99 latency of about 4 to 5 seconds.
So the twitter streaming api tutorial in short is: add rules, open the connection, read lines of JSON.
Why people search for twitter streaming APIs
The same phrase covers several different things, and old tutorials make it more confusing. People mean one of these:
- The v2 filtered stream described above.
- The old streaming endpoints that Python, Java and JavaScript tutorials used for years (
statuses/filterand friends). I did not verify what X does with those today, so if a tutorial uses them, check X's docs before you build on it. - Any real-time feed, however it is delivered: an API stream for a Twitter hashtag, python twitter streaming of a keyword, a real time twitter feed monitor, or a keyword alert.
The pattern is the same whatever the language. A twitter streaming api in Python, Java or JavaScript opens a connection, reads events and handles reconnects. If you use X's stream, pick a client library for your language from X's docs.
What ChatterAPI offers instead
ChatterAPI is independent and not affiliated with X Corp. It serves X reads over REST and MCP on a request-and-response basis.
- There is no push stream.
- There are no webhooks for new tweets.
- Search runs on demand at 2 credits per page of about 20 tweets on a live key.
- Responses can be cached for about ten minutes.
Put plainly, you get a near-live feed built from polling, not a real-time one.
A live Twitter feed by polling
Search with sort=latest, keep track of the ids you've already seen, and print anything new. Run it every ten minutes:
import os, time, requests
URL = "https://api.chatterapi.com/v1/x/tweets/search"
HEADERS = {"Authorization": f"Bearer {os.environ['CHATTERAPI_KEY']}"}
QUERY = '"crm recommendation" -filter:replies'
seen = set()
while True:
r = requests.get(URL, headers=HEADERS, params={"q": QUERY, "sort": "latest"}, timeout=60)
r.raise_for_status()
for t in reversed(r.json()["data"]):
if t["id"] not in seen:
seen.add(t["id"])
print(t["createdAt"], "@" + t["author"]["handle"], t["text"][:100])
time.sleep(600)
Here is the same call in JavaScript, for a Node job or a serverless function on a cron:
const res = await fetch(
"https://api.chatterapi.com/v1/x/tweets/search?q=" + encodeURIComponent('"crm recommendation"') + "&sort=latest",
{ headers: { Authorization: `Bearer ${process.env.CHATTERAPI_KEY}` } }
);
const { data } = await res.json();
If the job restarts, keep the ids in a file or a small database rather than in memory. The first run prints the newest page. After that, it prints only new tweets.
The X search endpoint docs list every parameter, including since, until and lang. For alerts, see our page on live monitoring for Twitter and the post on Twitter keyword alerts, which cover it in more depth.
What polling costs
Each poll fetches one page and costs 2 credits. Polling every ten minutes means 144 polls a day, or 288 credits. Over a 30-day month that comes to about 8,640 credits, which fits inside the 35,000 on the Starter plan at $19. Failed calls cost nothing. Polling more often than every ten minutes mostly returns cached copies of the same page, and those cost the same as fresh ones, so a slower, steady interval works better.
Add since with today's date to keep pages small, and use a -filter:replies style operator to cut noise.
When you do need a real stream
Use X's filtered stream if you have to react within seconds, as with trading signals, crisis alerts or a public dashboard that has to feel live. You'll go through the access steps and the billing described above. Read X's pricing page before you commit; our summary of what it charges is in is the X API free.
Polling works when a delay of minutes is fine: brand mentions, lead alerts, daily research, agents that check in on a schedule. That covers most of what people build.
Try it
The free X tweet search tool shows the newest tweets for a keyword right now. You don't need to sign up, and it calls the same endpoint as the script above. To run it on a schedule, sign up with Google. The 7-day free trial includes 1,000 credits, enough for 500 polls. Plans are on the pricing page.