Blog/
X/Twitter Search Operators for APIs (from:, since:, lang:)
Use X advanced search operators with a read API — from:user, since:, until:, lang:, filter:replies — plus XFlux /api/v1/search examples.
Why operators beat keyword soup
A bare keyword like “CPI” returns noise: memes, replies, and unrelated brands. Operators narrow the query the same way X’s advanced search UI does — but through an API so you can automate it.
XFlux search accepts the query string in q. You do not need the official X API approval path to run these reads. Docs: /docs/guides/search.
Operators that matter for monitoring
from:username — only posts by that account (no @ required in most clients). Useful when you already know who to watch but want a one-shot pull instead of a monitor.
since:YYYY-MM-DD and until:YYYY-MM-DD — bound the window. Keep windows short when exploring; wide ranges burn quota and return stale noise.
lang:en (or other ISO codes) — cut cross-language spam. filter:replies / -filter:replies — include or exclude reply threads. min_faves / min_retweets — engagement floors when you care about reach, not volume.
Combine carefully: from:FederalReserve lang:en since:2026-09-01 is usually better than stuffing five unrelated keywords.
Example with XFlux
Bearer auth against https://www.xfluxapi.com/api/v1/search. URL-encode the query.
curl -G "https://www.xfluxapi.com/api/v1/search" \
-H "Authorization: Bearer xflux_YOUR_KEY" \
--data-urlencode "q=from:FederalReserve lang:en" \
--data-urlencode "limit=10"
# Python
import os, requests
r = requests.get(
"https://www.xfluxapi.com/api/v1/search",
headers={"Authorization": f"Bearer {os.environ['XFLUX_API_KEY']}"},
params={"q": "CPI OR FOMC -filter:replies lang:en", "limit": 20},
timeout=30,
)
r.raise_for_status()
print(len(r.json()["data"]))Search vs account monitors
Search is on-demand: great for research, backfills, and agent tools (MCP xflux_search_tweets). Account monitors are for always-on “this @handle posted” with signed webhooks on paid plans.
Trading/macro keyword templates: /docs/guides/trading-keywords. Webhook delivery: /blog/twitter-account-monitor-webhook.
FAQ
- Do all official X operators work?
- Common read operators (from, since, until, lang, filter, OR, quotes) are the practical set. Exotic or write-oriented operators are out of scope for a read API.
- Does search count against my monthly quota?
- Yes — each search request consumes API calls on your plan. Free includes 1,000 calls/month. See /pricing and /docs/limits.
- Can I search private accounts?
- No. XFlux is for public X/Twitter data only.
Build with XFlux
Free tier for reads and one monitor. Starter from $19/mo for signed webhooks and faster polling.