Skip to content

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

A bucket lowered on a rope at intervals, picturing polling instead of a live stream.

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/rules adds or deletes rules
  • GET /2/tweets/search/stream/rules lists your rules
  • GET /2/tweets/search/stream connects 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/filter and 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.

FAQ

What is the Twitter streaming API?
It is an endpoint that keeps one HTTP connection open and sends you matching posts as they are published. On X's current API this is the filtered stream: you add rules, then connect to the stream endpoint.
Is the Twitter streaming API free?
Not on X's side. The filtered stream needs an approved developer account, a project and an app, and X bills usage per resource. Check X's pricing page for today's rates. ChatterAPI has no stream, but search by polling needs no X account.
How do I do Twitter streaming in Python?
With X's own API, you connect to the filtered stream with a client library or a streaming HTTP request. Without it, call a search endpoint in a loop, remember the ids you have seen, and sleep between calls. The script in this post does that.
Does ChatterAPI have a live Twitter stream?
No. ChatterAPI has no push stream and no webhooks for tweets. You poll the search endpoint on a schedule. Results can be cached for about ten minutes, so polling more often than that gains nothing.
Can I monitor Twitter in real time with polling?
Not in real time. You see new tweets as often as you poll, and that is minutes, not seconds. For brand mentions, lead alerts and research that is usually enough.

More on X (Twitter) API

Try it free for 7 days.

1,000 credits to make your first calls. One key for Reddit and X, over REST or MCP.