Twitter (X) Account Activity API: What It Was, Its End of Life, and What Replaces It

By TwitterAPI.io Team•17 min read
Dark diagram titled 'Twitter (X) Account Activity API: where each event goes next' with three columns: Account Activity API payload keys, X Activity API event types, and the closest TwitterAPI.io endpoint for each event.
The Account Activity API's events, mapped to X Activity API event types and to TwitterAPI.io calls for public posts.
TL;DR
  • Status: docs.x.com marks the Account Activity API as being deprecated; the AAA-to-XAA migration guide sets end of life on February 28, 2027, with a managed migration for Enterprise customers.
  • What AAA sent: one webhook POST per event, keyed by for_user_id plus tweet_create_events, tweet_delete_events, favorite_events, follow_events, block_events, mute_events, direct_message_events, typing and read events, and user_event (revokes).
  • What replaces it: the X Activity API, one subscription per event type per user (up to 17 to mirror one AAA user), same V2 Webhooks API, same CRC (response_token = sha256= + base64 HMAC-SHA256 of crc_token).
  • The gap to plan for: XAA's post.reply.create covers direct replies only. In 599 mentions of 30 organization accounts, 60.4% were replies deeper in a thread that AAA delivered and XAA's reply and mention events do not.
  • Volume reality: the median account in our sample posted 1.77 times a day and was mentioned 101.3 times a day, so mentions are about 98% of the tweet events an AAA subscription carried.
  • Public-only route: /twitter/user/mentions, /twitter/user/last_tweets or one advanced_search query (from:handle OR @handle) at $0.15 per 1,000 tweets returned, with no X developer app; DMs, likes, blocks and mutes stay XAA-only.

Search for the Twitter account activity API today and you land on documentation that contradicts itself: the V2 introduction still lists AAA's event types and tier table, the enterprise page still talks about Premium, and a banner at the top of each says the product is being deprecated. This page settles what AAA is, what it delivered, when it ends, and how to get the same events after it is gone.

It is written for the developer who has an AAA webhook in production (a support inbox, a bot, a CRM sync) or who is reading an old tutorial built on it. It goes deeper on AAA itself than our broader guides: a full event-by-event map from AAA payload keys to X Activity API event types to the closest TwitterAPI.io call, the CRC code for the record, a migration checklist, and a study of what an AAA subscription actually carried for 30 real developer-facing accounts.

If you want a general comparison of webhook products, or monitoring architectures across many accounts and keywords, the related guides linked at the end cover those. Here the question is narrower: the Account Activity API, its end of life, and what replaces each of its events.

Mentions an X Activity API reply or mention event would miss

60.4% of 599 mentions of 30 organization accounts (collected in 2026) were replies deeper in a thread: the Account Activity API delivered them, XAA's direct-reply and explicit-mention events do not.

01 — Section

What the Account Activity API is, and how it delivers events

One webhook, every event of a subscribed user. The Account Activity API introduction on docs.x.com describes it as a way to receive real-time events related to X user accounts via webhooks: you register one webhook URL, subscribe user accounts to it, and X POSTs a JSON payload for each activity on those accounts. The app answers 200 OK and processes the event. There is no polling and no query language: a subscription is all of a user's activity or nothing.

Subscriptions need the user's consent. A user is subscribed with a user-context token for that user (OAuth 1.0a three-legged in the v1.1 era, OAuthUser on the V2 path), so AAA only ever covered accounts that authorized your app: your own brand accounts, or customers who connected their account to your product. It was never a way to watch arbitrary public accounts.

The payload shape. Every POST carries for_user_id (the subscribed user) and one array keyed by activity type. Post events arrive as v1.1 Tweet objects inside tweet_create_events; follows, blocks and mutes arrive as source and target user objects with a type; mention events can carry user_has_blocked when the mentioning user is blocked by the subscribed user. Home timeline data is not included, and docs.x.com notes that posts returned by AAA count toward the monthly Post cap.

The two tiers on today's page. The V2 introduction lists Pay Per Use at 3 unique subscriptions and 1 webhook, and Enterprise at 5,000+ subscriptions and 5+ webhooks. The older enterprise page shows Enterprise as Contact sales with retries and a Replay API for recovering missed activity, and still mentions the Premium tier in passing: AAA was historically sold through the Premium and Enterprise packages before X's pay-per-usage model.

