Search tweets with X advanced-search operators
x_searchSearch tweets with the same operators as X advanced search, such as from:, since:, min_faves: and lang:. Sort by latest or top and get each tweet's text, author, media, links and engagement counts. Read-only: returns public data and changes nothing. Costs 1 credit per request.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"query": "<query>",
"count": "<count>"
},
"name": "x_search"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| lang | No | BCP-47 language filter e.g. "en", "ja" (maps to `lang:XX`). | |
| count | Yes | Number of results to return (1–20). Defaults to 20. | |
| query | Yes | Raw search query — supports all X advanced-search operators, e.g. "openai lang:en". | |
| cursor | No | The previous response's `nextCursor`, to fetch the next page. Omit it for the first page. | |
| cacheOnly | No | Return only a cached result and never scrape live. With `cacheMaxAgeHours`, only a result that recent is returned; without it, the latest cached result of any age. Responds 404, at no cost, when there is none, e.g. true. | |
| sortOrder | No | Result ordering: "Latest" = chronological newest-first (default), "Top" = X's engagement ranking. | |
| withinHours | No | Only return tweets newer than this many hours. | |
| cacheMaxAgeHours | No | Accept a cached result scraped up to this many hours ago. A cached result costs no credits, and its `cachedAt` says when it was scraped. When no cached result is that recent, the data is scraped live at the normal price. Leave it out to always scrape live, e.g. 24. |