Back to Hub

X Search Tweets

HTTP Official API

Search recent tweets on X (Twitter) using the X API v2. Returns tweets matching a query with author info and engagement metrics.

Tony CostanzoTony Costanzo
0 installs
v1.0.0
Mar 31, 2026
Workspace secrets required
This tool references workspace secrets. After installing, you'll need to configure the required secrets in Settings → Integrations and create a new secret for the tool to work.

X Search Tweets

Official Search recent tweets on X (Twitter) and get structured results with engagement metrics.

What this tool does: Searches the X (Twitter) platform for recent tweets matching a query using the X API v2. Returns tweet text, author info (name, username, verified status), timestamps, and public engagement metrics (likes, retweets, replies). Supports X's full search operator syntax for precise filtering.

Setup

Get an X API Bearer Token

  1. Go to the X Developer Portal and create a developer account
  2. Create a new project and app
  3. Generate a Bearer Token from your app's "Keys and Tokens" page

Add workspace secret

Go to Settings → Integrations and add a new secret:

Secret NameDescription
X_API_KEYYour X API v2 Bearer Token
Never paste API keys directly into tool definitions. Always use workspace secrets.

Parameters

ParameterRequiredDescription
queryYesSearch query — supports operators like from:user, #hashtag, -exclude, lang:en
max_resultsNoNumber of tweets to return (10-100, default: 10)

Example Prompts

Try these with your agent:

  • "Search X for what people are saying about our product launch"
  • "Find recent tweets from @elaboratescotch about AI"
  • "Look up tweets mentioning #buildinpublic from the last few days"
  • "Search Twitter for complaints about Vercel pricing"

Notes

Tip: The X API v2 recent search endpoint returns tweets from the last 7 days. Use search operators to narrow results — e.g., "exact phrase", -is:retweet to exclude retweets, or has:links to find tweets with URLs.

Tool Definition

Input Parameters

querystringSearch query for tweets. Supports X search operators like 'from:user', '#hashtag', 'keyword -exclude', 'lang:en', etc.
max_resultsnumberNumber of tweets to return (10-100). Defaults to 10 if omitted.

HTTP Configuration

Method: GET
URL: https://api.twitter.com/2/tweets/search/recent?query={{input.query}}&max_results={{input.max_results}}&tweet.fields=created_at,public_metrics,lang&expansions=author_id&user.fields=name,username,verified