AAA payload keyWhat it carriesDirection
tweet_create_eventsposts, replies, quotes, reposts, @mentionsby and of the user
tweet_delete_eventsnotice of deleted posts, for complianceby the user
favorite_eventslikes, with the liked post and the likerby and of the user
follow_events, unfollow_eventsfollow and unfollow, source and targetby and of the user
block_events, unblock_events, mute_events, unmute_eventsblocks and mutesby the user
direct_message_eventsDMs sent and receivedby the user
direct_message_indicate_typing_events, direct_message_mark_read_eventstyping indicators, read receiptsto the user
user_eventapp authorization revoked (subscription auto-deleted)by the user
02 — Section

Status: deprecated, end of life on February 28, 2027

What docs.x.com says. Each AAA page now opens with the same warning: the Account Activity API is being deprecated, and developers should use the X Activity API (XAA) for real-time user activity delivery going forward. The dedicated migration guide (docs.x.com/x-api/account-activity/migrate/aaa-to-xaa-migration) is more specific: AAA reaches end of life on February 28, 2027, and X recommends migrating before then to avoid an interruption in event delivery. After that date AAA is no longer supported.

Two migration routes. Enterprise customers can file a managed migration request and the X team moves existing AAA subscriptions to the equivalent XAA subscriptions internally, without users re-authorizing the app. Everyone else migrates self-serve: list webhooks with GET /2/webhooks, list subscribed users, create XAA subscriptions with POST /2/activity/subscriptions, verify, then delete the AAA subscriptions.

Do not confuse it with the earlier v1.1 to V2 move. A separate, older guide moved AAA from /1.1/account_activity/ paths to /2/account_activity/ paths and moved webhook management (create, list, CRC re-check, delete) to the V2 Webhooks API (/2/webhooks). That was a change of address for the same product. The XAA migration replaces the product: new subscription model, new payload envelope, new event names.

Auth timing. XAA accepts the OAuth 1.0a user tokens you already hold for AAA, so users do not need to re-authorize just to migrate, but the migration guide warns that OAuth 1.0a support in XAA will be deprecated soon and offers a token exchange from OAuth 1.0a to OAuth 2.0. Plan both moves together.

03 — Section

Event map: AAA payload key, X Activity API event, TwitterAPI.io equivalent

The left two columns follow the event mapping table in X's AAA-to-XAA migration guide. The right column is the closest thing TwitterAPI.io offers. Our API reads public X data with an API key and no X developer app, so it covers the public post events; private events (likes, DMs, blocks, mutes, typing, read receipts) need the account owner's OAuth and stay with X.

AAA activityXAA event typeTwitterAPI.io equivalent
posts, replies, quotes, reposts by the userpost.createTwitter Stream push, or /twitter/user/last_tweets (includeReplies=true)
@mentions of the userpost.mention.create (explicit, in the body)/twitter/user/mentions, or @handle in a filter rule
replies to the user's postspost.reply.create (direct replies only)/twitter/tweet/replies per post, or to:handle in search
quotes of the user's postspost.quote.create/twitter/tweet/quotes per post
reposts of the user's postspost.repost.create/twitter/tweet/retweeters per post (pull)
post deletes by the userpost.deleteno push event; re-check stored IDs with /twitter/tweets
likes by or of the userlike.create (direction)no event
follows and unfollowsfollow.follow, follow.unfollowdiff /twitter/user/followers snapshots (pull)
blocks, mutes and their reversalsblock.*, mute.*no event (private)
DMs, typing, read receiptsdm.sent, dm.received, dm.indicate_typing, dm.readno event
app authorization revokedoauth.revoke (automatic)not applicable (no user OAuth)

How many subscriptions one AAA user becomes. Replicating one AAA user takes up to 17 XAA subscriptions, one per event type, and each counts toward the subscription limit (self-serve 1,500, Enterprise 75,000, Partner 150,000 on the XAA introduction page). Subscribe only to the event types your handler actually uses.

