X’s Account Activity API (AAA) reaches end of life on January 1, 2027. As of December 3, 2026, that is 29 days away. If your production code still receives for_user_id payloads on a webhook, the replacement is the X Activity API (XAA). The move is bigger than swapping a URL: the subscription model, the payload envelope, and several delivery behaviors all change.
This guide covers what is specific to X: how subscriptions and payloads differ, how to run old and new consumers side by side, and what to verify before you cut over. It is based on X’s migration guide, the XAA reference pages, the X API changelog and X’s webhook documentation, all checked on December 3, 2026.
Who this is for. X’s migration guide is written for Enterprise customers moving off AAA. The XAA introduction page also lists a Self-serve tier, but pricing and limits for your account go through your account manager. If you are not an AAA customer, most of this will not apply to you.
What is ending, and what X is offering
X’s migration page states that AAA reaches end of life on January 1, 2027, and that you should migrate before then to avoid an interruption in event delivery. After that date it is no longer supported. There are two ways to move:
- Managed migration. You submit X’s request form, the team confirms which apps, webhooks and event types to migrate, and they move your existing AAA subscriptions to XAA internally. You do not re-create subscriptions or ask users to re-authorize your app. X asks you to submit well ahead of the deadline so there is time to schedule and verify cutover.
- Self-serve migration. You create the XAA subscriptions yourself with the API.
Either way, your webhook consumer must be updated to read the XAA payload format before cutover. Managed migration moves subscriptions, not your code.
AAA vs XAA at a glance
| Account Activity API | X Activity API | |
|---|---|---|
| Subscription model | One /all subscription per user | One subscription per event type, per user |
| Delivery | Webhook | Webhook, persistent HTTP stream, or both |
| Payload | v1.1 objects keyed by activity type, with for_user_id | Common envelope with X API v2 objects |
| Per-event ID | None, per X’s migration guide | data.event_uuid |
| Replay | Old replay endpoint deprecated March 25, 2026 | POST /2/webhooks/replay, past 24 hours |
| Auth | OAuth 1.0a (OAuth 2.0 added to AAA v2 in January 2026) | OAuth 2.0 with scopes; existing OAuth 1.0a tokens accepted for now; app bearer token for public events |
| Webhook management | V2 Webhooks API | The same V2 Webhooks API |
The last row is the good news. XAA uses the same V2 Webhooks API, CRC checks and signature headers as AAA, so your existing webhook endpoint and its validation code can stay as they are.
Subscriptions: from one /all to one per event type
With AAA, subscribing a user to /all delivered every activity type for that user. XAA has no equivalent. You call POST /2/activity/subscriptions once per user and event type, with an event_type, a filter.user_id, and optionally a webhook_id, a tag, an expires_at and filter.qualifiers.
X’s mapping from AAA payload keys to XAA event types:
| AAA payload key | XAA event type(s) |
|---|---|
tweet_create_events | post.create, post.mention.create, post.reply.create, post.quote.create, post.repost.create |
tweet_delete_events | post.delete |
favorite_events | like.create (optional direction: inbound or outbound) |
follow_events | follow.follow, follow.unfollow (supports direction) |
block_events | block.block, block.unblock |
mute_events | mute.mute, mute.unmute |
direct_message_events | dm.sent, dm.received |
direct_message_indicate_typing_events | dm.indicate_typing |
direct_message_mark_read_events | dm.read |
user_event (app revoked) | oauth.revoke, delivered automatically with no subscription |
Four consequences matter for your code.
One AAA key fans out into five XAA types. Everything that arrived under tweet_create_events now arrives as five different event_type values. post.create fires when the subscribed user posts, and covers standalone Posts, replies, quote Posts and reposts by that user, so inspect in_reply_to_tweet_id or referenced_tweets to tell them apart. The other four fire when someone else interacts with the subscribed user’s Posts.
Full parity costs up to 17 subscriptions per user. That is every event type in the table except oauth.revoke, and each counts toward your limit. The XAA introduction lists the maximums by tier: 1,500 for Self-serve, 75,000 for Enterprise and 150,000 for Partner. A base of 5,000 users at full parity would need 85,000 subscriptions, which is above the listed Enterprise figure. Subscribe only to the event types you actually process, and ask your account manager about higher limits.
Event type names changed in March 2026. XAA moved from PascalCase names such as ProfileBioUpdate to dot-separated lowercase names such as profile.update.bio, effective March 18, 2026. If you are working from an older tutorial, check its event names before copying anything.
Subscriptions are easier to manage, with a few rules. You can tag subscriptions, set an automatic expires_at, list subscriptions for a single user, and delete up to 100 in one request. expires_at can only be changed by POSTing the same subscription again with a new value. PUT /2/activity/subscriptions/:id updates the tag and webhook_id but not the filter or event type; to change those, delete and re-create. Filter qualifiers (direction, post_id, conversation_type, up to 8 per subscription) narrow delivery, for example to likes on one specific Post.
Payload changes your parser must handle
AAA sends v1.1 objects keyed by activity type. XAA wraps every event in an envelope:
{ "data": { "event_uuid": "2080761390344937796", "created_at": "2026-10-07T19:17:36.304Z", "filter": { "user_id": "2244994945" }, "event_type": "like.create", "tag": "aaa-migration", "payload": {}, "includes": {} } } | AAA | XAA |
|---|---|
for_user_id | data.filter.user_id |
Activity key, such as favorite_events | data.event_type, such as like.create |
| v1.1 Tweet and User objects | v2 Post and user objects in data.payload and data.includes |
| No per-event identifier | data.event_uuid |
A few details from X’s payload reference and stream schema are easy to miss:
-
includesis optional. It carries related users and Posts when available. The samples show it as an empty object on some events and absent on others, so treat both as “nothing included.” The stream schema also lists media, polls, places and topics. Resolve related objects by ID (for examplepayload.author_idtoincludes.users[].id), not by array position. - Field naming is not fully consistent. X’s sample payloads use tweet-style names such as
referenced_tweets,in_reply_to_tweet_idandedit_history_tweet_ids, and put related Posts underincludes.tweets. The OpenAPI schema for the stream uses post-style names such asreferenced_postsandedit_history_post_ids. The schema also defines anote_postfield for the full text of Posts longer than 280 characters. Capture a few real payloads from your own subscriptions and write your parser against those, tolerating both spellings. -
like.createis a small object, not a v1.1 favorite event. X’s reference listsid,liked_tweet_id,liked_tweet_author_id,liking_user_id,created_atandtimestamp_ms, with the liked Post and related users inincludeswhen available. The stream schema calls the author fieldtweet_author_id, so check which one you actually receive. -
post.deleteis minimal. The payload holds only the deleted Post’sidand theauthor_id. -
dm.sentanddm.receivedkeep thedirect_message_eventsstructure insidepayload, plus ausersmap, so existing DM parsing may need only a new entry point. - Follow and subscription events carry
sourceandtargetuser objects. -
event_uuididentifies the event delivery, per X’s payload reference. If you plan to use it as a dedupe key, test whether retries and replays reuse the same value before you rely on it. - XAA adds event families AAA never had: encrypted XChat events (
chat.received,chat.sent,chat.conversation_join), nineprofile.update.*events, paid-subscription events, Spaces and broadcast events, and Grok-curatednews.newevents, which are limited to Enterprise and Partner accounts.
During the transition you can receive both formats on one webhook. AAA bodies have a top-level for_user_id; XAA bodies have a top-level data.event_type. X suggests routing on whichever is present:
function route(body) { if (body.data?.event_type) return handleXaa(body.data); if (body.for_user_id) return handleAaa(body); throw new Error("unknown payload shape"); } Delivery: webhook, stream, and replay
Persistent stream. GET /2/activity/stream delivers events for all your subscriptions over one HTTP connection, authenticated with your app’s bearer token. It accepts backfill_minutes (0 to 5) for catching up on connect, and start_time and end_time for recovering missed events. A subscription that has a webhook_id is delivered to both the webhook and the stream whenever the stream is open, so opening the stream during testing produces duplicates on your webhook.
Replay. The consolidated endpoint is POST /2/webhooks/replay, with webhook_id, from_date and to_date in yyyymmddhhmm UTC format. Both dates are inclusive, and the call returns a job_id. X’s migration guide and the endpoint description both say it covers the past 24 hours, the same window as AAA replay. Older material, including a 2019 changelog entry for the enterprise replay tool, mentions five days, so plan around 24 hours. The old POST /2/account_activity/replay/webhooks/{webhook_id}/subscriptions/all endpoint was deprecated effective March 25, 2026 at 12:00 PM ET, so any recovery job that calls it needs updating even if you change nothing else.
Webhook requirements and validity. Your endpoint must be HTTPS and publicly reachable, and the URL cannot include a port. It must answer event POSTs with 200 within 10 seconds. X sends a CRC check on creation, on PUT /2/webhooks/:webhook_id, and every 30 minutes if the webhook has not validated in the past 24 hours. A wrong CRC response, a 3XX or an SSL error marks the webhook invalid. So do persistent transient failures (4XX, 5XX, timeouts): the webhook goes invalid once it has not validated for more than 28 hours, which includes a 4-hour grace period. An invalid webhook stops receiving events until it passes a check again, and a PUT triggers that check and re-enables it. If your test consumer sits behind a laptop tunnel that goes dark over a weekend, expect to re-validate.
Signatures. X sends X-Twitter-Webhooks-Signature-OAuth2, signed with your OAuth 2.0 client secret and recommended, and the legacy X-Twitter-Webhooks-Signature, signed with your OAuth 1.0 consumer secret. Apps with both secrets configured may receive both headers during migration. Both use sha256= plus the base64 HMAC-SHA256 of the raw request body.
Behavior differences that can bite
- Protected accounts. AAA delivers Posts by an authorized protected user. XAA does not deliver Posts from protected accounts, even with user-context authorization. X’s migration guide says it is looking at closing this gap, so test any protected users you serve.
- Replies and mentions are a moving target. The migration guide and the XAA introduction page, as I read them on December 3, still describe
post.reply.createas direct replies only andpost.mention.createas explicit @mentions only. A November 19, 2026 changelog entry and docs update say XAA now closes part of that gap:post.reply.createalso fires for deeper replies when the subscribed user is in the reply’s “Replying to” list, and the docs update adds thatpost.mention.createfires for reposts of a Post that mentions the user and for mentions past the first 280 characters. The pages may lag the change, so verify with a real deep reply instead of trusting either source. - A reported webhook delivery problem. A developer-forum thread from early October describes
post.reply.createevents reaching the stream for every reply but reaching the webhook only for the first reply after each subscription was created. A staff reply acknowledged the report, and I found no announced fix. Treat it as a reason to test reply delivery on the webhook path specifically, not just on the stream. - Billing. Each delivered Post event (
post.create,post.delete,post.mention.create,post.reply.create,post.quote.create,post.repost.create) is billed as a Post, per the XAA introduction. Get pricing for your contract from your account manager before enabling every event type. - Duplicates. Any user with both AAA and XAA subscriptions on the same webhook sends you each activity twice, once per format.
- App revocation. XAA delivers
oauth.revokeautomatically with no subscription, and the user-context subscriptions for that user are deleted automatically. Make sure your handler cleans up local state.
Authentication: tokens you can keep, and one deadline to plan for
XAA accepts the OAuth 1.0a user access tokens you already hold, so users do not need to re-authorize to migrate. Public events, such as post.create, post.delete and broadcast start and end, can also be subscribed with your app’s bearer token. X says OAuth 1.0a support in XAA will be deprecated soon, without giving a date.
Since September 21, 2026 you can exchange a stored OAuth 1.0a token and secret for an OAuth 2.0 access and refresh token, with no consent screen and no re-authorization. Send grant_type=urn:ietf:params:oauth:grant-type:token-exchange to POST /2/oauth2/token. The granted scopes derive from the permissions the user originally authorized, and offline.access is always included.
Private events need matching scopes: tweet.read for mention, reply, quote and repost events, mute.read for mutes, block.read for blocks, follows.read for paid-subscription events (not follow events), and broadcast.read for broadcast chat. The migration guide also names dm.read and like.read as examples. The XAA introduction describes private events as requiring OAuth 2.0 user context, while the migration guide lets you use existing OAuth 1.0a tokens for the move, so test each event type with the credentials you plan to use.
Run old and new consumers side by side on two stable subdomains
The safest check is to let real activity hit both systems and compare what each one received.
Why stable URLs matter. X validates your webhook URL with a CRC check on registration and again whenever you re-validate. If your tunnel hands out a new random hostname on every restart, you re-register and re-validate each time. Use two stable subdomains from a tunnel provider that offers them. InstaTunnel’s package README lists custom subdomains on the free tier, for example instatunnel 3000 --subdomain myapp. Check current plan limits for how many tunnels you can run at once. Use one subdomain per consumer; the hostnames below are examples:
-
aaa-legacyforwards tolocalhost:4001, running your current AAA handler. -
xaa-nextforwards tolocalhost:4002, running the new handler.
instatunnel 4001 --subdomain aaa-legacy instatunnel 4002 --subdomain xaa-next Wire up the subscriptions. Keep the test user’s AAA /all subscription on the legacy webhook. Register a second webhook for the new subdomain with POST /2/webhooks and your app’s bearer token. X immediately sends it a CRC check, so start the receiver below first:
curl --request POST --url 'https://api.x.com/2/webhooks' \ --header "Authorization: Bearer $BEARER_TOKEN" \ --header 'Content-Type: application/json' \ --data '{"url": "https://xaa-next.instatunnel.my/webhook"}' Then create XAA subscriptions that point to the new webhook_id. X’s guide points XAA at your existing webhook; using a separate one is a suggestion to keep the two formats apart. Check whether your plan limits the number of webhooks, and if it does, use one webhook and the route() function above instead.
import requests from requests_oauthlib import OAuth1 EVENT_TYPES = [ "post.create", "post.delete", "post.mention.create", "post.reply.create", "post.quote.create", "post.repost.create", "like.create", "follow.follow", "follow.unfollow", "block.block", "block.unblock", "mute.mute", "mute.unmute", "dm.sent", "dm.received", "dm.read", "dm.indicate_typing", ] auth = OAuth1(CONSUMER_KEY, CONSUMER_SECRET, USER_TOKEN, USER_TOKEN_SECRET) for event_type in EVENT_TYPES: r = requests.post( "https://api.x.com/2/activity/subscriptions", auth=auth, json={"event_type": event_type, "filter": {"user_id": USER_ID}, "webhook_id": NEW_WEBHOOK_ID, "tag": "xaa-shadow"}, ) print(event_type, r.status_code) This follows X’s own example, which uses the OAuth 1.0a credentials from an AAA integration. Switch to OAuth 2.0 before that path is deprecated.
Log raw bodies. Run the same small receiver on both ports, labelled aaa and xaa. It answers the CRC check, verifies the signature against the raw body, and appends each event to a file. Save it as receiver.mjs:
// LABEL=aaa PORT=4001 node receiver.mjs // LABEL=xaa PORT=4002 node receiver.mjs import express from "express"; import crypto from "node:crypto"; import { appendFileSync } from "node:fs"; const { LABEL, PORT, X_CLIENT_SECRET, X_CONSUMER_SECRET } = process.env; const hmac = (secret, data) => "sha256=" + crypto.createHmac("sha256", secret).update(data).digest("base64"); const app = express(); app.get("/webhook", (req, res) => { const token = String(req.query.crc_token ?? ""); if (!token) return res.status(400).send("Missing crc_token"); res.json({ response_token: hmac(X_CLIENT_SECRET || X_CONSUMER_SECRET, token) }); }); app.post("/webhook", express.raw({ type: "*/*", limit: "5mb" }), (req, res) => { const valid = [ ["x-twitter-webhooks-signature-oauth2", X_CLIENT_SECRET], ["x-twitter-webhooks-signature", X_CONSUMER_SECRET], ].some(([name, secret]) => { const got = req.get(name); if (!got || !secret) return false; const want = hmac(secret, req.body); return got.length === want.length && crypto.timingSafeEqual(Buffer.from(got), Buffer.from(want)); }); if (!valid) return res.sendStatus(401); appendFileSync(`${LABEL}.jsonl`, JSON.stringify(JSON.parse(req.body.toString("utf8"))) + "\n"); res.sendStatus(200); }); app.listen(PORT); The signature is computed over the raw request bytes, so the POST route uses express.raw instead of express.json. Parsing the body first and re-serializing it would break verification.
Diff by Post ID and by count. Because one AAA key fans out into several XAA types, compare Post IDs for the post family and eyeball counts for the rest. Save this as diff.mjs:
import { readFileSync } from "node:fs"; const read = f => readFileSync(f, "utf8").trim().split("\n").filter(Boolean).map(l => JSON.parse(l)); const bump = (o, k) => (o[k] = (o[k] ?? 0) + 1); const aaaPosts = new Set(), aaaCounts = {}; for (const b of read("aaa.jsonl")) { for (const [key, val] of Object.entries(b)) if (Array.isArray(val)) for (const _ of val) bump(aaaCounts, `${b.for_user_id} ${key}`); for (const t of b.tweet_create_events ?? []) aaaPosts.add(`${b.for_user_id}|${t.id_str}`); } const xaaPosts = new Set(), xaaCounts = {}; for (const { data: d } of read("xaa.jsonl")) { bump(xaaCounts, `${d.filter?.user_id} ${d.event_type}`); if (d.event_type.startsWith("post.") && d.event_type !== "post.delete") xaaPosts.add(`${d.filter.user_id}|${d.payload.id}`); } console.log("Posts only in AAA:", [...aaaPosts].filter(x => !xaaPosts.has(x))); console.log("Posts only in XAA:", [...xaaPosts].filter(x => !aaaPosts.has(x))); console.log("AAA counts:", aaaCounts); console.log("XAA counts:", xaaCounts); This is a starting point, not a finished harness. It matches only the Post family by ID, and a reply that also mentions the user is collapsed into one Post ID even though XAA fires two event types for it. Likes, follows, deletes and DMs are compared by count, and you can tighten each family’s key once you see real payloads. The list to read first is “Posts only in AAA”: missing deep replies, missing protected-account Posts, and any event type you forgot to subscribe to.
Cutover checklist
- Inventory webhooks with
GET /2/webhooks, then list each webhook’s subscribed users withGET /2/account_activity/webhooks/:webhook_id/subscriptions/all/list. - Decide which of the 17 event types each user needs, and check the total against your subscription limit.
- Ship a consumer that accepts both formats before changing anything on X’s side.
- Create XAA subscriptions with
tagvalues you can filter on, confirmGET /2/webhooksshows each webhook as valid, and confirm each user’s events arrive. Include a real deep reply and a protected-account user in your test. - Watch for double delivery while both are active, then delete each AAA subscription with
DELETE /2/account_activity/webhooks/:webhook_id/subscriptions/:user_id/all. - Move recovery jobs to
POST /2/webhooks/replayand test a 24-hour replay window. - Handle
oauth.revokeand clean up state for revoked users. - Plan the OAuth 1.0a to OAuth 2.0 exchange so the next deprecation does not catch you the same way.
Frequently asked questions
Do my users need to re-authorize my app? Not to migrate. XAA accepts existing OAuth 1.0a access tokens, and managed migration moves subscriptions for you. Plan the move to OAuth 2.0 anyway, because X says OAuth 1.0a support in XAA will be deprecated.
Can I keep my current webhook? Yes. Pass your existing webhook_id when creating XAA subscriptions; CRC checks and signatures work the same way.
Can I skip webhooks entirely? Yes. XAA can deliver over GET /2/activity/stream, or over both a webhook and the stream.
Will I get duplicates during the overlap? Yes, for any user with both an AAA and an XAA subscription on the same webhook. Remove the AAA subscription once XAA delivery is verified, or have your handler ignore one format during the overlap.
How far back can I recover missed events? 24 hours with POST /2/webhooks/replay. The stream adds up to 5 minutes of backfill on connect.
What happens to AAA after January 1, 2027? It reaches end of life and is no longer supported.
Sources
- Migrate from the Account Activity API to the X Activity API
- X Activity API introduction
- X Activity API event payloads
- X Activity API quickstart
- Activity stream reference
- Create replay job for webhook
- V2 Webhooks API introduction
- Webhooks quickstart (CRC and signatures)
- X API changelog
- xdevplatform/docs pull request #568: wider reply and mention coverage
- X Developers forum: post.reply.create webhook delivery report
- InstaTunnel package README
Originally published at https://instatunnel.my/blog/x-account-activity-api-ends-january-1-2027-how-to-move-your-webhook-consumer-to-the-x-activity-api
