Twitter/X Follow & Unfollow Detection API: The Complete Developer Guide (2026)

Twitter/X Follow & Unfollow Detection API: The Complete Developer Guide (2026)

When a high-profile crypto trader follows a new account, it's a signal. When multiple KOLs follow the same account within hours, it's a strong signal. But Twitter/X doesn't offer a native API for detecting follow and unfollow events in real time — until now.

Xanguard's Follow Detection API monitors any Twitter/X account's following list and delivers instant WebSocket alerts when changes happen. It's the only API built specifically for this use case, and it's already being used by crypto trading bots, DeFi protocols, and social intelligence platforms.

Why Follow Detection Matters for Crypto Traders

In crypto markets, social signals precede price movements. When a whale account or KOL follows a new project account, it often indicates upcoming involvement — a partnership, advisory role, or investment. Detecting these follow events before anyone else gives you a measurable edge.

Real-World Signal

When multiple tracked accounts follow the same new account within a short window, Xanguard's Convergence Tracker fires an additional alert — combining follow detection with community intelligence for the highest-confidence signals.

Use Cases

How It Works

Xanguard monitors the following lists of your tracked accounts at configurable intervals. When a change is detected — a new follow or an unfollow — an event is emitted via WebSocket in real time. Detection speed is typically under 60 seconds.

Event Format

{
  "op": 0,
  "d": {
    "event": "twitter.following.new",
    "event_id": "evt_f_elonmusk_1712000000",
    "task_info": { "handle": "elonmusk" },
    "data": {
      "id": "44196397",
      "handle": "vitalikbuterin",
      "name": "Vitalik Buterin"
    }
  }
}

Quick Start: Python

import asyncio, websockets, json

async def detect_follows(): async with websockets.connect('wss://api.xanguard.tech/v1/dt/realtime/ws') as ws: # Receive HELLO hello = json.loads(await ws.recv())

# Login with API key await ws.send(json.dumps({"op": 2, "d": "dt_YOUR_API_KEY"})) ready = json.loads(await ws.recv()) print(f"Monitoring {ready['d']['handles']} handles for follow changes")

# Listen for events while True: msg = json.loads(await ws.recv()) if msg["op"] == 0 and msg["d"]["event"] == "twitter.following.new": data = msg["d"]["data"] handle = msg["d"]["task_info"]["handle"] print(f"@{handle} just followed @{data['handle']}")

asyncio.run(detect_follows())

Quick Start: JavaScript

const ws = new WebSocket('wss://api.xanguard.tech/v1/dt/realtime/ws');

ws.onmessage = (event) => { const msg = JSON.parse(event.data);

if (msg.op === 10) { // HELLO ws.send(JSON.stringify({ op: 2, d: 'dt_YOUR_API_KEY' })); }

if (msg.op === 0 && msg.d.event === 'twitter.following.new') { const { handle } = msg.d.task_info; const followed = msg.d.data; console.log(@${handle} followed @${followed.handle}); } };

setInterval(() => ws.send(JSON.stringify({ op: 1 })), 30000);

Why Not Use Twitter/X's Official API?

The official X API does not offer follow/unfollow event streaming. The closest option — the Follows Lookup endpoint — requires polling each account individually at 15 requests per 15 minutes, making real-time detection for more than a handful of accounts impractical. Enterprise API access costs approximately $42,000/month and still doesn't provide push-based follow events.

Xanguard handles all the polling, deduplication, and delivery infrastructure for you. You connect to one WebSocket and receive follow events for up to 1,000 accounts simultaneously.

Pricing

Follow detection is included in all B2B Realtime plans:

PlanAccountsPrice
RT 2525$49/mo
RT 100100$149/mo
RT 500500$499/mo
RT 10001,000$799/mo

All plans include all four real-time modules: tweet alerts, follow detection, profile change monitoring, and new follower alerts.

Get Started

Start monitoring follow changes in under 5 minutes:

  1. Message @B2B_Xanguard_bot on Telegram
  2. Subscribe to a plan and get your API key
  3. Add accounts to track via /add @handle or the REST API
  4. Connect to the WebSocket and start receiving events
← Back to Blog

Start Detecting Follow Changes Today

Get instant Telegram notifications for tweets, mentions, and keywords. Free tier includes 5 accounts with professional filtering.