What XAA adds. Event types AAA never had: profile updates (profile.update.*), encrypted XChat messages (chat.*), paid subscriptions, Spaces and live broadcast start, end and chat events, and Grok-curated news.new headlines (Enterprise and Partner only). If one of those is the reason you are migrating, XAA is the route.

04 — Section

What an AAA subscription actually carried: 30 accounts measured

The question. If an Account Activity subscription were still attached to a typical developer-facing organization account, what would it deliver, and how much of that would X's replacement still deliver? We read the newest 40 posts (replies included) and the newest 20 mentions of 30 such accounts, from @XDevelopers and @github to @golang and @reactjs: 1,134 own posts and 599 mentions, collected in 2026.

Mentions dwarf the account's own posts. The median account posted 1.77 times a day and was mentioned 101.3 times a day, about 52 mentions per own post. Every one of the 30 accounts was mentioned more often than it posted. For a support or community tool, the 'of user' side of tweet_create_events is the product; the account's own posts are a rounding error.

Most mentions are replies inside someone else's thread. We sorted each mention by how it names the account. 60.4% were replies to another user where the account's handle appears only in the reply prefix X adds to a conversation. 20.5% were plain @mentions in a new post, 8.5% were direct replies to the account's own post, 7.8% were thread replies that also named the account in the body, and 0.5% quoted one of its posts (2.2% were returned without an @handle in the text, mostly links to the account's site).

Kind of mentionShare of mentionsAAAXAA event
reply deeper in a thread, handle only in the reply prefix60.4%deliverednone today
plain @mention in a new post20.5%deliveredpost.mention.create
direct reply to the account's post8.5%deliveredpost.reply.create
thread reply naming the account in the body7.8%deliveredpost.mention.create
quote of the account's post0.5%deliveredpost.quote.create

Why this matters for a migration. The AAA-to-XAA guide states the difference in one row of its behavior table: AAA delivered any post that mentions the user, including replies deeper in a thread, while XAA's post.reply.create covers direct replies and post.mention.create covers explicit @mentions only. On our sample that row is 60.4% of the mention traffic, so a handler migrated one-for-one would go from all mentions to roughly 37.4%. X says it is looking at closing the reply and protected-account gaps; until it does, test with your own accounts before cutover.

The account's own posts. Of 1,134 own posts, 40.0% were originals, 19.6% replies to the account's own posts (threads), 12.5% replies to other users, 22.0% reposts and 5.8% quotes. AAA and XAA's post.create deliver all of these in one stream; tell them apart with the reply and quote fields, as the classifier in the code below does.

100% stacked bars for 30 organization accounts showing the newest 20 mentions of each by kind. Orange, the largest segment for most accounts, is replies deeper in a thread with the handle only in the reply prefix: 60.4% overall. Blue shades are plain mentions, direct replies and thread replies naming the account in the body.
Newest 20 mentions per account, 30 organization accounts, collected in 2026. Orange: delivered by AAA, not covered by XAA's reply and mention events.
05 — Section

What the same events cost: X Activity API vs polling TwitterAPI.io

X's rate card for XAA. The webhook events table on the X pay-per-usage pricing page (docs.x.com/x-api/getting-started/pricing) bills per delivered event: post.create $0.005, post.delete not billed, follow.follow and follow.unfollow $0.010, dm.received $0.010, mutes and blocks $0.001, profile.update.* $0.005. The XAA introduction adds that each delivered post event (create, delete, mention, reply, quote, repost) is billed as a Post. Events are deduplicated within a 24-hour UTC window. AAA itself is not on that table; on Enterprise it is priced by contract.

TwitterAPI.io's rate card. Tweet endpoints cost 15 credits per tweet returned, $0.15 per 1,000 tweets, with a minimum of 15 credits ($0.00015) for a check that returns nothing. A poll every 60 seconds is 43,200 checks a month, a $6.48 floor; every 5 minutes is $1.30. Per 1,000 posts that is $0.15 against $5.00 for 1,000 Post events on X's pay-per-usage card, about 33 times less per post.

