From e70632033f91335fe2d3250f2f74c412c580b0de Mon Sep 17 00:00:00 2001 From: Taylor Caldwell Date: Wed, 2 Dec 2026 01:47:15 +0000 Subject: [PATCH] Document search URL size limit, long-post matching, and AAA delivery timing Signed-off-by: Taylor Caldwell --- x-api/account-activity/introduction.mdx | 6 ++++ .../integrate/build-a-rule.mdx | 8 +++++ .../posts/search/integrate/build-a-query.mdx | 31 +++++++++++++++++++ x-api/posts/search/integrate/overview.mdx | 4 +++ 4 files changed, 49 insertions(+) diff --git a/x-api/account-activity/introduction.mdx b/x-api/account-activity/introduction.mdx index aea32003e..9ac8f56c6 100644 --- a/x-api/account-activity/introduction.mdx +++ b/x-api/account-activity/introduction.mdx @@ -571,6 +571,12 @@ This ensures that applications can process the entire content of longform posts, Yes. If your app has subscriptions for User A and User B, and User A mentions User B in a Post, your webhook receives two events (one per user). Use the `for_user_id` field to identify the subscription. + + Whether a Post event is delivered is decided once, when the Post is created, based on the Post's visibility and the author's account state at that moment. If the author's account is protected or temporarily restricted when the Post is created, the event is delivered only for subscribed users who are allowed to see it, such as the author's approved followers. + + This isn't re-evaluated later. If the author's account becomes public afterward, events for Posts created while it was protected or restricted are not sent. You can still retrieve those Posts with [Post lookup](/x-api/posts/lookup/introduction) once they're visible. + + No. The `/all/` product is the only option, delivering all supported event types. diff --git a/x-api/posts/filtered-stream/integrate/build-a-rule.mdx b/x-api/posts/filtered-stream/integrate/build-a-rule.mdx index 6dd83438d..2b4348625 100644 --- a/x-api/posts/filtered-stream/integrate/build-a-rule.mdx +++ b/x-api/posts/filtered-stream/integrate/build-a-rule.mdx @@ -116,6 +116,14 @@ When [building search queries](/x-api/posts/search/integrate/build-a-query), key --- +## Long posts + +Rules are matched against a Post's `text` field. For long posts (more than 280 characters), `text` contains only the first ~280 characters, so keywords, phrases, hashtags, and other text that appear only after that point do not match your rules. + +To receive the full text of a long post that matches, add `tweet.fields=note_tweet` to your stream connection. The full text is returned in `note_tweet.text`, but it is not used for matching. + +--- + ## Quote Tweet matching When using filtered stream, operators match on both the Quote Tweet's content **and** the content from the original Post that was quoted. diff --git a/x-api/posts/search/integrate/build-a-query.mdx b/x-api/posts/search/integrate/build-a-query.mdx index b6fdd9136..6ad3ab7e1 100644 --- a/x-api/posts/search/integrate/build-a-query.mdx +++ b/x-api/posts/search/integrate/build-a-query.mdx @@ -18,6 +18,29 @@ Your queries will be limited depending on which [access level](/x-api/getting-st | Self-serve | 512 characters | 1,024 characters | | Enterprise | 4,096 characters | 4,096 characters | +### Request size + +Search requests are sent with GET, so the query and all other parameters are part of the URL. In addition to the character limits above, the full percent-encoded URL (path, `query`, fields, expansions, and any other parameters) must stay under about **16 KB**. Requests over this size are rejected with `414 URI Too Long` or `431 Request Header Fields Too Large`. Both mean the request itself is too large, not that the query is invalid. + +The query limit is counted in characters, but the URL size is counted in bytes after UTF-8 percent-encoding. Most non-ASCII characters take several bytes once encoded: + +| Character type | Example | Encoded size | +| :--- | :--- | :--- | +| ASCII letters and digits | `a`, `7` | 1 byte | +| Space | (space) | 3 bytes as `%20`, 1 byte as `+` | +| Quotes, parentheses, colons | `"`, `(`, `:` | 3 bytes | +| Accented Latin letters | `é` | 6 bytes | +| Chinese, Japanese, and Korean characters | `東` | 9 bytes | +| Emoji | `😀` | 12 bytes | + +For example, about 1,700 Japanese characters already encode to more than 15 KB, so a 4,096-character Japanese query cannot be sent in a single request. + +If your request is too large: + +* Encode spaces as `+` instead of `%20`. +* Split long `OR` lists across several requests with the same time window, then de-duplicate results by Post `id`. +* Request only the `tweet.fields`, `user.fields`, `expansions`, and other fields you use. + --- ## Operator availability @@ -122,6 +145,14 @@ When [building filtered stream rules](/x-api/posts/filtered-stream/integrate/bui --- +## Long posts + +Search queries are matched against a Post's `text` field. For long posts (more than 280 characters), `text` contains only the first ~280 characters, so keywords, phrases, hashtags, and other text that appear only after that point are not matched. + +To get the full text of a long post in the response, request `tweet.fields=note_tweet`. The full text is returned in `note_tweet.text`, but it is not used for matching. + +--- + ## Quote Tweet matching When using Search Posts, operators match on the Quote Tweet's content but **not** on the content from the original Post that was quoted. diff --git a/x-api/posts/search/integrate/overview.mdx b/x-api/posts/search/integrate/overview.mdx index da41bf440..51482c880 100644 --- a/x-api/posts/search/integrate/overview.mdx +++ b/x-api/posts/search/integrate/overview.mdx @@ -46,6 +46,10 @@ Queries use operators to match Posts. Combine operators with boolean logic: | Self-serve | 512 chars | 1,024 chars | | Enterprise | 4,096 chars | 4,096 chars | + +These limits count characters. The full percent-encoded request URL must also stay under about 16 KB, which non-ASCII queries can reach well before the character limit. Long posts are matched only on their first ~280 characters. See [Build a query](/x-api/posts/search/integrate/build-a-query#request-size) for details. + + ### Operator types | Type | Description | Example |