Search public X posts with composable filters

POST /v1/x/search

Searches public X (Twitter) posts by keyword, phrase, account, hashtag, language, date and engagement. Every filter narrows the result, and at least one of query, phrase, hashtags, fromUsers, toUsers, mentions, listId, or quotedPostId is required. Paginate with meta.nextCursor. X's latest results can stop before the posts do, so where its own pages end, the next page searches again below the oldest post returned; the last page can come back empty. Billed per post returned.

Price: 1 credit per call, plus 1 credit per X post returned. Failed and refused calls cost nothing.

Rate limit: Counts as 2 requests against your per-minute rate limit.

MCP tool: search_x, on every MCP connection.

Requires an API key, sent as Authorization: Bearer <key>.

Request

curl --request POST \
  --url https://api.weirapp.io/v1/x/search \
  --header "Authorization: Bearer $WEIR_API_KEY" \
  --header 'Content-Type: application/json' \
  --data '{}'

Body

Field Type Required Notes
query string no Words that must all appear, in any order. X search operators pass through as typed, so filters without a field of their own work here: filter:media, url:example.com, conversation_id:123, -filter:replies. since: and until: dates count whole UTC days, until: including its own, the same as the since and until fields. A full-width colon or minus (filter:videos, -word) is read as the plain one. · 1–200 chars
phrase string no An exact phrase that must appear. · 1–200 chars
anyWords array of string no At least one of these words must appear.
excludeWords array of string no None of these words may appear.
hashtags array of string no Posts carrying any of these hashtags, with or without the # (a full-width # works too). X also matches posts that only have the words, so those are left out: a page can come back with fewer posts than limit, and meta.nextCursor still leads on.
fromUsers array of string no Posted by any of these usernames.
toUsers array of string no Replying to any of these usernames.
mentions array of string no Mentioning any of these usernames.
language string no Language X detected, as a BCP-47 tag such as en. Indonesian (id) and Hebrew (he) are searched by the codes X still uses, in and iw, which is also what posts carry in lang. A region is dropped: pt-BR searches Portuguese. · 2–12 chars
minLikes integer no min 0
minReplies integer no min 0
minReposts integer no min 0
onlyLinks boolean no Only posts containing a link.
onlyOriginal boolean no Exclude replies.
onlyReplies boolean no Only replies.
onlyText boolean no Exclude posts with links, media or a quoted post. X applies this loosely, so posts it lets through are left out: a page can hold fewer posts than limit while meta.nextCursor still leads on.
since string (date-time) no Posted at or after this instant: ISO 8601 with Z or an offset, such as 2026-10-22T00:00:00+09:00. Exact to the millisecond.
until string (date-time) no Posted before this instant: ISO 8601 with Z or an offset.
quotedPostId string no Only posts quoting this post. getXQuotes is the dedicated endpoint for this. · matches ^\d{1,19}$
listId string no Only posts by members of this public List. · matches ^\d{1,19}$
sinceId string no Only posts newer than this post id, exclusive. The way to resume a feed: pass the newest id already seen. · matches ^\d{1,19}$
untilId string no Only posts older than this post id, exclusive. · matches ^\d{1,19}$
sort string no latest is newest first; top is X's own engagement ranking. · latest, top, default "latest"
limit integer no Most posts to return. X serves about 20 per page at most. · 1–100, default 25
cursor string no Opaque cursor from the previous page's meta.nextCursor. Pass it back unchanged, with the same path and query parameters; a cursor from another request is rejected with 400. · 1–4096 chars

Response

X posts, in X's own field names.

200