Applied to the study. We converted each account's measured rates to 30 days and priced two routes: XAA at $0.005 for each post event it would deliver (own posts plus the mentions in the categories it covers), and one TwitterAPI.io search query, from:handle OR @handle, every 60 seconds, counted at its upper bound (every check billed the minimum, plus every tweet returned, including the thread replies XAA skips). The six most-mentioned accounts:

AccountOwn posts / mentions per dayAAA tweet events per 30 daysXAA cost per 30 days60 s poll per 30 days, at most
@nvidia1.45 / 12,725.6381,811$763.75$63.75
@OpenAIDevs10.03 / 1,596.948,208$181.15$13.71
@AnthropicAI0.97 / 1,261.837,883$66.39$12.16
@GeminiApp7.61 / 509.315,509$43.16$8.81
@github2.64 / 494.914,926$26.38$8.72
@vercel0.87 / 442.713,308$3.45$8.48

Across all 30 accounts. An AAA subscription on each would have carried about 576,686 tweet events in 30 days. The XAA post events covering the same accounts come to 234,402 events and $1,171.99; thirty 60-second polls on TwitterAPI.io, which also return the thread replies, come to at most $280.90 ($125.38 at 5 minutes). For a quiet account either bill is a few dollars a month; the per-post rate decides the bill once an account is mentioned hundreds of times a day.

What the numbers cannot show. The mention rates come from one page of 20 mentions per account, so the busiest accounts (which filled that page within minutes) are burst estimates and swing with the news cycle. The XAA column assumes every delivered post event is billed at $0.005, as the pricing page states; X's dedupe window and any Enterprise contract terms change real bills. And the mention-side XAA events are private: they need each account owner's OAuth 2.0 consent with tweet.read, which TwitterAPI.io's public-data route does not.

Dumbbell chart on a log scale for 30 organization accounts: blue dots for own posts per day, mostly between 0.1 and 10, orange dots for mentions per day, from 2 for @reactjs to about 12,700 for @nvidia. Median 1.77 own posts vs 101.3 mentions a day.
Own posts vs mentions per day, 30 organization accounts, collected in 2026. Mentions are the bulk of what an Account Activity subscription delivered.
06 — Section

CRC and signatures: the receiver code, for the record

AAA and XAA share the V2 Webhooks API, so the receiver you already run keeps working through the migration. X validates the URL with a Challenge-Response Check (CRC): a GET with a crc_token query parameter, answered with JSON {"response_token": "sha256=<base64 HMAC-SHA256>"} computed with your app's OAuth 2.0 client secret (or the OAuth 1.0a consumer secret for older integrations). Per the webhooks introduction, X sends a CRC when the webhook is created, on PUT /2/webhooks/:webhook_id, and periodically every 30 minutes if the webhook has not validated in the past 24 hours.

Requirements the docs list. HTTPS, publicly reachable, no port in the URL, a 200 within 10 seconds. A webhook is marked invalid on a wrong response_token, a 3XX, an SSL error, or after more than 28 hours without a successful validation (4XX, 5XX and timeouts count as transient errors). Every event POST carries X-Twitter-Webhooks-Signature-OAuth2 (recommended) or the legacy X-Twitter-Webhooks-Signature, both sha256= plus a base64 HMAC of the raw body.

One handler for both formats during cutover. While a user has both an AAA and an XAA subscription on the same webhook, each activity arrives twice. AAA bodies have a top-level for_user_id; XAA bodies have data.event_type, data.filter.user_id and a data.event_uuid you can deduplicate on. The receiver below answers the CRC, checks the signature and routes on whichever envelope is present.

python
"""Account Activity API / X Activity API webhook receiver: CRC answer + signature check.
X sends GET ?crc_token=... on registration, on PUT /2/webhooks/:id and periodically;
event POSTs carry X-Twitter-Webhooks-Signature-OAuth2 (or the legacy X-Twitter-Webhooks-Signature).
    pip install flask
"""
import base64
import hashlib
import hmac
import os

from flask import Flask, abort, jsonify, request

app = Flask(__name__)
SECRET = os.environ["X_WEBHOOK_SECRET"].encode()   # OAuth 2.0 client secret (or OAuth 1.0a consumer secret)


