From 1f8f21e78a768c83f0b094e7012ca14ed27c3344 Mon Sep 17 00:00:00 2001 From: Taylor Caldwell Date: Wed, 2 Dec 2026 21:00:26 +0000 Subject: [PATCH] XAA event payloads: realistic includes for reply/quote/repost, includes guarantees, long-post note --- x-api/activity/event-payloads.mdx | 748 +++++++++++++++++++++++++++--- 1 file changed, 681 insertions(+), 67 deletions(-) diff --git a/x-api/activity/event-payloads.mdx b/x-api/activity/event-payloads.mdx index 10605d392..13c598390 100644 --- a/x-api/activity/event-payloads.mdx +++ b/x-api/activity/event-payloads.mdx @@ -15,7 +15,7 @@ Events delivered by the X Activity API (via the [persistent HTTP stream](/x-api/ | `event_type` | The subscribed event type | | `tag` | Optional tag from your subscription (when set) | | `payload` | Event-specific data | -| `includes` | Optional expanded objects (users, tweets, and so on) when available | +| `includes` | Expanded objects referenced by the `payload` (`users`, `tweets`, `media`). Omitted when there is nothing to include. See [Expanded objects in `includes`](#expanded-objects-in-includes) | ```json title="Event envelope" lines wrap icon="/icons/xds/icon-brackets.svg" { @@ -38,6 +38,19 @@ Payload samples use Mintlify code blocks with titles, line numbers, and wrapping --- +## Expanded objects in `includes` + +`includes` carries objects that the `payload` references, so you don't have to look them up separately. The key is omitted when there is nothing to include; deliveries never contain an empty `includes` object. Resolve objects by the IDs in the `payload` (for example `payload.author_id` → `includes.users[].id`, `payload.referenced_tweets[].id` → `includes.tweets[].id`) rather than by array position. + +| Event | What `includes` contains | +| --- | --- | +| `post.quote.create` | Always contains the quoted Post in `tweets`. | +| `post.repost.create` | Always contains the original (reposted) Post in `tweets`. | +| `post.reply.create` | Contains the Post being replied to in `tweets`, unless that Post is unavailable (for example, deleted or not viewable). In that case it is simply absent, and no error is returned. For a reply deeper in a thread, only the direct parent (`payload.in_reply_to_tweet_id`) is included; use `payload.conversation_id` to retrieve the rest of the conversation. | +| All events | Authors and referenced authors in `users`, and attached media in `media`, are included on a best-effort basis and can be missing. | + +--- + ## Post events ### `post.create` @@ -555,7 +568,7 @@ Fired when another user @mentions the filtered user in the text of a Post, inclu ``` ### `post.reply.create` -Fired when a user other than the filtered user posts a reply that is addressed to the filtered user. This covers direct replies to the filtered user's Posts and replies deeper in a thread that carry the filtered user in their "Replying to" list. Does not fire for reposts; a repost of a reply is delivered to the reply's author as `post.repost.create`. `payload.in_reply_to_user_id` equals the filtered user's ID on a direct reply and is another user's ID on a reply deeper in the thread. Private event — requires user-context authentication with the `tweet.read` scope. The `payload` is a Post object for the reply; `includes` may contain related users and tweets (including the Post being replied to). +Fired when a user other than the filtered user posts a reply that is addressed to the filtered user. This covers direct replies to the filtered user's Posts and replies deeper in a thread that carry the filtered user in their "Replying to" list. Does not fire for reposts; a repost of a reply is delivered to the reply's author as `post.repost.create`. `payload.in_reply_to_user_id` equals the filtered user's ID on a direct reply and is another user's ID on a reply deeper in the thread. Private event — requires user-context authentication with the `tweet.read` scope. The `payload` is a Post object for the reply; `includes` contains related users and tweets, including the Post being replied to when it is available (see [Expanded objects in `includes`](#expanded-objects-in-includes)). ```json title="post.reply.create" expandable lines wrap icon="/icons/xds/icon-brackets.svg" { @@ -619,13 +632,213 @@ Fired when a user other than the filtered user posts a reply that is addressed t "id": "2090000000000000001", "lang": "en" }, - "includes": {} + "includes": { + "users": [ + { + "public_metrics": { + "followers_count": 97, + "followers_count_str": "97", + "following_count": 1, + "following_count_str": "1", + "tweet_count": 50, + "tweet_count_str": "50", + "listed_count": 4, + "listed_count_str": "4", + "like_count": 26, + "like_count_str": "26", + "media_count": 3, + "media_count_str": "3" + }, + "profile_banner_url": "", + "username": "OtherUser", + "protected": false, + "is_identity_verified": false, + "affiliation": { + "badge_url": "https://pbs.twimg.com/semantic_core_img/1428827730364096519/4ZXpTBhS?format=png&name=orig", + "description": "Automated" + }, + "most_recent_tweet_id": "2080765813578191303", + "verified_type": "none", + "description": "", + "created_at": "2026-04-20T19:55:59.000Z", + "profile_image_url": "https://pbs.twimg.com/profile_images/0000000000000000001/example_normal.jpg", + "name": "OtherUser", + "verified": false, + "url": "", + "id": "2222222222222222222" + }, + { + "public_metrics": { + "followers_count": 5502, + "followers_count_str": "5502", + "following_count": 651, + "following_count_str": "651", + "tweet_count": 789, + "tweet_count_str": "789", + "listed_count": 46, + "listed_count_str": "46", + "like_count": 8010, + "like_count_str": "8010", + "media_count": 79, + "media_count_str": "79" + }, + "profile_banner_url": "https://pbs.twimg.com/profile_banners/1111111111111111111/1600000000", + "username": "ExampleUser", + "protected": false, + "is_identity_verified": true, + "affiliation": { + "user_id": [ + "783214" + ], + "badge_url": "https://pbs.twimg.com/profile_images/0000000000000000001/example_normal.jpg", + "url": "https://x.com/X", + "description": "X" + }, + "most_recent_tweet_id": "2080761269309813134", + "verified_type": "blue", + "description": "Building with the X AnotherUser @XDevelopers", + "pinned_tweet_id": "1968451310203859083", + "created_at": "2023-10-23T13:44:53.000Z", + "profile_image_url": "https://pbs.twimg.com/profile_images/0000000000000000001/example_normal.jpg", + "name": "Example User", + "verified": true, + "url": "https://t.co/xxxxxxxx", + "location": "San Francisco, CA", + "id": "1111111111111111111", + "entities": { + "url": { + "urls": [ + { + "start": 0, + "start_str": "0", + "end": 23, + "end_str": "23", + "url": "https://t.co/xxxxxxxx", + "expanded_url": "https://developer.x.com", + "display_url": "developer.x.com" + } + ] + }, + "description": { + "mentions": [ + { + "start": 48, + "start_str": "48", + "end": 50, + "end_str": "50", + "username": "X" + }, + { + "start": 51, + "start_str": "51", + "end": 63, + "end_str": "63", + "username": "XDevelopers" + } + ] + } + } + } + ], + "tweets": [ + { + "paid_partnership": false, + "created_at": "2026-08-12T18:00:00.000Z", + "edit_history_tweet_ids": [ + "2090000000000000001" + ], + "conversation_id": "2080761390344937796", + "in_reply_to_tweet_id": "2080761390344937796", + "in_reply_to_user_id": "1111111111111111111", + "referenced_tweets": [ + { + "type": "replied_to", + "id": "2080761390344937796" + } + ], + "display_text_range": [ + 14, + 45 + ], + "text": "@ExampleUser Great post — thanks for sharing!", + "entities": { + "mentions": [ + { + "start": 0, + "start_str": "0", + "end": 12, + "end_str": "12", + "username": "ExampleUser", + "id": "1111111111111111111" + } + ] + }, + "author_id": "2222222222222222222", + "possibly_sensitive": false, + "public_metrics": { + "retweet_count": 0, + "retweet_count_str": "0", + "reply_count": 0, + "reply_count_str": "0", + "like_count": 0, + "like_count_str": "0", + "quote_count": 0, + "quote_count_str": "0", + "bookmark_count": 0, + "bookmark_count_str": "0", + "impression_count": 0, + "impression_count_str": "0" + }, + "reply_settings": "everyone", + "id": "2090000000000000001", + "lang": "en" + }, + { + "public_metrics": { + "retweet_count": 0, + "retweet_count_str": "0", + "reply_count": 0, + "reply_count_str": "0", + "like_count": 0, + "like_count_str": "0", + "quote_count": 0, + "quote_count_str": "0", + "bookmark_count": 0, + "bookmark_count_str": "0", + "impression_count": 0, + "impression_count_str": "0" + }, + "lang": "en", + "created_at": "2026-07-24T21:05:48.000Z", + "author_id": "1111111111111111111", + "reply_settings": "everyone", + "display_text_range": [ + 0, + 34 + ], + "paid_partnership": false, + "id": "2080761390344937796", + "possibly_sensitive": false, + "edit_history_tweet_ids": [ + "2080761390344937796" + ], + "conversation_id": "2080761390344937796", + "text": "Hello from the Activity API", + "edit_controls": { + "edits_remaining": 5, + "edits_remaining_str": "5", + "is_edit_eligible": true, + "editable_until": "2026-07-24T22:05:48.000Z" + } + } + ] + } } } ``` ### `post.quote.create` -Fired when a user other than the filtered user quote Posts a Post by the filtered user. Direct quotes only (does not fire for quotes of quotes). Private event — requires user-context authentication with the `tweet.read` scope. The `payload` is a Post object for the quote; `referenced_tweets` identifies the quoted Post. +Fired when a user other than the filtered user quote Posts a Post by the filtered user. Direct quotes only (does not fire for quotes of quotes). Private event — requires user-context authentication with the `tweet.read` scope. The `payload` is a Post object for the quote; `referenced_tweets` identifies the quoted Post, and `includes.tweets` always contains it. ```json title="post.quote.create" expandable lines wrap icon="/icons/xds/icon-brackets.svg" { @@ -688,79 +901,480 @@ Fired when a user other than the filtered user quote Posts a Post by the filtere "id": "2090000000000000002", "lang": "en" }, - "includes": {} - } -} -``` -### `post.repost.create` - -Fired when a user other than the filtered user reposts a Post by the filtered user. Private event — requires user-context authentication with the `tweet.read` scope. The `payload` is a Post object for the repost; `referenced_tweets` with `type: "retweeted"` identifies the original Post. - -```json title="post.repost.create" expandable lines wrap icon="/icons/xds/icon-brackets.svg" -{ - "data": { - "event_uuid": "5283049576128394756", - "created_at": "2026-10-07T19:17:36.304Z", - "filter": { - "user_id": "1111111111111111111" - }, - "event_type": "post.repost.create", - "tag": "reposts", - "payload": { - "paid_partnership": false, - "created_at": "2026-08-12T18:10:00.000Z", - "edit_history_tweet_ids": [ - "2090000000000000003" - ], - "conversation_id": "2090000000000000003", - "referenced_tweets": [ + "includes": { + "users": [ { - "type": "retweeted", - "id": "2080761390344937796" - } - ], - "display_text_range": [ - 0, - 56 - ], - "text": "RT @ExampleUser: Hello from the Activity API", - "entities": { - "mentions": [ - { - "start": 3, - "start_str": "3", - "end": 15, - "end_str": "15", - "username": "ExampleUser", - "id": "1111111111111111111" - } - ] - }, - "author_id": "2222222222222222222", - "possibly_sensitive": false, - "public_metrics": { - "retweet_count": 0, - "retweet_count_str": "0", - "reply_count": 0, - "reply_count_str": "0", - "like_count": 0, - "like_count_str": "0", - "quote_count": 0, - "quote_count_str": "0", - "bookmark_count": 0, - "bookmark_count_str": "0", - "impression_count": 0, - "impression_count_str": "0" + "public_metrics": { + "followers_count": 97, + "followers_count_str": "97", + "following_count": 1, + "following_count_str": "1", + "tweet_count": 50, + "tweet_count_str": "50", + "listed_count": 4, + "listed_count_str": "4", + "like_count": 26, + "like_count_str": "26", + "media_count": 3, + "media_count_str": "3" + }, + "profile_banner_url": "", + "username": "OtherUser", + "protected": false, + "is_identity_verified": false, + "affiliation": { + "badge_url": "https://pbs.twimg.com/semantic_core_img/1428827730364096519/4ZXpTBhS?format=png&name=orig", + "description": "Automated" + }, + "most_recent_tweet_id": "2080765813578191303", + "verified_type": "none", + "description": "", + "created_at": "2026-04-20T19:55:59.000Z", + "profile_image_url": "https://pbs.twimg.com/profile_images/0000000000000000001/example_normal.jpg", + "name": "OtherUser", + "verified": false, + "url": "", + "id": "2222222222222222222" + }, + { + "public_metrics": { + "followers_count": 5502, + "followers_count_str": "5502", + "following_count": 651, + "following_count_str": "651", + "tweet_count": 789, + "tweet_count_str": "789", + "listed_count": 46, + "listed_count_str": "46", + "like_count": 8010, + "like_count_str": "8010", + "media_count": 79, + "media_count_str": "79" + }, + "profile_banner_url": "https://pbs.twimg.com/profile_banners/1111111111111111111/1600000000", + "username": "ExampleUser", + "protected": false, + "is_identity_verified": true, + "affiliation": { + "user_id": [ + "783214" + ], + "badge_url": "https://pbs.twimg.com/profile_images/0000000000000000001/example_normal.jpg", + "url": "https://x.com/X", + "description": "X" + }, + "most_recent_tweet_id": "2080761269309813134", + "verified_type": "blue", + "description": "Building with the X AnotherUser @XDevelopers", + "pinned_tweet_id": "1968451310203859083", + "created_at": "2023-10-23T13:44:53.000Z", + "profile_image_url": "https://pbs.twimg.com/profile_images/0000000000000000001/example_normal.jpg", + "name": "Example User", + "verified": true, + "url": "https://t.co/xxxxxxxx", + "location": "San Francisco, CA", + "id": "1111111111111111111", + "entities": { + "url": { + "urls": [ + { + "start": 0, + "start_str": "0", + "end": 23, + "end_str": "23", + "url": "https://t.co/xxxxxxxx", + "expanded_url": "https://developer.x.com", + "display_url": "developer.x.com" + } + ] + }, + "description": { + "mentions": [ + { + "start": 48, + "start_str": "48", + "end": 50, + "end_str": "50", + "username": "X" + }, + { + "start": 51, + "start_str": "51", + "end": 63, + "end_str": "63", + "username": "XDevelopers" + } + ] + } + } + } + ], + "tweets": [ + { + "paid_partnership": false, + "created_at": "2026-08-12T18:05:00.000Z", + "edit_history_tweet_ids": [ + "2090000000000000002" + ], + "conversation_id": "2090000000000000002", + "referenced_tweets": [ + { + "type": "quoted", + "id": "2080761390344937796" + } + ], + "display_text_range": [ + 0, + 29 + ], + "text": "Adding some context to this. https://t.co/xxxxxxxx", + "entities": { + "urls": [ + { + "start": 29, + "start_str": "29", + "end": 52, + "end_str": "52", + "url": "https://t.co/xxxxxxxx", + "expanded_url": "https://x.com/ExampleUser/status/2080761390344937796", + "display_url": "x.com/ExampleUser/st…" + } + ] + }, + "author_id": "2222222222222222222", + "possibly_sensitive": false, + "public_metrics": { + "retweet_count": 0, + "retweet_count_str": "0", + "reply_count": 0, + "reply_count_str": "0", + "like_count": 0, + "like_count_str": "0", + "quote_count": 0, + "quote_count_str": "0", + "bookmark_count": 0, + "bookmark_count_str": "0", + "impression_count": 0, + "impression_count_str": "0" + }, + "reply_settings": "everyone", + "id": "2090000000000000002", + "lang": "en" + }, + { + "public_metrics": { + "retweet_count": 0, + "retweet_count_str": "0", + "reply_count": 0, + "reply_count_str": "0", + "like_count": 0, + "like_count_str": "0", + "quote_count": 0, + "quote_count_str": "0", + "bookmark_count": 0, + "bookmark_count_str": "0", + "impression_count": 0, + "impression_count_str": "0" + }, + "lang": "en", + "created_at": "2026-07-24T21:05:48.000Z", + "author_id": "1111111111111111111", + "reply_settings": "everyone", + "display_text_range": [ + 0, + 34 + ], + "paid_partnership": false, + "id": "2080761390344937796", + "possibly_sensitive": false, + "edit_history_tweet_ids": [ + "2080761390344937796" + ], + "conversation_id": "2080761390344937796", + "text": "Hello from the Activity API", + "edit_controls": { + "edits_remaining": 5, + "edits_remaining_str": "5", + "is_edit_eligible": true, + "editable_until": "2026-07-24T22:05:48.000Z" + } + } + ] + } + } +} +``` +### `post.repost.create` + +Fired when a user other than the filtered user reposts a Post by the filtered user. Private event — requires user-context authentication with the `tweet.read` scope. The `payload` is a Post object for the repost; `referenced_tweets` with `type: "retweeted"` identifies the original Post, and `includes.tweets` always contains it. + +```json title="post.repost.create" expandable lines wrap icon="/icons/xds/icon-brackets.svg" +{ + "data": { + "event_uuid": "5283049576128394756", + "created_at": "2026-10-07T19:17:36.304Z", + "filter": { + "user_id": "1111111111111111111" + }, + "event_type": "post.repost.create", + "tag": "reposts", + "payload": { + "paid_partnership": false, + "created_at": "2026-08-12T18:10:00.000Z", + "edit_history_tweet_ids": [ + "2090000000000000003" + ], + "conversation_id": "2090000000000000003", + "referenced_tweets": [ + { + "type": "retweeted", + "id": "2080761390344937796" + } + ], + "display_text_range": [ + 0, + 56 + ], + "text": "RT @ExampleUser: Hello from the Activity API", + "entities": { + "mentions": [ + { + "start": 3, + "start_str": "3", + "end": 15, + "end_str": "15", + "username": "ExampleUser", + "id": "1111111111111111111" + } + ] + }, + "author_id": "2222222222222222222", + "possibly_sensitive": false, + "public_metrics": { + "retweet_count": 0, + "retweet_count_str": "0", + "reply_count": 0, + "reply_count_str": "0", + "like_count": 0, + "like_count_str": "0", + "quote_count": 0, + "quote_count_str": "0", + "bookmark_count": 0, + "bookmark_count_str": "0", + "impression_count": 0, + "impression_count_str": "0" }, "reply_settings": "everyone", "id": "2090000000000000003", "lang": "en" }, - "includes": {} + "includes": { + "users": [ + { + "public_metrics": { + "followers_count": 97, + "followers_count_str": "97", + "following_count": 1, + "following_count_str": "1", + "tweet_count": 50, + "tweet_count_str": "50", + "listed_count": 4, + "listed_count_str": "4", + "like_count": 26, + "like_count_str": "26", + "media_count": 3, + "media_count_str": "3" + }, + "profile_banner_url": "", + "username": "OtherUser", + "protected": false, + "is_identity_verified": false, + "affiliation": { + "badge_url": "https://pbs.twimg.com/semantic_core_img/1428827730364096519/4ZXpTBhS?format=png&name=orig", + "description": "Automated" + }, + "most_recent_tweet_id": "2080765813578191303", + "verified_type": "none", + "description": "", + "created_at": "2026-04-20T19:55:59.000Z", + "profile_image_url": "https://pbs.twimg.com/profile_images/0000000000000000001/example_normal.jpg", + "name": "OtherUser", + "verified": false, + "url": "", + "id": "2222222222222222222" + }, + { + "public_metrics": { + "followers_count": 5502, + "followers_count_str": "5502", + "following_count": 651, + "following_count_str": "651", + "tweet_count": 789, + "tweet_count_str": "789", + "listed_count": 46, + "listed_count_str": "46", + "like_count": 8010, + "like_count_str": "8010", + "media_count": 79, + "media_count_str": "79" + }, + "profile_banner_url": "https://pbs.twimg.com/profile_banners/1111111111111111111/1600000000", + "username": "ExampleUser", + "protected": false, + "is_identity_verified": true, + "affiliation": { + "user_id": [ + "783214" + ], + "badge_url": "https://pbs.twimg.com/profile_images/0000000000000000001/example_normal.jpg", + "url": "https://x.com/X", + "description": "X" + }, + "most_recent_tweet_id": "2080761269309813134", + "verified_type": "blue", + "description": "Building with the X AnotherUser @XDevelopers", + "pinned_tweet_id": "1968451310203859083", + "created_at": "2023-10-23T13:44:53.000Z", + "profile_image_url": "https://pbs.twimg.com/profile_images/0000000000000000001/example_normal.jpg", + "name": "Example User", + "verified": true, + "url": "https://t.co/xxxxxxxx", + "location": "San Francisco, CA", + "id": "1111111111111111111", + "entities": { + "url": { + "urls": [ + { + "start": 0, + "start_str": "0", + "end": 23, + "end_str": "23", + "url": "https://t.co/xxxxxxxx", + "expanded_url": "https://developer.x.com", + "display_url": "developer.x.com" + } + ] + }, + "description": { + "mentions": [ + { + "start": 48, + "start_str": "48", + "end": 50, + "end_str": "50", + "username": "X" + }, + { + "start": 51, + "start_str": "51", + "end": 63, + "end_str": "63", + "username": "XDevelopers" + } + ] + } + } + } + ], + "tweets": [ + { + "paid_partnership": false, + "created_at": "2026-08-12T18:10:00.000Z", + "edit_history_tweet_ids": [ + "2090000000000000003" + ], + "conversation_id": "2090000000000000003", + "referenced_tweets": [ + { + "type": "retweeted", + "id": "2080761390344937796" + } + ], + "display_text_range": [ + 0, + 56 + ], + "text": "RT @ExampleUser: Hello from the Activity API", + "entities": { + "mentions": [ + { + "start": 3, + "start_str": "3", + "end": 15, + "end_str": "15", + "username": "ExampleUser", + "id": "1111111111111111111" + } + ] + }, + "author_id": "2222222222222222222", + "possibly_sensitive": false, + "public_metrics": { + "retweet_count": 0, + "retweet_count_str": "0", + "reply_count": 0, + "reply_count_str": "0", + "like_count": 0, + "like_count_str": "0", + "quote_count": 0, + "quote_count_str": "0", + "bookmark_count": 0, + "bookmark_count_str": "0", + "impression_count": 0, + "impression_count_str": "0" + }, + "reply_settings": "everyone", + "id": "2090000000000000003", + "lang": "en" + }, + { + "public_metrics": { + "retweet_count": 0, + "retweet_count_str": "0", + "reply_count": 0, + "reply_count_str": "0", + "like_count": 0, + "like_count_str": "0", + "quote_count": 0, + "quote_count_str": "0", + "bookmark_count": 0, + "bookmark_count_str": "0", + "impression_count": 0, + "impression_count_str": "0" + }, + "lang": "en", + "created_at": "2026-07-24T21:05:48.000Z", + "author_id": "1111111111111111111", + "reply_settings": "everyone", + "display_text_range": [ + 0, + 34 + ], + "paid_partnership": false, + "id": "2080761390344937796", + "possibly_sensitive": false, + "edit_history_tweet_ids": [ + "2080761390344937796" + ], + "conversation_id": "2080761390344937796", + "text": "Hello from the Activity API", + "edit_controls": { + "edits_remaining": 5, + "edits_remaining_str": "5", + "is_edit_eligible": true, + "editable_until": "2026-07-24T22:05:48.000Z" + } + } + ] + } } } ``` + +**Long Posts:** For posts over 280 characters, the full text and entities are in `payload.note_tweet`; top-level `text` is shortened. + + **Protected accounts:** Posts from protected accounts are not delivered through XAA, even when the subscribing app has user-context authorization for the filtered user.