Twitter monitor API for real-time X accounts

Posts, deletes, pins, and profile and follow changes from the X/Twitter accounts you choose arrive as JSON over one WebSocket, and every plan can also post them to Discord.

  • 50 accounts on Minimum
  • Add or remove accounts live

$199/mo for 50 accounts after a 3-day, 5-account trial

How the Twitter monitor API works

With the TweetStream Twitter monitor API, your backend opens one authenticated WebSocket and events from the X accounts you choose arrive as JSON. You can add or remove accounts while the stream stays open.

  1. Create an API key in the dashboard and add the X handles you want to monitor.
  2. Open a WebSocket from your server with the tweetstream.v1 protocol and your API key.
  3. Route each event by type and operation, such as new posts, deletes, profile changes, and follows.
  4. Change the watchlist through the REST endpoints or a handle-management socket. Your open stream picks up the new list without reconnecting.

What TweetStream handles

Add or remove accounts live
Send handles to the add and remove endpoints, or over a handle-management socket. Your consumer socket keeps running and routes the new list.
Account events beyond posts
Deletes, pins, profile changes, follows, and unfollows arrive when available, with token detection and OCR on post images.
Discord routing
Every plan can send the same alerts to a Discord webhook, so people can read them while your bot consumes the stream.
Client reconnects
Your client owns reconnects. Back off exponentially and reset the delay after 30 seconds of uptime, as the Node.js and Python guides do.

Connect from Node.js or Python

Node.js: print new posts from your watchlist

typescript
import WebSocket from "ws";
 
const ws = new WebSocket("wss://ws-global.tweetstream.io/ws", [
  "tweetstream.v1",
  `tweetstream.auth.token.${process.env.TWEETSTREAM_API_KEY}`,
]);
 
ws.on("message", (raw) => {
  const event = JSON.parse(raw.toString());
  if (event.t === "tweet" && event.op === "content") {
    console.log(event.d?.author?.handle, event.d?.text);
  }
});
Node.js client guide with reconnects

Python: print new posts from your watchlist

python
import asyncio
import json
import os
 
import websockets
 
PROTOCOLS = ["tweetstream.v1", f"tweetstream.auth.token.{os.environ['TWEETSTREAM_API_KEY']}"]
 
async def main():
    async with websockets.connect("wss://ws-global.tweetstream.io/ws", subprotocols=PROTOCOLS) as ws:
        async for raw in ws:
            event = json.loads(raw)
            if event["t"] == "tweet" and event["op"] == "content":
                tweet = event["d"]
                print(tweet.get("author", {}).get("handle"), tweet.get("text"))
 
asyncio.run(main())
Python client guide with reconnects

Why teams use it

  • The 3-day trial covers 5 tracked accounts and 1 WebSocket connection.
  • Monitor a focused account list without running your own account-following worker.
  • Every plan includes Discord routing, so alerts can reach the channel where your team acts.
  • See account and connection limits before putting the feed into production.

Questions

Can I monitor specific X/Twitter accounts in real time?
Yes. TweetStream tracks the accounts you list, so you don't depend on keyword searches across all of X.
How do I add or remove accounts without restarting my bot?
Call the add and remove endpoints from your backend, or send commands over a handle-management WebSocket. Your consumer socket stays open and picks up the new list. The account management docs show the request formats.
How do alerts get delivered?
As JSON over the WebSocket API. Every plan can also send the same alerts to a Discord webhook, which you set up in the dashboard.
What should my client do when the connection drops?
Reconnect with exponential backoff and reset the delay after 30 seconds of uptime. Keep event handling idempotent so a repeated message can't trigger a second trade. On Pro, Scale, and Ultra Speed, replay the events you missed from the History API.
How many X accounts can I monitor?
Minimum covers 50 accounts and Pro covers 250. Scale sets custom limits.

Connect this workflow to the live feed

Add up to 5 accounts you trade on, connect one WebSocket, and compare the alerts with what you see today.

$199/mo for 50 accounts after a 3-day, 5-account trial