def sign(message: bytes) -> str:
    digest = hmac.new(SECRET, message, hashlib.sha256).digest()
    return "sha256=" + base64.b64encode(digest).decode()


@app.get("/webhook/x")
def crc():
    token = request.args.get("crc_token")
    if not token:
        abort(400)
    return jsonify({"response_token": sign(token.encode())})


@app.post("/webhook/x")
def events():
    raw = request.get_data()
    sent = request.headers.get("X-Twitter-Webhooks-Signature-OAuth2") or request.headers.get("X-Twitter-Webhooks-Signature", "")
    if not hmac.compare_digest(sent, sign(raw)):
        abort(401)
    body = request.get_json()
    if "for_user_id" in body:                     # AAA envelope: keys such as tweet_create_events
        kinds = [k for k in body if k.endswith("_events") or k == "user_event"]
        print("AAA", body["for_user_id"], kinds)
    elif "data" in body and "event_type" in body["data"]:   # XAA envelope
        print("XAA", body["data"]["filter"].get("user_id"), body["data"]["event_type"])
    return "", 200                                # answer fast; queue heavy work
07 — Section

Migration checklist: from AAA to XAA, or to a public-data route

1. Inventory. List webhooks (GET /2/webhooks) and subscribed users per webhook (GET /2/account_activity/webhooks/:webhook_id/subscriptions/all/list). Note which AAA payload keys your handler actually reads; most integrations use two or three.

2. Sort each event by who owns the data. Private events (DMs, likes, blocks, mutes, typing, read receipts, the mention, reply, quote and repost events about the user) need the user's consent on XAA. Public events (the user's own posts and deletes, profile updates, broadcast start and end) can be subscribed with the app's bearer token. Public posts that mention the account can also be read from TwitterAPI.io without any consent flow.

3. Decide on the thread-reply gap. If your product answers every reply in a conversation (support desks usually do), XAA's direct-reply event will miss the replies deeper in a thread. In our sample that was 60.4% of mentions. Cover them with a search on @handle or to:handle, or with the mentions endpoint, and deduplicate by post ID.

4. Rewrite the parser. AAA sends v1.1 Tweet and User objects keyed by activity; XAA sends v2 objects in data.payload and data.includes, with data.event_type instead of the key name. Keep the AAA parser alive until cutover.

5. Move auth. Existing OAuth 1.0a tokens work for creating XAA subscriptions, but X says OAuth 1.0a support in XAA will be deprecated soon; exchange tokens for OAuth 2.0 with the scopes each event needs (tweet.read, dm.read, like.read, block.read, mute.read).

6. Create, verify, delete. Create XAA subscriptions (POST /2/activity/subscriptions, existing webhook_id, a tag such as aaa-migration), confirm events arrive, then delete each AAA subscription. Watch for duplicates during the overlap. Use POST /2/webhooks/replay for the 24-hour recovery window if anything was missed.

7. Finish before February 28, 2027. Enterprise customers who want the managed migration should file the request early so there is time to schedule and verify the cutover.

If you only ever used the public side. Many AAA integrations were built to see an account's own posts and the posts that mention it. That part does not need a webhook subscription, a developer app or user OAuth: the polling script at the end of this page rebuilds it with one search query and labels each post with the AAA and XAA event it corresponds to. If you prefer push, the next section shows the two push options.

python
# Feed TwitterAPI.io posts into a handler written for AAA tweet_create_events.
# Field names stay TwitterAPI.io's (author.userName, inReplyToUsername, createdAt),
# not v1.1's (user.screen_name, in_reply_to_screen_name, created_at): map them once here.
def to_aaa_envelope(tweet: dict, for_user_id: str) -> dict:
    return {
        "for_user_id": for_user_id,
        "source": "twitterapi.io",
        "tweet_create_events": [{
            "id_str": tweet["id"],
            "text": tweet["text"],
            "created_at": tweet["createdAt"],
            "in_reply_to_screen_name": tweet.get("inReplyToUsername"),
            "in_reply_to_status_id_str": tweet.get("inReplyToId"),
            "is_quote_status": bool(tweet.get("quoted_tweet")),
            "user": {"id_str": tweet["author"]["id"], "screen_name": tweet["author"]["userName"]},
        }],
    }
