twitter_search_recent
Search posts from the last 7 days using X query operators to retrieve matching tweets with engagement metrics and pagination controls.
Instructions
Search posts from the last 7 days with X's query operators (e.g. '"Lakers" lang:en -is:retweet').
Returns: {data:[{id, text, created_at, author_id, lang, public_metrics:{retweet_count, reply_count, like_count, impression_count}}], includes:{users:[…]}, meta:{result_count, newest_id, next_token}}
Auth: needs your own key in X_BEARER_TOKEN.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| query | Yes | Search query with operators (from:user, lang:en, -is:retweet, #tag, "phrase"). | |
| end_time | No | ISO 8601 upper bound. | |
| since_id | No | Only posts newer than this id. | |
| expansions | No | Related objects to embed (CSV). | author_id |
| next_token | No | Pagination token from meta.next_token. | |
| sort_order | No | Result ordering (default recency). | |
| start_time | No | ISO 8601 lower bound (within the last 7 days). | |
| max_results | No | Results per page (10-100). | |
| user_fields | No | User fields for expanded authors (CSV). | username,name,verified,public_metrics |
| tweet_fields | No | Post fields to include (CSV). | created_at,author_id,public_metrics,lang |