Field Type Required Notes
data array of object yes
data[].id string yes Numeric post id, as a string. It exceeds 2^53.
data[].text string yes Full post text, untruncated.
data[].url string yes
data[].lang string or null yes BCP-47 language tag detected by X.
data[].createdAt string (date-time) yes
data[].conversationId string or null yes The thread this post belongs to.
data[].inReplyToId string or null yes
data[].author object yes
data[].author.id string yes
data[].author.username string yes
data[].author.name string yes
data[].author.verified boolean yes
data[].author.followersCount integer yes min 0
data[].author.profileImageUrl string or null yes
data[].likeCount integer or null yes min 0
data[].retweetCount integer or null yes min 0
data[].replyCount integer or null yes min 0
data[].viewCount integer or null yes min 0
data[].quoteCount integer or null yes min 0
data[].bookmarkCount integer or null yes min 0
data[].media array of object yes Attached photos, videos, and GIFs, in display order.
data[].media[].id string yes
data[].media[].type string yes X's own media type names. · photo, video, animated_gif
data[].media[].url string or null yes The original upload for a photo (name=orig, full size); the highest-bitrate MP4 for a video or GIF. Null when X offers only a stream.
data[].media[].previewImageUrl string or null yes Poster frame for a video. Null for photos and GIFs.
data[].entities object yes
data[].entities.hashtags array of string yes Hashtags, without the #.
data[].entities.mentions array of string yes Mentioned usernames, without the @.
data[].entities.urls array of string yes Expanded link targets, not t.co short links.
data[].article object or null yes Set when the post is an X Article; its text is then only a link to it.
data[].article.id string yes The Article's own id, distinct from the id of the post carrying it.
data[].article.url string yes
data[].article.title string yes
data[].article.previewText string or null yes The opening lines X shows in a feed.
data[].article.coverImage object or null yes
data[].article.coverImage.id string yes X's media id; blocks refer to media by this id.
data[].article.coverImage.type string yes X's own media type names. · photo, video, animated_gif
data[].article.coverImage.url string or null yes The original image for a photo; the highest-bitrate MP4 for a video or GIF. Null when X offers only a stream.
data[].article.coverImage.width integer or null yes
data[].article.coverImage.height integer or null yes
data[].article.publishedAt string or null yes
data[].article.updatedAt string or null yes
data[].article.text string or null yes The full body as plain text. Null in lists of posts, where X sends only the preview: get the post, or its article, for the body.
data[].article.markdown string or null yes The full body as Markdown — headings, emphasis, lists, quotes, code, links, images, and embedded posts — for reading or for a model. Null wherever text is.
data[].article.blocks array of object or null yes The body in X's own block structure. Null wherever text is.
data[].article.blocks[].type string yes X's block type: unstyled (paragraph), header-one, header-two, header-three, unordered-list-item, ordered-list-item, blockquote, code-block, or atomic (an embed: see entities).
data[].article.blocks[].text string yes
data[].article.blocks[].depth integer yes Nesting level for list items; 0 otherwise. · min 0
data[].article.blocks[].styles array of object yes Inline styles over spans of text.
data[].article.blocks[].entities array of object yes Links and embeds attached to spans of text.
data[].article.media array of object yes Images and videos in the body, in order. Empty in lists of posts.
data[].article.media[].id string yes X's media id; blocks refer to media by this id.
data[].article.media[].type string yes X's own media type names. · photo, video, animated_gif
data[].article.media[].url string or null yes The original image for a photo; the highest-bitrate MP4 for a video or GIF. Null when X offers only a stream.
data[].article.media[].width integer or null yes
data[].article.media[].height integer or null yes
data[].quotedPost object or null yes The post this one quotes, when it is a quote post.
data[].quotedPost.id string yes Numeric post id, as a string. It exceeds 2^53.
data[].quotedPost.text string yes Full post text, untruncated.
data[].quotedPost.url string yes
data[].quotedPost.lang string or null yes BCP-47 language tag detected by X.
data[].quotedPost.createdAt string (date-time) yes
data[].quotedPost.conversationId string or null yes The thread this post belongs to.
data[].quotedPost.inReplyToId string or null yes
data[].quotedPost.author object yes
data[].quotedPost.author.id string yes
data[].quotedPost.author.username string yes
data[].quotedPost.author.name string yes
data[].quotedPost.author.verified boolean yes
data[].quotedPost.author.followersCount integer yes min 0
data[].quotedPost.author.profileImageUrl string or null yes
data[].quotedPost.likeCount integer or null yes min 0
data[].quotedPost.retweetCount integer or null yes min 0
data[].quotedPost.replyCount integer or null yes min 0
data[].quotedPost.viewCount integer or null yes min 0
data[].quotedPost.quoteCount integer or null yes min 0
data[].quotedPost.bookmarkCount integer or null yes min 0
data[].quotedPost.media array of object yes Attached photos, videos, and GIFs, in display order.
data[].quotedPost.media[].id string yes
data[].quotedPost.media[].type string yes X's own media type names. · photo, video, animated_gif
data[].quotedPost.media[].url string or null yes The original upload for a photo (name=orig, full size); the highest-bitrate MP4 for a video or GIF. Null when X offers only a stream.
data[].quotedPost.media[].previewImageUrl string or null yes Poster frame for a video. Null for photos and GIFs.
data[].quotedPost.entities object yes
data[].quotedPost.entities.hashtags array of string yes Hashtags, without the #.
data[].quotedPost.entities.mentions array of string yes Mentioned usernames, without the @.
data[].quotedPost.entities.urls array of string yes Expanded link targets, not t.co short links.
data[].quotedPost.article object or null yes Set when the post is an X Article; its text is then only a link to it.
data[].quotedPost.article.id string yes The Article's own id, distinct from the id of the post carrying it.
data[].quotedPost.article.url string yes
data[].quotedPost.article.title string yes
data[].quotedPost.article.previewText string or null yes The opening lines X shows in a feed.
data[].quotedPost.article.coverImage object or null yes
data[].quotedPost.article.publishedAt string or null yes
data[].quotedPost.article.updatedAt string or null yes
data[].quotedPost.article.text string or null yes The full body as plain text. Null in lists of posts, where X sends only the preview: get the post, or its article, for the body.
data[].quotedPost.article.markdown string or null yes The full body as Markdown — headings, emphasis, lists, quotes, code, links, images, and embedded posts — for reading or for a model. Null wherever text is.
data[].quotedPost.article.blocks array of object or null yes The body in X's own block structure. Null wherever text is.
data[].quotedPost.article.media array of object yes Images and videos in the body, in order. Empty in lists of posts.
data[].retweetedPost object or null yes Set when this post is a repost. Read the original's text and counts here: X truncates a repost's own text to RT @user: ….
data[].retweetedPost.id string yes Numeric post id, as a string. It exceeds 2^53.
data[].retweetedPost.text string yes Full post text, untruncated.
data[].retweetedPost.url string yes
data[].retweetedPost.lang string or null yes BCP-47 language tag detected by X.
data[].retweetedPost.createdAt string (date-time) yes
data[].retweetedPost.conversationId string or null yes The thread this post belongs to.
data[].retweetedPost.inReplyToId string or null yes
data[].retweetedPost.author object yes
data[].retweetedPost.author.id string yes
data[].retweetedPost.author.username string yes
data[].retweetedPost.author.name string yes
data[].retweetedPost.author.verified boolean yes
data[].retweetedPost.author.followersCount integer yes min 0
data[].retweetedPost.author.profileImageUrl string or null yes
data[].retweetedPost.likeCount integer or null yes min 0
data[].retweetedPost.retweetCount integer or null yes min 0
data[].retweetedPost.replyCount integer or null yes min 0
data[].retweetedPost.viewCount integer or null yes min 0
data[].retweetedPost.quoteCount integer or null yes min 0
data[].retweetedPost.bookmarkCount integer or null yes min 0
data[].retweetedPost.media array of object yes Attached photos, videos, and GIFs, in display order.
data[].retweetedPost.media[].id string yes
data[].retweetedPost.media[].type string yes X's own media type names. · photo, video, animated_gif
data[].retweetedPost.media[].url string or null yes The original upload for a photo (name=orig, full size); the highest-bitrate MP4 for a video or GIF. Null when X offers only a stream.
data[].retweetedPost.media[].previewImageUrl string or null yes Poster frame for a video. Null for photos and GIFs.
data[].retweetedPost.entities object yes
data[].retweetedPost.entities.hashtags array of string yes Hashtags, without the #.
data[].retweetedPost.entities.mentions array of string yes Mentioned usernames, without the @.
data[].retweetedPost.entities.urls array of string yes Expanded link targets, not t.co short links.
data[].retweetedPost.article object or null yes Set when the post is an X Article; its text is then only a link to it.
data[].retweetedPost.article.id string yes The Article's own id, distinct from the id of the post carrying it.
data[].retweetedPost.article.url string yes
data[].retweetedPost.article.title string yes
data[].retweetedPost.article.previewText string or null yes The opening lines X shows in a feed.
data[].retweetedPost.article.coverImage object or null yes
data[].retweetedPost.article.publishedAt string or null yes
data[].retweetedPost.article.updatedAt string or null yes
data[].retweetedPost.article.text string or null yes The full body as plain text. Null in lists of posts, where X sends only the preview: get the post, or its article, for the body.
data[].retweetedPost.article.markdown string or null yes The full body as Markdown — headings, emphasis, lists, quotes, code, links, images, and embedded posts — for reading or for a model. Null wherever text is.
data[].retweetedPost.article.blocks array of object or null yes The body in X's own block structure. Null wherever text is.
data[].retweetedPost.article.media array of object yes Images and videos in the body, in order. Empty in lists of posts.
meta object yes
meta.requestId string yes
meta.nextCursor string or null no

Errors

Status Meaning What to do
400 The request failed validation. The request was malformed. The details object names the field.
401 The API key is missing, malformed, expired, or revoked. The key is missing, malformed, revoked, or expired.
402 The account is out of credits. Not retryable. The message names the day free credits return and the price of the smallest pack; details carries buyUrl, smallestPack and freeCreditsRenewAt. Out of credits. Never retry. It clears in two ways only: the month's free credits return on the 1st (UTC), or a person adds credits at https://weirapp.io/buy (from $5). Retrying never works.
403 The API key does not carry the scope this route requires. The key is valid but lacks the scope this operation needs.
404 The requested resource does not exist. No such resource, or it is not public.
429 The per-minute rate limit is exhausted. Retryable: wait for Retry-After and try again. Rate limited. Retryable: wait for Retry-After, then try again.
500 An unexpected error occurred. Something failed on our side. Retryable with backoff.
503 The source is busy or temporarily unavailable. Retryable: wait for Retry-After and try again. A source was busy or unreachable. Retryable: wait for Retry-After, then try again.

View this page as Markdown