08 — Section

Push without AAA: Twitter Stream and filter rules on TwitterAPI.io

Twitter Stream watches named accounts. /oapi/x_user_stream/add_user_to_monitor_tweet with x_user_name adds an account; per the docs.twitterapi.io reference it then delivers that account's tweets, replies, quotes and retweets as they are posted, the same set AAA put in tweet_create_events for the user's own posts and XAA puts in post.create. It runs on monthly plans sized by the number of watched accounts; see the Twitter Stream page for plans.

Filter rules push matches for a search query. /oapi/tweet_filter/add_rule takes a tag, a value such as from:XDevelopers OR @XDevelopers (up to 255 characters) and an interval_seconds; rules are created inactive, and /oapi/tweet_filter/update_rule with is_effect: 1 turns one on. Matches go to your webhook or WebSocket. Each rule check is billed like a poll (the $0.00015 minimum when nothing matches), plus $0.00015 per matched tweet, so the polling floors above apply.

What neither does. No TwitterAPI.io product pushes likes, follows, blocks, mutes, DMs received, typing indicators or read receipts as events. Follower changes can be found by diffing /twitter/user/followers snapshots on a schedule; the rest needs the account owner's authorization on X. Reads on TwitterAPI.io need no X account. Write actions (posting a reply, for example) are a separate product: one /twitter/user_login_v2 login ($0.10, with a proxy you supply) returns login_cookies, then each /twitter/create_tweet_v2 call is 60 credits ($0.0006), billed per HTTP 200 call. That call acts as your account, so X can rate-limit, lock or suspend it; keep a human pace, and expect to log in again when the session expires.

python
# Push instead of poll: watch an account's own posts with Twitter Stream,
# or push "from:handle OR @handle" matches with a filter rule (webhook or WebSocket).
import os
import requests

API = "https://api.twitterapi.io"
H = {"X-API-Key": os.environ["TWITTERAPI_IO_API_KEY"]}

# 1) Twitter Stream: the account's tweets, replies, quotes and retweets as they are posted
r = requests.post(f"{API}/oapi/x_user_stream/add_user_to_monitor_tweet",
                  headers=H, json={"x_user_name": "XDevelopers"}, timeout=30)
print(r.json())   # {"status": "success", "msg": ...}

# 2) Filter rule: own posts and mentions, checked every 60 s, pushed to your endpoint
r = requests.post(f"{API}/oapi/tweet_filter/add_rule", headers=H, timeout=30,
                  json={"tag": "xdevelopers-activity", "value": "from:XDevelopers OR @XDevelopers", "interval_seconds": 60})
rule_id = r.json().get("rule_id")
# rules are created inactive: switch it on (all fields are required by update_rule)
requests.post(f"{API}/oapi/tweet_filter/update_rule", headers=H, timeout=30,
              json={"rule_id": rule_id, "tag": "xdevelopers-activity", "value": "from:XDevelopers OR @XDevelopers",
                    "interval_seconds": 60, "is_effect": 1})
09 — Section

How we collected this

Question. What mix of tweet events would an Account Activity subscription deliver for a developer-facing organization account, how much of it maps to X Activity API events, and what would covering it cost? The protocol was written before collection.

Accounts and sample. 30 public organization accounts: @XDevelopers, @vercel, @github, @Docker, @CloudflareDev, @OpenAIDevs, @nvidia, @supabase, @stripe, @awscloud, @googledevs, @figma, @linear, @Railway, @Netlify, @nextjs, @reactjs, @rustlang, @golang, @nodejs, @typescript, @bunjavascript, @SlackHQ, @NotionHQ, @huggingface, @MongoDB, @grafana, @digitalocean, @AnthropicAI, @GeminiApp. Per account, the newest 40 posts from /twitter/user/last_tweets with includeReplies=true (fewer where the account had fewer recent posts) and the newest 20 posts from /twitter/user/mentions. Total 1,134 own posts and 599 mentions, collected in 2026, 90 requests, about $0.26 in API credits.

Method. Own posts were classified with retweeted_tweet, quoted_tweet, isReply and inReplyToUsername. Mentions were classified as a quote of the account's post, a direct reply (inReplyToUsername is the account), a thread reply whose @handle appears only in the leading reply prefix, a thread reply that names the account in the body, or a plain @mention. Rates are items divided by the time the sample spans; 30-day figures scale those rates.

What the sample cannot show. One page of mentions is a snapshot, not a month: busy accounts filled it within minutes, quiet ones over several days. The mentions endpoint returns posts that mention the account; it is not identical to the set X would push, and X's own definitions may differ at the edges (a reply prefix edited by hand, for example). Organization accounts behave differently from personal ones. Costs are estimates from public rate cards, not invoices.

Privacy. Aggregates only. Mention authors are mostly private individuals, so raw mention pages are not published; the study folder keeps de-identified rows (account, kind, hours before collection) with no post IDs, URLs, text or author handles.

python
"""account_activity_poll.py - rebuild the public half of an Account Activity API
subscription (the account's own posts plus posts that mention it) with TwitterAPI.io.

    pip install requests
    export TWITTERAPI_IO_API_KEY=...   # twitterapi.io dashboard; no X developer app or user OAuth
    python account_activity_poll.py XDevelopers           # one pass (run from cron every 1-5 min)
    python account_activity_poll.py XDevelopers --loop 60  # or keep polling every 60 s

Cost: each pass is one advanced_search request. A pass that finds nothing costs the
$0.00015 minimum (15 credits); every post returned costs $0.00015 ($0.15 per 1,000).
Every 60 s for a month = 43,200 checks = $6.48 floor; every 5 min = $1.30.
"""
import argparse
import json
import os
import time

import requests

API = "https://api.twitterapi.io"
KEY = os.environ["TWITTERAPI_IO_API_KEY"]
OVERLAP = 120          # seconds re-read each pass; the seen set drops duplicates
MAX_PAGES = 10         # safety cap per pass (20 posts per page)


def classify(t, handle):
    """Name each post the way AAA / XAA would have."""
    h = handle.lower()
    author = (t.get("author") or {}).get("userName", "").lower()
    if author == h:
        if t.get("retweeted_tweet"):
            return "own_repost (AAA tweet_create_events / XAA post.create)"
        if t.get("quoted_tweet"):
            return "own_quote (AAA tweet_create_events / XAA post.create)"
        if t.get("isReply"):
            return "own_reply (AAA tweet_create_events / XAA post.create)"
        return "own_post (AAA tweet_create_events / XAA post.create)"
    q = t.get("quoted_tweet") or {}
    if (q.get("author") or {}).get("userName", "").lower() == h:
        return "quote_of_account (XAA post.quote.create)"
    if t.get("isReply") and (t.get("inReplyToUsername") or "").lower() == h:
        return "direct_reply (XAA post.reply.create)"
    if t.get("isReply"):
        return "thread_reply (AAA delivered; XAA only if @handle is in the body)"
    return "mention (XAA post.mention.create)"


def fetch(handle, since_time):
    query = f"(from:{handle} OR @{handle}) since_time:{since_time}"
    out, cursor = [], None
    for _ in range(MAX_PAGES):
        params = {"query": query, "queryType": "Latest"}
        if cursor:
            params["cursor"] = cursor
        r = requests.get(f"{API}/twitter/tweet/advanced_search",
                         headers={"X-API-Key": KEY}, params=params, timeout=30)
        r.raise_for_status()
        body = r.json()
        out.extend(body.get("tweets") or [])
        if not body.get("has_next_page"):
            break
        cursor = body.get("next_cursor")
    return out


def one_pass(handle, state):
    started = int(time.time())
    tweets = fetch(handle, state["since_time"] - OVERLAP)
    seen = set(state["seen"])
    for t in sorted(tweets, key=lambda x: int(x["id"])):
        if t["id"] in seen:
            continue
        seen.add(t["id"])
        event = {
            "kind": classify(t, handle),
            "id": t["id"],
            "url": t["url"],
            "author": t["author"]["userName"],
            "createdAt": t["createdAt"],
            "text": t["text"][:140],
        }
        print(json.dumps(event))          # replace with your queue / handler
    state["since_time"] = started
    state["seen"] = list(seen)[-5000:]


def main():
    ap = argparse.ArgumentParser()
    ap.add_argument("handle")
    ap.add_argument("--loop", type=int, default=0, help="seconds between passes; 0 = one pass")
    args = ap.parse_args()
    path = f"activity-state-{args.handle}.json"
    state = json.load(open(path)) if os.path.exists(path) else {"since_time": int(time.time()) - 3600, "seen": []}
    while True:
        try:
            one_pass(args.handle, state)
            json.dump(state, open(path, "w"))
        except requests.RequestException as e:
            print("request failed, retrying next pass:", e)
        if not args.loop:
            break
        time.sleep(args.loop)


if __name__ == "__main__":
    main()

Researching this?Free starter credits cover end-to-end testing — Google sign-in, no card. Get a key.

10 — Questions

Questions readers ask

Is the Twitter Account Activity API deprecated?

Yes. Every AAA page on docs.x.com carries a warning that the Account Activity API is being deprecated, and the AAA-to-XAA migration guide sets its end of life on February 28, 2027. X directs all integrations to the X Activity API (XAA).

What replaces the Account Activity API?

The X Activity API. Instead of one all-events subscription per user, you create one subscription per event type and user (post.create, post.mention.create, post.reply.create, like.create, follow.follow, dm.received and so on) with POST /2/activity/subscriptions, delivered to the same V2 webhook or a persistent HTTP stream (GET /2/activity/stream).

Can I keep my existing webhook and CRC code?

Yes. XAA uses the same V2 Webhooks API, CRC check and signature headers as AAA, so you pass your existing webhook_id when creating XAA subscriptions. What changes is the payload: XAA wraps v2 objects in an envelope with data.event_type, where AAA sent v1.1 objects keyed by activity.

How much does the X Activity API cost?

On X's pay-per-usage card, each delivered post.create event is $0.005, follows and DMs received $0.010, mutes and blocks $0.001, profile updates $0.005; post deletes, DMs sent, typing and read events are not billed. Each delivered post event (including mentions, replies, quotes and reposts) is billed as a Post. Enterprise pricing is by contract.

Does the X Activity API deliver every reply that AAA delivered?

Not today. AAA delivered any post that mentioned the user, including replies deeper in a thread. XAA's post.reply.create covers direct replies to the user's posts and post.mention.create covers explicit @mentions in the body. In our study of 30 organization accounts, 60.4% of mentions fell in the gap. X says it is looking at closing it.

Can I use the Account Activity API to monitor accounts I do not own?

No. AAA subscriptions always required the subscribed user's authorization. XAA lets an app subscribe to public events (own posts and deletes, profile updates, broadcast start and end) of any public account with an app token, but mentions, replies, likes and DMs still need that user's consent. For public posts by or about accounts you do not control, a search or mentions endpoint is the usual route.

Is there an Account Activity API alternative without a developer app?

For public posts, yes. TwitterAPI.io reads an account's own posts (/twitter/user/last_tweets), its mentions (/twitter/user/mentions) or both in one advanced_search query with an API key and no X account, at $0.15 per 1,000 tweets returned, and can push them through Twitter Stream or a filter rule. New accounts that pass the automatic bot check get up to $1 of free credits (at most 100,000 credits, no card, one per person or network, expiring after 31 days). DMs, likes, blocks and mutes are not available as events.

What were the Account Activity API limits?

The V2 introduction lists Pay Per Use at 3 unique subscriptions and 1 webhook, and Enterprise at 5,000+ subscriptions and 5+ webhooks. Webhooks must use HTTPS without a port, answer within 10 seconds and pass CRC checks. Posts delivered by AAA count toward the monthly Post cap.

11 — Further reading

Continue

Sources & further reading
More from this series

Writing about something you built with TwitterAPI.io? Our community rewards program pays API credits for honest tutorials, build logs and videos.

Build it

Stop reading. Start building.

Starter credits cover real testing on real data. Google sign-in, no card, no application queue.

Get an API key

Already building with TwitterAPI.io? Publish an honest tutorial or build log about it and earn up to $200 a month in API credits.